Results 1 to 2 of 2
  1. #1
    vector_ever is offline Senior Member
    Join Date
    Jul 2013
    Posts
    188
    Rep Power
    7

    Default Change the URL to be dynamic (pass parameters to the URL)

    Hello,

    I need to make some changes on the URL
    I have JSF page which has set of names (human names) like this
    http://localhost:8080/building/staff

    John Adam
    Nikolas Teller
    David newman
    Mac Rayan

    each of those names is link, by clicking on it will lead me to another JSF page which will display more information about this person (like email, phone number , address, ect...), but the URL will be some think like that
    http://localhost:8080/building/details It will be the same URL for every person

    Any way that URL not good what i need is changing it to have some parameters related to the chosen name (like first name, last name or id) to be some thing like this:
    http://localhost:8080/building/stuff/3 (where 3 is the id of the person) or
    http://localhost:8080/building/stuff/Adam (Adam is the last name of the selected person) or even some thing like this
    https://www.java-forums.org/localhost:8080/building/details?Fname=John&Lname=Adam

    How to do it?
    Last edited by vector_ever; 07-07-2014 at 02:47 PM.

  2. #2
    Join Date
    Apr 2014
    Location
    http://www.roytuts.com
    Posts
    51
    Rep Power
    0

    Default Re: Change the URL to be dynamic (pass parameters to the URL)

    You can do something like below in jsf 2

    <ui:repeat value="#{personBean.personList}" var="person">
    <h:commandLink action="#{personBean.getPersonDetails(person.perso nId)}" value="#{person.personName}"/>
    </ui:repeat>

    getPersonDetails(person.personId) is the action in the PersonBean.java

    Now clicking on the action it will fetch the person details using the personId and you can use ajax to show the result in the same page or you can open a popup to show the result.

Similar Threads

  1. Replies: 12
    Last Post: 04-20-2012, 05:43 PM
  2. Replies: 1
    Last Post: 04-17-2011, 03:59 PM
  3. Dynamic for loop
    By vikrambatra1709 in forum Advanced Java
    Replies: 3
    Last Post: 02-08-2010, 08:11 AM
  4. Dynamic GUI
    By ike2u in forum New To Java
    Replies: 4
    Last Post: 08-08-2009, 02:50 AM
  5. Dynamic DecimalFormatter
    By felixtfelix in forum New To Java
    Replies: 0
    Last Post: 03-17-2008, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •