File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » JSF
Bookmark "After submit the link parameter get null" Watch "After submit the link parameter get null" New topic

After submit the link parameter get null

Hoe Chin

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: 17410

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: After submit the link parameter get null
jQuery in Action, 3rd edition