This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes After submit the link parameter get null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "After submit the link parameter get null" Watch "After submit the link parameter get null" New topic
Author

After submit the link parameter get null

Hoe Chin
Greenhorn

Joined: Jul 01, 2009
Posts: 23
I have a page with link http://localhost:8080/Test/Page.faces?id=asdasdasd
The page got 2 text field and one button, after user key in the details and click submit, it works well when you first time click the submit button, the id will return me the exact value, but if the user never enter the value and click submit the validation will be invoked and next click the button again the id return null? How to solve this problem anyone can help?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15958
    
  19

JSF works by using postbacks. The important part of that word is "POST".

When you entered your original page request, it was done as an HTTP GET operation. When doing a GET, you can put parameters on the URL string (following the "?" character).

However, once the page is displayed, it will interact using HTTP POST operations. HTTP POST parameters are sent in a separate data stream and parameters on the URL are not seen.

To work around that, you should store your id value in a backing bean property so that future requests can see its value as part of the postback data stream.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: After submit the link parameter get null
 
Similar Threads
how to get values from display table tag list?
JSF how to get link parameter
JSF page submitting to backing bean, even javascript validation fails...
How to add error message before sendRedirect
Submit button not work in Netscape