tags:

views:

37

answers:

2

My project changed version of struts from struts-2.1.8.1 to struts-2.2.1. We don't use suffix ".action" for naming, after migration it is appeared. For older version html code looks like:

<form id="Login" name="Login" action="/fm2/Login" method="post"> 

But new struts renders the same form:

<form id="Login" name="Login" action="/fm2/Login.action" method="post"

So difference that .action has been added. What's wrong with new release?

+1  A: 

This is the default extension (and should be in 2.1.8.1 too).

You can change it in your struts.xml:

<constant name="struts.action.extension" value="whatever" />
Samuel_xL
A: 

This has not changed, AFAIK. Be sure to understand the difference between the "struts action" and the "action attribute of a HTML FORM" element

Typically, to render a FORM tag in Struts2 you'd use a (Struts2) form tag - its action attribute corresponds to the name of a Struts2 action, which corresponds to a url without the suffix (by default '.action', but you can change it)

So, the Struts2 tag

<s:form action="/fm2/Login">

would typically produce the HTML output

<form action="/fm2/Login.action">
leonbloy
Cannot see th logic. Two different versions of struts produce different HTML(!) code. So I don't mix the action and form of HTML, but get some side effect with new suffix.
Dewfy
"Two different versions of struts produce different HTML(!) code. " No, they don't -AFAIK. Show us an example if you found otherwise.
leonbloy
@leonbloy - read attentively my question. I have provided the example. The source of project wasn't changed, only version of struts.
Dewfy
you didn't provided the code of the jsp that produced that html, nor the relevant configuration sections (struts.action.extension )
leonbloy
And a more fundamental thing: you say "We don't use suffix ".action" for naming" . So what suffix do you use in your urls? An empty one ? That must be configured somewhere. (if not, ".action" is the default)
leonbloy