• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to change the url or (Re Write the url in JSF2.2)

 
Laxman Devayani
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this url which displaying list items fetching from db
http://jumbopack.com/cars/view-catalogue-details-cmn.htm?cId=1771&snm=202

I want my url to be like - catalogue page
http://jumbopack.com/cars/catalogue/

Any help appreciated.
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Newer versions of JSF allow more flexibility in how you can code URLs, but I think what you want is beyond even that.

A very tidy solution is to install PrettyFaces into your JSF webapp.

PrettyFaces is easy to work with. Basically, it's a library jar that goes into your app's WEB-INF/lib directory, a small amount of adjustment to the WEB-INF/web.xml file to configure the filter, and a WEB-INF/pretty.config .xml file (which may be optional now).

By defining elements in the pretty.config file or using their corresponding annotations in your backing bean java code, you can define URL patterns of the type you want.
 
Laxman Devayani
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tim For the reply,

Yes I installed PrettyFaces, Added rewrite-servlet-3.0.0.Alpha4.jar in my project lib
also addeded below filter in my web.xml
<filter>
<filter-name>Pretty Filter</filter-name>
<filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
</filter>

<filter-mapping>
<filter-name>Pretty Filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>REQUEST</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>


Created pretty-config.xml in Web-Inf and added below mappings

<url-mapping id="emp-login">
<pattern value="/login"/>
<view-id value="/cmn/emp-login.xhtml"></view-id>
</url-mapping>

But Still url showing like
http://localhost:3030/jumbopackEnv/cmn/emp-login.htm

Please suggest what i m missing here.
Any additional configuration needed?
 
Tim Holloway
Bartender
Posts: 18415
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prettyfaces is primarily for allowing people to type in (or bookmark) user-friendly URLs instead of the more abstract "handle" URLs that JSF normally uses.

You might want to look at the "action postback" option, though.

Also, if you wrote a login as part of your web application, the technical term for that is "pwned".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!