I have a little critical scenario.
Consider 3 pages. Page1, Page2, Page3.
From Page1. One parameter come in QueryString named 'note'. It is having two values 'CreateNote' or 'UpdateNote'. On bases of those values, I am hide and show few contents on Page2.
Till here no problem.
Now from Page2 I need to navigate to Page3. On Page3 a back button. I tried to set note attribute on Back but still that's not setting these information and hence on Page2 null pointer accessption arise.
A few code as below
Page1 URL like
http://localhost:9095/Oscer/pages/UpdateNote.jsf?modified=NO¬e=UpdateNote&docid=206&callFrom=prescribe
On Page2
It's handle using scriptlets like...
Set note object on backingbean constructor call.
<%
String note = request.getParameter("note");
if(note == null || note.equals("")){
note = (String)request.getAttribute("note");
}
request.setAttribute("note",note);
%>
On Page3
Tried to handle on BackButton like,
if(note == null){
FacesContext facesContext = FacesContext.getCurrentInstance();
Map<String,String> requestObj = facesContext.getExternalContext().getRequestParameterMap();
if(requestObj != null){
note = requestObj.get("note"); //Either of CreateNote or UpdateNote
}
}
request.setAttribute("note", note);
Now when we navigate from Page3 to Page2 back though I set request.setAttribute("note", note); It gives NULL pointer exception cause of note on Page2 not set yet :(
I can't understand how to navigate in case like query string handeled jsp page??