Joined: 10/01/2008 08:20:15
You can use the org.mentawai.core.PrettyURLController instead of the org.mentawai.core.Controller.
Instead of having:
You can have:
Note that you are losing the parameter names and that now you have mtw/ in front of every action URL.
The mtw/ is necessary so that you can correctly map the request to the controller in the web.xml file. Notice that we are using the PrettyURLController in the web.xml file:
OBS: If you don't want to have the mtw prefix you can map your actions some other way, like for example /Users/*.
Keep in mind that the parameters will be placed in the action input with the names "0", "1", "2", etc. So to get the parameters you should do:
Last but not least, you can use the PrettyURLParamFilter to give names to the parameters:
With the PrettyURLParamFilter, you can make any web application use the PrettyURLController without the need to change/migrate any action code.
And also feel free to use the old URL format (http://www.mysite.com/UserAction.show.mtw?id=23&category=34) with the new controller. It will just work! Just make sure you keep the *.mtw configured in the web.xml.