xrcwrn
xrcwrn

Reputation: 5327

URL Rewriting in struts2

In my site I am showing games in one jsp page. I am passing game id from one jsp

   <a href="playgame?id=<s:property value="id"/>">

after fetching game from action it is showing following url in address bar

mysite.com/playgame?id=tskaqnrg9p

I want to display url with game name as follows

mysite.com/playgame/gamename

How to do it

I am using struts2 framework

Upvotes: 1

Views: 1457

Answers (1)

Dave Newton
Dave Newton

Reputation: 160291

You can use the REST plugin as mentioned, or use a pattern-matching action mapper:

http://struts.apache.org/2.x/docs/wildcard-mappings.html#WildcardMappings-AdvancedWildcards

(Or the NamedVariablePatternMatcher.)

Upvotes: 1

Related Questions