File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes how to retrieve value from h:inputHidden Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "how to retrieve value from h:inputHidden" Watch "how to retrieve value from h:inputHidden" New topic

how to retrieve value from h:inputHidden

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
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

Joined: Oct 28, 2009
Posts: 39
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.

...did you have the fish?!............................ No.
I agree. Here's the link:
subject: how to retrieve value from h:inputHidden
It's not a secret anymore!