This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have a problem with 3 JSPs, say A.jsp and B.jsp and A.jsp includes B.jsp
A uses a useBean named 'userinfo' which is picked from the session initialized in C.jsp.
If I directly access A.jsp everything works fine.
Heres the problem:
I have to access both A(B included) and B separately.
If I try to access B.jsp which expects a 'userinfo' object I get JSP compilation errors,
and if provide the same userBean from C.jsp
in B.jsp, B.jsp works fine, but then A.jsp fails to load and says duplicate object: userinfo(one from B and the other from C).
And B does not and cannot include C.jsp, which would have solved the problem.
Why do you want to have an object of org.ex.UserInfo in both JSP's. If your requirement suffice then I would prefer to have this object created in B.jsp and as you are including it in A.jsp then you would automatically get access to this object from B.jsp. I am not sure about include standard action but include idrective should do the job!
Bear Bibeault wrote:You will have to be clearer about what you are doing.
Precisely, I am creating an object in A.jsp; including it another JSP through include directive and include standard action. And I am able to access the properties of that object in both the cases.
You can try the same and I hope you will get the same results.
In nutshell: We can access the object created in one JSP into another JSP through include directive and include standard action.