Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

After submit the link parameter get null

 
Hoe Chin
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18222
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic