Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to retrieve value from h:inputHidden  RSS feed

reubin haz
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to learn to use h:inputHidden

I saw a sample code like this:


<h:inputHidden id="hidden1" value="#{myBean.hiddenValue}" />

HTML Output

<input id="form:hidden1" name="form:hidden1" type="hidden" value="Hidden Value"/>


Then how do I write code in another Java class to get the value of parameter hidden1?

I tried this code but it doesn't work:
(String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("hidden1");

Samuel March
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with this code here
you almost have.

Now write a backing bean method (java beans specification) as specified(JSF) for a "validator method" and obtain the value (validator= on the tag).
Inside the the validator
set the UIComponent to setTransient(true);
and the component type in the validator of UIInput to saveState
with these in the workings as a choice.



did you mean use another classfile/ bean with a scope of "none" in the web app bean package folder?

JSF in most modes uses "POST" CGI request system. The design is to use a bean of at least one master-classfile that contains "session" state scope to hold the value over while nothing is occurring, and the same classfile also contains(generally the same one) a validator method for each component of the form and relates to the page form programmatically in the JSF framework not simply server side java and a normal HTML form or page.
Other services such as "output" of messages and data presented to the client are an associate point of the result of using a form and is a service to the system and method of using JSF to manipulate form data.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!