About Thodoris Bais

Thodoris is an Oracle Certified Associate Java Programmer and works as a Junior Software Developer, in the banking sector. He pursues a diploma at Informatics & Telecommunications Engineering and is interested in entrepreneurship and startups.

Hidden Value Example with JSF 2.0

In this example, we are going to demonstrate a simple way to implement a hidden value field in JSF. Hidden value fields, are used to submit data that are not inserted and authorised from the user. Some years ago (J2EE 1.4), a hidden value field was one of the three techniques that were used to implement web sessions.

In JSF, we can use the <h:inputHidden /> tag, in order to render an HTML hidden value field. For example, the JSF tag <h:inputHidden value="sample text" /> will render back, this HTML tag expression:<input type="hidden" name="random value" value="some text" />. By the end of this example, you will be able to render hidden value fields through <h:inputHidden /> tag and to also access the hidden values of them, with Javascript.

Want to be a JSF Ninja?

Subscribe to our newsletter and download the JSF 2.0 Programming Cookbook right now!

In order to get you prepared for your JSF development needs, we have compiled numerous recipes to help you kick-start your projects. Besides reading them online you may download the eBook in PDF format!

2. Our Page

Its scope is to render a hidden value through the fore-mentioned JSF tag and if a button event occurs, then it has to print the value of our hidden field; as we already said, this will be implemented with Javascript.

3. Demo

Another very simple example, let’s try to run our application by accessing http://localhost:8080/HiddenValueJSF ; if everything goes right, after clicking the button under our page’s heading, we should get something like this:

This was an example of Hidden Value in JSF 2.0. You can also download the source code for this example: HiddenValueJSF

4. Java Annotations Tutorial3>

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design

and many more ....

Newsletter

Join them now to gain exclusive access to the latest news in the Java world, as well as insights about Android, Scala, Groovy and other related technologies.

Email address:

Join Us

With 1,240,600 monthly unique visitors and over 500 authors we are placed among the top Java related sites around. Constantly being on the lookout for partners; we encourage you to join us. So If you have a blog with unique and interesting content then you should check out our JCG partners program. You can also be a guest writer for Java Code Geeks and hone your writing skills!

Disclaimer

All trademarks and registered trademarks appearing on Examples Java Code Geeks are the property of their respective owners. Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries. Examples Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.