h:inputHidden

suppose that i have:
  <h:inputHidden id="id" value=#{bean.property}>how could i get the value of the hidden field?
Regards,
Rafael Roque

What exactly do you want to do?
The h:inputHidden is only useful if you want to pass a hidden parameter from request to request in a request scoped backing bean.

Similar Messages

  • Problem with h:inputHidden

    Hi,
    I really need help to solve this problem. Here is an excerpt of a jsp page:
    Id: <h:outputText value="#{productDetailsBean.id}"/>
    Name: <h:outputText value="#{productDetailsBean.name}"/>
    Description: <h:outputText value="#{productDetailsBean.description}"/>
    Price: <h:outputText value="#{productDetailsBean.price}"/>
    <h:form id="buyForm">
         <h:inputHidden id="productId" value="#{productDetailsBean.id}"/>
         <h:commandButton value="Buy" type="submit" action="#{cartBean.addToCart}"/>
    </h:form>
    When I call the above page with the following URL:
    http://localhost:8080/jsfBookStore/details.jsp?productId=55
    it works fine.
    Now when I click the "Buy" button it fails saying the "productDetailsBean" cannot be
    instantiate. However if I replace:
    <h:inputHidden id="productId" value="#{productDetailsBean.id}"/>
    by
    <h:inputHidden id="productId" value="55"/>
    the 55 value will be picked up by the backing bean "cartBean".
    It looks as though the productDetailsBean, which has a "request scope" cannot
    be instantiated twice in a row.
    What am I missing?
    Regards.

    I'm sorry to say that I've been able to solve my problem like this:
    I've changed the following line from:
    <h:inputHidden id="productId" value="#{productDetailsBean.id}"/>
    to
    <input type="hidden" name="buyForm:productId" value="<%= request.getParameter("productId")%>"/>
    One would agree that it is particularly ugly.
    Instead of using the jsf renderer
    <h:inputHidden....>
    I had to revert to the regular HTML
    <input type="hidden"...>
    Regards.

  • Use of h:inputHidden tag

    I'm new to JSF and I have a product which using Struts frame work and I need to move it to JSF. I'm struggling to find out how to set a value to a property of a bean from the JSP page without exposing the value to the user.
    In the Struts I set the value fro the action property as follows:
    <td width = "1"><html:hidden property="action" name="MyBean" value = "add"/></td>
    I'm not sure how I can do the samething in JSF since JSF "<h:inputHidden" tag does not have "property" element.
    <h:inputHidden id="action" value="add"/>
    Below is the definition of the bean that I'm using.
    Please help.
    John
    public class MyBean {
    // Some data captured from the form
    private String action;
    pulbic String process() {
         String outcome = null;
         if ("add".equals(action) {
              // outcome = add the data
         } else if ("update".equals(action) {
              // outcome = update existing data
         } else else if ("delete".equals(action) {
              // outcome = delete existing data
         } else {
              // unsupprted action
         return outcome;
    }

    That effect can sometimes occur if a post has been edited by a host. Can you tell if any changes been made to the original post since you replied to it, Robert?

  • JSF1.0. valueChangeListener has no effect for inputHidden

    inputHidden has valueChangeListener, but it looks like it has no effect.
    For example:
    <h:inputHidden valueChangeListener="#{GetNameBean.callMe}" id="userName" />
    if I replace inputHidden with inputText, the listener is been fired. Is it a bug or what? The same code works in the jsf-ri1.0 beta.
    P.S. the same problem in case of using <f:valueChangeListener>

    I have cut the previous text off before posting. This is a full version of the page where only inputText is replaced with inputHidden. Such code does not work.
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <f:loadBundle basename="demo.bundle.Messages" var="Message"/>
    <HTML>
    <HEAD> <title>Input Name Page</title> </HEAD>
    <body bgcolor="white">
    <f:view>
        <h1><h:outputText value="#{Message.inputname_header}"/></h1>
        <h:messages style="color: red"/>
        <h:form id="helloForm" >
        <h:outputText value="#{Message.prompt}"/>
        <h:inputHidden valueChangeListener="#{GetNameBean.callMe}" id="userName" value="#{GetNameBean.userName}" required="true">
           <f:validateLength minimum="2" maximum="20"/>
         </h:inputHidden>
         <h:commandButton id="submit" action="sayhello" value="Say Hello" />
        </h:form>
       </f:view>
    </body>  
    </HTML> demo.GetNameBean:
    package demo;
    import javax.faces.event.ValueChangeEvent;
    import javax.faces.event.AbortProcessingException;
    public class GetNameBean {
         String userName;
         public String getUserName() {
              return userName;
         public void setUserName(String name) {
              userName = name;
         public void callMe(ValueChangeEvent event)
         throws AbortProcessingException {
              userName="Duke";

  • What is the equalent component for inputhidden in ADF11g

    hi
    can any tell the equalent component for inputhidden in ADF11g
    thanks in advance
    GiriBabu N

    Hi,
    Just use Trinidad's, I don't think 11g has an equivalent and Chris suggestion won't really work in this case as visible="false" is the same as rendered="false" for decoding purpose and you want it to be decoded in your case. Another poor man's solution would be
    <af:inputText value="..." inlineStyle="display:none;"/>Regards,
    ~ Simon

  • InputHidden

    I want to set the initial value of a inputHidden field to a value in a request parameter but want it to set a property of my backing managed bean when submitted. The TLD says I cannot do something like this and I get an error:
            <h:inputHidden id="activationKey"
                           value="${param['key']}"
                           binding="#{UserActivationForm.activationKey}"
                           required="true" />So how can I do something like this. Basically a user clicks on an email activation link with a key parameter set on it. I want to build up a form with one hidden field that's value is the key and when a button is clicked my backing bean is called. The only way I can get this to work is using JavaScript to set the value of the hidden field after the page loads. That is unacceptable because the user might not have JavaScript enabled.
    I can do this really easy with the standard HTML <input type="hidden"> field but then I can't use JSF.
    Any ideas?

    No, with h:inputHidden you can just transfer a request scoped bean property to the next request. Just using the value attribute should be enough. One concern is that this doesn't survive when the validations phase fails for other (visible) input components. In such case binding the component to the bean and "hard" transferring the value by the component's setValue() and getValue() would solve this issue. The value attribute is superfluous then. Better alternative for this is the Tomahawk's t:saveState component or probably -depending on the actual scope of the value- a session scoped bean. You normally store the logged in User in session.

  • Using h:inputHidden in JSF

    I am using the IBM tabbed pane control in my JSF project. I want to pass some value from one tab pane to another. I have tried doing the following:
    In my first tabbed pane, I have a code like this:
    code:
    <h:inputHidden id="txt1" value="some value"></h:inputHidden>
    In the second tabbed pane, I do something like this:
    code:
    <%HtmlInputHidden hidden = (HtmlInputHidden) findComponentInRoot("txt1");%><h:outputText value="#{hidden.getValue()}" />
    I am putting this code in a JSP fragment page. This JSP fragment page is put inside the JSP page usign <%@include...%>.
    However, I get the following errro:
    code:
    class HtmlInputHidden location: class org.apache.jsp._DateHolidayFcstParmSave HtmlInputHidden hidden = (HtmlInputHidden) findComponentInRoot("txt1"); ^An error occurred at line: 209 in the jsp file: /secure/content/holidayfcst/dateParmHolidayFcstSave1.jspf Generated servlet error:E:\dvl\New_syscode\workspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\DymondParm\DymondParmWeb.war\secure\content\holidayfcst\_DateHolidayFcstParmSave.java:2280: cannot resolve symbolsymbol : method findComponentInRoot (java.lang.String)location: class org.apache.jsp._DateHolidayFcstParmSave HtmlInputHidden hidden = (HtmlInputHidden) findComponentInRoot("txt1"); ^3 errors
    please help!

    HI
    I am new to JSF. I am trying to pass some value as hidden parameter to the bean class. But I get value a 0.
    I am using the tag as:
    <h:inputHidden id="xyz" ></h:inputHidden>
    Actually I am getting this value of xyz in java script. And there I am setting into form and from the jsp I am passing as hidden parameter.
    Please let me know whether I am right or wrong and also provide me the solution.
    thanx in advance
    Regards
    Rupesh

  • Can you specify a Collection as a inputHidden value?

    I am trying to set an inputHidden field to a List in a JSF Facelets page. However the list is always set to null in the backing bean after the page is submitted.
    Code:
         <h:inputHidden value="#{controllerObj['ttyList']}" />
         <h:inputHidden value="#{controllerObj['emailList']}" />
    </a4j:form>
    Can a inputHidden field be used to hold a Collection such as an ArrayList?
    Thanks in Advance?

    Glad you fixed it.
    Though, for future reference I would add some more background information:
    The HTML response isn't anything else than one big String (a big character array). Also the HTTP request parameters can't contain anything else than Strings. Before writing to the response stream, all non-String typed objects are forced to their string representation using Object#toString().
    JSF is smart enough to convert (coerce) between String and Number/Boolean itself, but for other object types, such as List, you'll have to implement and specify a javax.faces.convert.Converter. In the getAsObject() method you write logic to convert from String to List (or any other object type). In the getAsString() method you write logic to convert from List (or any other object type) to String. Finally define this converter in the faces-config.xml. You can use the <converter-for-class> entry to do it 'transparently' in all JSF pages, you can also use <converter-id> entry to define the converter in the associated UIInput component yourself using the converterId attribute or the f:converter facet.

  • Override the name attribute in inputText or inputHidden

    Hi all,
    Is it possible to override the name attribute of an input element? For example, the following JSF page:
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <f:view>
    <html>
    <body>
    <h:form>
      <h:inputText/><br />
      <h:inputHidden /><br />
      <h:inputText id="input1" /><br />
      <h:inputHidden id="input2" /><br />
    </h:form>
    </body>
    </html>
    </f:view>Produces the following HTML:
    <html>
    <body>
    <form id="j_id_jsp_188410409_1" name="j_id_jsp_188410409_1" method="post" action="/cbs/test.jsf" enctype="application/x-www-form-urlencoded">
    <input type="hidden" name="j_id_jsp_188410409_1" value="j_id_jsp_188410409_1" />
    <input type="text" name="j_id_jsp_188410409_1:j_id_jsp_188410409_2" />
      <br />
      <input type="hidden" name="j_id_jsp_188410409_1:j_id_jsp_188410409_3" /><br />
      <input id="j_id_jsp_188410409_1:input1" type="text" name="j_id_jsp_188410409_1:input1" /><br />
      <input id="j_id_jsp_188410409_1:input2" type="hidden" name="j_id_jsp_188410409_1:input2" /><br />
    <input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="_id2" />
    </form>
    </body>
    </html>Would I have to write a custom component and then override the getName and setName attributes?
    Many Thanks
    Andy

    Note that the HTML you posted does not match the JSF source you posted.
    If you just need dependable names, add an id to the <h:form> and then the name will be in the format formId:inputId.
    Another possibility is to use the prependId attribute of <h:form> to suppress the name mangling.
    Yet another possibility is to use the forceId attribute of the Tomahawk components.

  • ADF Faces InputHidden required

    Hi all,
    I've a InputHidden in my form that has the required property as true. When the validation occurs, in the message panel is showed " - is required." without a label, in InputHidden hasn't a label property, so has any way to associate a label to a InputHidden to prevent this problem?
    Thanks

    Hi,
    In my case i've a Two Fields as sample:
    CODE, DESCRIPTION
    In my screen i show only DESCRIPTION field, that's populated by a LOV (Popup), i need to update the CODE, that is a FK (Sequence), but it's field haven't relevancy to show to user, a detail, DESCRIPTION can only be populated by LOV, so it's disable field.
    Thanks

  • CommandLink / inputHidden / binding bean problem

    Hi all
    I am trying to pass form data to a backing bean via a hidden input, using the following code:
    <h:form>
    <h:commandLink action="#{reportManager.switchReport}" value="#{data}"/>
    <h:inputHidden value="#{data}" binding="#{reportManager.param0}"/>
    </h:form>Ideally i want the commandLink to call a java method with the argument #{data}. However, arguments cannot be used with the commandLink technique so i am trying to pass it via a hidden input instead.
    Unfortunately the above code gives the error:
    java.lang.IllegalArgumentException: argument type mismatch
    I do not get errors if i replace the input code with:
    <h:inputHidden value="#{reportManager.param0}"/>only this time there is no way of writing #{data} to the bean, and instead the value is taken FROM the bean, ie null! Furthermore, if i use:
    <h:inputText value="#{reportManager.param0}"/>and type the value of #{data} into the textbox before clicking the commandLink, everything works fine. The situation is very frustrating.
    Can anyone suggest how to hold a value in a hidden-input, and pass it to a bean in this way? Thanks in advance
    Rich

    Thanks for you reply
    I can't use the method you suggest because 'data' is not a property in my reportManager bean - it is simply a value (user ID) obtained from the iteration of a result set (i am displaying a table of figures based on the results of a database query). Hence the value of 'data' is only known on the jsp page and needs to be tied to another property in my backing bean.
    How does one go about using the UIInput method? I have tried adding:
    public UIInput getUserId() {
              return userId;
         public void setUserId(UIInput userId) {
              this.userId = userId;
         }to my reportManager bean, and using:
    <h:commandLink action="#{reportManager.switchReport}" value="#{data}"/>
    <h:inputHidden value="#{data}" binding="#{reportManager.userId}"/>to reference the methods. only now i get the error:
    javax.faces.el.PropertyNotFoundException: /secure/report.xhtml @105,79 binding="#{reportManager.userId}"
    Any suggestions or pointers much appreciated
    -3po

  • Acess of tr:inputHidden value in Jdev11g

    Hi,
    I want to access the value of hidden variable which i am taking form requestScope. Actually i need to use this value in a xml so that i can send it to the server to update the value at the click of the Approve button, if Decline button is clicked the response would be different, the action would depend on the button i click.
    Below is the code i am using:
    <tr:inputHidden id="hiddenId" value='"#{requestScope.myId}"'/>
    I can i access the #{requestScope.myId} and print it as below:
    <af:outputText id="ot1" value='"#{requestScope.myId}"'/>
    How can this be achieved ???
    Thanks & Regards
    Sishant
    Edited by: user784337 on May 23, 2010 2:23 AM

    Hi,
    In the Approve or Decline button actionListener in your backing bean use the following code to get the value of #{requestScope.myId}
    ValueExpression valueExp = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createValueExpression(FacesContext.getCurrentInstance().getELContext(), "#{requestScope.myId}", Object.class);
    Object myId = valueExp.getValue(FacesContext.getCurrentInstance().getELContext());
    Cheers,
    Nick

  • Can I use a inputHidden for javascript values that doesn't set the value?

    I have a hiddenInput field for each row in a datatable so I can restore default values to a date field with a javascript function. I am getting conversion errors because I don't have the right setters in the backing object - and I really don't want to put them there - but I don't want the tag to set the values! Is there any way to just set a hidden value somewhere for each row of a datatable but not have it try to set the value? Thanks in advance!

    I just realised that won't work because all the HTML tags will have the same name, whereas I need the dynamically generated suffix that a dataTable assigns to every element in the row i.e. '_id34', so I can reference the value in the javascript and compare it to entered values. Any more ideas? I am having huge memory problems when I'm submitting my form too, using up 2GB of mem and then dying! I'm not sure what's causing it, because it doesn't get as far as my action method code before it dies! It works for smaller tables but I need to be able to handle ~20 users with tables 4x the size I can process now without running out of memory :( Any help would be really really appreciated!!

  • View images in a datatable from byte[]

    I am trying to view images in a datatable where the image is
    a byte[]. This is what I tried... doesn't work.
    <h:dataTable rows="5" value="#{AirportList.airportList}" var="airport" binding="#{AirportList.airportData}">
              <h:column>
                <f:facet name="header">
                  <h:outputText value="airportCode"/>
                </f:facet>
                <h:outputText value="#{airport.airportCode}"/>
              </h:column>
              <h:column>
                <f:facet name="header">
                  <h:outputText value="airportMap"/>
                </f:facet>
                  <h:inputHidden id="ole" value="#{airport.airportMap}"/>
                  <h:outputText value="#{AirportList.myMap}"/>
                 <div>
                 <!--
                      try
                        byte[] pic = (byte[])request.getAttribute("AirportList.myMap");
                        response.setContentType("image/jpeg");
                        OutputStream os = null;
                        os = response.getOutputStream() ;
                       // os.write(pic);
                        os.close();
                        os = null;
                      catch (Exception ex)
                        out.println("Exception: " + ex.getMessage());
                        ex.printStackTrace();
                   -->
                  </div>
              </h:column>
              <h:column>
                <f:facet name="header">
                  <h:outputText value="airportSugBook"/>
                </f:facet>
                <h:outputText value="#{airport.airportSugBook}"/>
              </h:column>
            </h:dataTable>

    my backing code
    public class Airport
      Collection AirportList;
      private UIData AirportData;
      byte[] MyMap;
      public Airport()
      public Collection getAirportList()
        try{
          InitialContext context = new InitialContext();
          AirportLOBLocalHome home =  (AirportLOBLocalHome)context.lookup("java:comp/env/ejb/local/AirportLOBLocal");
          AirportLOBLocal local = home.create();
          AirportList = local.showAirports();
          Iterator it = AirportList.iterator();
          while(it.hasNext())
            ((OtnAirportLobDetailsLocalDTO)it.next()).getAirportMap();
          return AirportList;
        catch(Throwable e)
          e.printStackTrace();
        return null;
      public void setAirportList(Collection AirportList)
        this.AirportList = AirportList;
      public UIData getAirportData()
        return AirportData;
      public void setAirportData(UIData AirportData)
        this.AirportData = AirportData;
      public byte[] getMyMap()
        OtnAirportLobDetailsLocalDTO ap = (OtnAirportLobDetailsLocalDTO)AirportData.getRowData();
        return ap.getAirportMap();
       // return null;
      public void setMyMap(byte[] MyMap)
        this.MyMap = MyMap;
    }

  • Using commandLinks and commandButtons in dataTables

    I'm trying to create a page that displays data from a database and allows you to edit individual rows by clicking on either a commandButton or a commandLink within a dataTable that then takes you to another page where you can edit that particular row of the table.
    When using a commandButton, it works perfectly for all but the last entry in the table. But when the button in the last line is clicked, nothing happens at all, it does not seem to call the action listener and it does not perform the navigation based on the action. But with all the previous buttons it calls the actionListener and navigates perfectly. Can anyone tell me why this would be? The code is as follows:
    <h:dataTable value="#{Categories.categories}" var="category" >
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.deptColumnHead}"/></f:facet>
    <h:outputText value="#{category.departmentName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.categoriesColumnHead}"/></f:facet>
    <h:outputText value="#{category.categoriesList}"/>
    </h:column>
    <h:column>
    <h:form>
    <h:inputHidden id="dept" value="#{category.departmentId}"/>
    <h:commandButton id="editButton" action="EditCat" actionListener="#{Categories.editListener}" value="{msgs.editSelectedButtonText}"/>
    </h:form>
    </h:column>
    </h:dataTable>
    When using commandLinks, only the first one works (of 4). For the other 3 the page goes into error when the link is clicked and it complains that 'document.forms._id2:3:_id10._id2:3:_id10:idcl is null or not an object'. If anyone could tell me what is wrong with my code, i would be most appreciative.
    <h:dataTable value="#{Categories.categories}" var="category" >
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.deptColumnHead}"/></f:facet>
    <h:outputText value="#{category.departmentName}"/>
    </h:column>
    <h:column>
    <f:facet name="header"><h:outputText value="#{msgs.categoriesColumnHead}"/></f:facet>
    <h:outputText value="#{category.categoriesList}"/>
    </h:column>
    <h:column>
    <h:form>
    <h:inputHidden id="dept" value="#{category.departmentId}"/>
    <h:commandLink action="EditCat" actionListener="#{Categories.editListener}">
    <h:outputText value="#{msgs.editSelectedButtonText}"/>
    </h:commandLink>
    </h:form>
    </h:column>
    </h:dataTable>

    1) I have had very odd behavior in JSF when ALL of the
    JSF elements on a page do not have an id attribute. If
    you do not assign an id then JSF will manufacture a
    unique id on the flag. Sometimes the unique id wasn't
    so unique and there were errors like you are seeing or
    just odd behavior on the form, buttons not generating
    events, or incorrect rendering, etc.
    By 'ALL' I mean output text, columns, anything that
    accepts an id attribute. Don't trust the code to
    generate an id correctly for you.Just want it known that while this may be necessary in the short-term to work around bugs, this is definitely not the intent of the EG! We don't want people getting in the habit of
    Also note that this behavior is not consistent
    sometimes it would not appear on a page unless the
    page was updated and more controls added to it.Ah, well that is a known issue; while developing a page, the Sun RI can have problems if you change a page's contents between two submissions. (It doesn't pick up that the .jsp has changed.) I'd recommend:
    - Use client-side state saving.
    - Make sure you're making a new request for a page (not re-POST-ing anything!) when the page's contents have changed.
    If you follow both of those rules, then you should generally be able to get away without explicit IDs everywhere as you actively develop your page.
    Explicit IDs are required if you're inside <c:if>; this is known and documented.
    2) try putting the hidden input control in it's own
    columnNo, that'll give you a bonus set of <td> elements, which isn't what you want.
    -- Adam Winer (EG member)

Maybe you are looking for

  • Maximum connections allowed for AMS 5.0.1

    How can I find out the maximum connection allowed for adobe media server 5.0.1 standard license?

  • Sending a Mail with an appointment attachment via ABAP

    Hi all, I am currently trying to send an Outlook appointment as a .VCS file with SO_NEW_DOCUMENT_ATT_SEND_API1 by filling the CONTENTS_BIN parameter with the vcs-file contents. The email gets sent but in Outlook there is some weird attachment with no

  • How to keep notes under a certain topic and share the whole topic, like iClass??

    Itunes U is great for taking notes when learning something like watching a video. But how to share the notes like Evernote App from icloud? Will apple get this function in ios 7? Looking forward to... <Edited By Host>

  • Solaris JVM memory footprint

    WLS8.1sp4 running on Solaris configured with: -Xms1024m -Xmx1024m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:SurvivorRatio=3 -verbosegc -XX:+PrintGCDetails Monitoring java process with "pestat" shows that memory c

  • Can I Integrate My Database with BC Email Functionality?

    I would like to set up automated marketing so anyone who is added to our database receives a series of emails based on their creation date in the system, as well as custom parameters. For example, anyone added to our database in the past 24 hours who