It's not a secret anymore!
The moose likes JSF and the fly likes jsf and hidden fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "jsf and hidden fields " Watch "jsf and hidden fields " New topic

jsf and hidden fields

Anthony Taylor

Joined: May 04, 2006
Posts: 26
I am trying to figure out a way of using hidden fields in a JSF page where the hidden field would not render but its values would be accessible from the bean, through the bean property it is mapped to. Every attempt to do this has resulted in the bean property not getting the expected value. Now I tried this with a textbox that was not hidden and I received the expected value. When I try this with our custom tag which bypasses the render phase this does not work. In, this works via the viewstate. It seems as if the component tree is not able to find this value and I am a big fan of hidden fields not displaying on the page. Any help or suggestions would be greatly appreciated.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

I think maybe your biggest problem is in wanting to use hidden fields at all. JSF has too many hidden fields already.

Seriously, JSF is intended to be about as pure an implementation of an MVC architecture as anything that communicates via HTTP can be, and I've certainly never heard of anyone wanting to store part of the Model in its View - that's kind of defeating the purpose.

The hidden stuff that JSF pushes back and forth are more about the internal state of JSF than the business of the application. And, as far as I can recollect, back in the days when I used hidden fields myself, I too was using them for state-control purposes.

For business logic purposes, I'd recommend using a regular JSF javabean. You wouldn't have to get all tricksy with the view.

I know some people think that Session objects are a big drain on the server, and prefer to dump them on the client, but I think that's mostly false economy, since the time and effort required in pushing them back and forth is pretty high. Also makes it easier to hack the app.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: jsf and hidden fields
jQuery in Action, 3rd edition