Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts 2: specifying pages with no name extension?

 
André-John Mas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have seen some sites that use struts and have it so that the pages don't use a file extension, so:

http://myhost/path/abc

instead of

http://myhost/path/abc.action

how would I go about achieving this with struts 2?
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi,

just see Struts2+ annotation base development.

 
André-John Mas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any chance you could point me to an actual document. Based on the information you gave me I couldn't find anything of help.
 
Eric Nielsen
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's what I did for Struts 2.0.x + the SmartURLs plugin. I'm planning to migrate to Struts 2.1.x + Convention plugin plugin later today. (SmartURLs was a third party plugin, that became the base for the Convention plugin, so I expect them to be similar, but not exactly the same.)

in struts.xml


IIRC, the struts.action.extension can not be set to the empty string in 2.0.x without the SmartURLs filter replacement shown below in the web.xml. The action.packages just tells SmartURLs where to look for actions that aren't configured in struts.xml and the default.parent.package parameter assigns all discovered, non-overridden actions an xwork-package (ie not a java package).

in web.xml


I haven't been able to look for the updated documentation yet, but I would assume poking around looking for information on the Convention plugin would be the right starting point.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic