• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to retrieve value from h:inputHidden

 
Ranch Hand
Posts: 287
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic