• 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

problem by getting values from h:form

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
got it!

this.getFacesContext().getExternalContext().getRequestParameterMap().get("subview1:registration:form:username");
 
Saloon Keeper
Posts: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 27807
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic