*
The moose likes Struts and the fly likes what do I need to change in web.xml to omit the .action extension? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "what do I need to change in web.xml to omit the .action extension?" Watch "what do I need to change in web.xml to omit the .action extension?" New topic
Author

what do I need to change in web.xml to omit the .action extension?

Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Hey S2 experts

can anyone tell me what I can modified in web.xml to omit the .action extension? is it in <url-pattern></url-pattern> tag?
and if it is, how do I change it because the default for s2 is /*

Thanks in advance, much appreciated
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

In your struts.properties file you have to change the property struts.action.extension (see http://struts.apache.org/2.1.6/docs/strutsproperties.html).
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

XML configuration is preferred:

http://struts.apache.org/2.1.6/docs/constant-configuration.html
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
Thanks Gentleman,

I will try both struts.properties and web.xml to see which works better or just simply works for me

just one quick question, where does struts.properties should be, my guess now is /WEB-INF/classes

thanks
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

http://struts.apache.org/2.1.6/docs/strutsproperties.html wrote:The properties file can be locate anywhere on the classpath, but it is typically found under /WEB-INF/classes

But I guess you should listen to Dave since he's more into Struts than me.
Davie Lin
Ranch Hand

Joined: Aug 05, 2007
Posts: 294
ok Gentlemen

Just want to report to you that in struts.xml

I have



and it will omit the .action extension

just want to make sure one thing from Mr. Newton

Is this the XML configuration that you're referring to?

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Yes. This would be shorter and clearer:
 
Consider Paul's rocket mass heater.
 
subject: what do I need to change in web.xml to omit the .action extension?
 
Similar Threads
All about action servlet
Aliasing in tomcat for a jsp
servlet action
url-pattern for filters
modify extension .do to .web