0
   <h:commandLink  action="http://192.168.2.66:8084/TekirMobile2/customerListDetailed.xhtml" value="#{item.code}" >
                                <h:inputHidden value="#{item.address}" />
                                 <h:inputHidden value="#{item.name}" />

                            </h:commandLink>

I have above code. This code in customerList.xhtml and after user click to the commandLink button i want to send input hidden value to customerListDetailed.xhtml. How can i do that?

  • 1
    Was is your Question now? – Lukas Eichler Apr 20 '13 at 10:10
  • Which books/tutorials/resources did you read while learning JSF? Your `action` attribute is completely wrong. It must point to a backing bean action method or a navigation case outcome. First of all, did you succeed to create a Hello World JSF application with 2 pages? E.g. GuessNumber and so on? In any way, before answering your concrete question we need to know if those two pages are running in the same web application. – BalusC Apr 21 '13 at 00:44

1 Answers1

-1

To do this, you can write hidden tag after commandLink tag. Note that you should add above codes into h:form tag

Example:

      <h:form>
             <h:commandLink 
    action="http://192.168.2.66:8084/TekirMobile2/customerListDetailed.xhtml" 
            value="#{item.code}" >     
            </h:commandLink>
            <h:inputHidden value="#{item.name}" name="name" id="name" />
  <h:inputHidden value="#{item.address}" name="address" id="address" />
        </h:form>

Backing Bean

@ManagedBean(name="item")
public class Item implements Serializable{
    private String code;
    private String address;
    private String name;
    public Item(){
        String name= FacesContext.getCurrentInstance().
    getExternalContext().getRequestParameterMap().get("name");
        String address= FacesContext.getCurrentInstance().
    getExternalContext().getRequestParameterMap().get("address");
    }
   //getters and setters


}
olyanren
  • 1,448
  • 4
  • 24
  • 42
  • how can i get these value in other page? – user2299982 Apr 20 '13 at 10:37
  • @user229982: http://stackoverflow.com/questions/3351348/get-request-parameter-values-in-jsf – Marco Forberg Apr 20 '13 at 10:41
  • it even does not redirect my page to other page why? and in other page i can get it with for ex: #{item.getName() – user2299982 Apr 20 '13 at 10:48
  • Please go through a JSF Hello World yourself as well. Before posting future answers, please test/experiment yourself in a playground environment first so that you can confirm from own experience that it really works. – BalusC Apr 21 '13 at 00:45
  • You are saying following codes are wrong: String name= FacesContext.getCurrentInstance(). getExternalContext().getRequestParameterMap().get("name"); – olyanren Apr 21 '13 at 03:24
  • @mucayufa he's saying your `` won't send parameters in any instance. Wrong component, wrong usage – kolossus Apr 21 '13 at 16:32
  • sorry I updated my answer. I forgot name attribute of hidden values – olyanren Apr 21 '13 at 18:11