url pattern for view individuals users.

Splash Forums PrettyFaces Users url pattern for view individuals users.

This topic contains 2 replies, has 2 voices, and was last updated by  lofainc 5 years, 4 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18144

    lofainc
    Participant

    Actually I have a list of users(dataTable with a link on userId). On clicking userId redirect to view page.I need page for viewing users with url pattern, http://localhost:8080/user/view/1 for first user and http://localhost:8080/user/view/2 for the second etc.How can I achieve this with prettyfaces? How to process this userId ,say 1,2 etc in the backing bean.Can anybody explain?

    `<url-mapping id=”view”>

    <pattern value=”/user/view/#{bean.userId}/” />

    <view-id value=”/userview.jsf” />

    </url-mapping>`

    So how can I get this userId inside my bean?

    I am using JSF2+Primefaces.3.0.M3+Prettyfaces-jsf2.3.3.2 with GAE.

    #22048

    The code you posted is already a good example. In this case the userid will be injected into #{bean.userId}. So you don’t have to “get” the value from anywhere. You just have to tell PrettyFaces where it should be stored. :)

    See this chapter in the documentation:

    http://ocpsoft.com/docs/prettyfaces/3.3.2/en-US/html/Configuration.html#config.pathparams.el

    The next step would be to add a page action that get’s executed whenever this URL is accessed. This method could then use the injected ID to load the user from the database.

    See this chapter for details on page actions:

    http://ocpsoft.com/docs/prettyfaces/3.3.2/en-US/html/Configuration.html#config.actions

    I hope this helps :)

    #22049

    lofainc
    Participant

    Thanks.. I got that.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

Comments are closed.