Reputation: 23644
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?
Upvotes: 0
Views: 3418
Reputation: 1
I removed the struts2-convention-plugin-2.1.8.1 jar from my web-inf/lib and it started to work fine. Hope this helps... cheers...
Upvotes: 0
Reputation: 11
I have a similiar problem when change to struts-2.2.1 from struts-2.1.8.1. Struts-2.2.1 will add the ".action" extension automatically for redirectAction result. This is very annoying.
Upvotes: 1
Reputation: 75996
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">
Upvotes: 0
Reputation: 19337
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" />
Upvotes: 3