I'm starting with PrettyFaces and i would like a url like this:
"/project/car/alter/120" -- this is pretty link.
But when i send a GET request in JSF i got this:
"/project/car?action=alter&id=120"
If i make this in pretty-config.xml:
<url-mapping>
<pattern value="/car/#{action}/#{id}" />
<view-id value="/car?action=alter&id=120" />
</url-mapping>
This don't work because i can't generate the "pattern" link. How can i solve this ?
First, you should not hard-code your parameter values in the url-mapping configuration. It should look like this:
<url-mapping>
<pattern value="/car/#{action}/#{id}" />
<view-id value="/car.xhtml" />
</url-mapping>
Next, you should use to generate your URLs in your XHTML pages:
http://www.ocpsoft.org/docs/prettyfaces/3.3.3/en-US/html/outbound_rewriting.html#jsf
<h:link outcome="/car" value="View car>
<f:param name="action" value="view" />
<f:param name="id" value="231" />
</h:link>
Does this answer your question?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.