I am new to JSF framework and I am stuck with some doubts.I need to pass and retrieve some parameters using query string from "http://www.domain.com/project/jsps/register.jsp", on button click, I am entering the data in to database and if any error occurs, I am returning "error" String. My plan is to pass different error codes for different errors.
Is it the exact way to pass parameters as query String?
Again in my error.jsp, I need to access the error codes and display the corresponding errors.
http://domain.com/project/jsps/error.jsp?code=1 should show like,
"An Error occurred..(error corresponding to the code)"
In the managed bean of error.jsp I need the check against each error codes and then display the corresponding error in error.jsp
I am using JSF 1.2 Thanks in advance..
We don't have many rules here at the JavaRanch, but we do insist that you use your Real Name and not some sort of "handle" or obvious alias. If you're not sure about this, see
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jan 01, 2013
Wats in a name! Any ways I have made request to change the display name :-) Please somebody help me find a solution to my problem.
@Divyesh Shani : do inform me if a find the soln :-)
What's in a name? Well, I think we explained why we require real names in our FAQ. We're not doing it just to be pompous and obnoxious. Besides, I do pompous and obnoxious for free.
JSF is considerably different from most web frameworks. One of those differences is that most operations are done using HTTP form POST operations, not GET requests. Also, the POST may be done multiple times (postback). So passing parameters in via a URL has limited utility. It can get you into a page edit, but once you start working with that page, subsequent operations will be managed via POST.
In JSF version 1, getting the GET parameters did require brute-force access via the FacesContext, but JSF version 2 has some extra View Template tags that can make the job easier. There's also PrettyFaces, which is a third-party add-on that can handle not only parameters, but also alternative URL forms such as "Target/id=1234" or even "Target/1234". This is extremely handy for making "bookmarkable" URLs, since you can't "bookmark" HTTP POSTs.