This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

how can i take the struts 2 action suffix out?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The default suffix is ".action",
and now ,i want to take it out from the form action(i don't mean to change it)
i see many sites have done it, how can i do so?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In both Struts 1 and Struts 2, there are two methods of identifying an action:
  • With a suffix. Examples: myAction.do or myAction.action
  • with a "/" delimited path in the URL. Examples: /action/myAction, /struts/myAction
  • The point is you need some way of identifying how to recognize an action that is defined in the configuration file as opposed to a file such as an HTML or image file.

    In order to use path names instead of a suffix in Struts 2, set the property struts.enable.SlashesInActionNames to true in the struts.properties file.
     
    Kobe Luo
    Greenhorn
    Posts: 21
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    how can i configure it to use /action/~~
     
    Merrill Higginson
    Ranch Hand
    Posts: 4864
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    See the comments for the property struts.enable.SlashesInActionNames in the link below:

    http://struts.apache.org/2.x/docs/strutsproperties.html
     
    Ranch Hand
    Posts: 194
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I put

    in my struts.xml and I have extenionless actions.

    I'm using the SmartURLs plugin, which is slated to become the Convention plugin in an upcoming release. I don't think you can use extenionless actions without this plugin at present.
     
    Consider Paul's rocket mass heater.
      Bookmark Topic Watch Topic
    • New Topic