Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem by getting values from h:form

 
Chrigi Pfister
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'll make it short:

i have this jsp with a form:



now i'm trying to get for example the username like this:

this.getFacesContext().getExternalContext().getRequestParameterMap().get("registration:scriptCollector1:form:username");
i just get null.

with this call i get an array with all the parameters from the form.
this.getFacesContext().getExternalContext().getRequestParameterMap().values().toArray();
[ January 17, 2008: Message edited by: Chrigi Pfister ]
 
Chrigi Pfister
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got it!

this.getFacesContext().getExternalContext().getRequestParameterMap().get("subview1:registration:form:username");
 
Tim Holloway
Saloon Keeper
Posts: 18302
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hope there was a good reason for all this. If you'd just mapped the properties of a backing bean to the form, the'y be pushed into the bean via its property setters automatically and you wouldn't have had to code arcane JSF service calls. Or, for that matter, any calls at all.
 
Chrigi Pfister
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no, there was no good reason ;-)

i was not aware of the possibilities with JSF, now i know better.
 
Tim Holloway
Saloon Keeper
Posts: 18302
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a good rule for JSF:

Any JSF problem that results in a complex solution probably has a much cleaner and simpler one.

And its corollary:

The best JSF code is code that doesn't include any explicit JSF references in it at all.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic