wood burning stoves 2.0*
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
Author

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:

Example

<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");



Thanks.


SCJA, SCJP5.0, SCBCD, SCWCD
Samuel March
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
with this code here
value="#{myBean.hiddenValue}"
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.
resetValue()
restoreState()
saveState()

---

or

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: http://aspose.com/file-tools
 
subject: how to retrieve value from h:inputHidden
 
Similar Threads
Error on console RenderResponsePhase execute
trying to populate hidden field on my JSF form using jQuery
Question on how to fix error on inputHidden field
Not able to submit the hidden pramaters from one jsp to the next jsp
Head First Servlets & JSP book - JSP Question