2

How to implement templating in JSF+JSP without Facelets?

I have a left menu and a <jsp:include> for the center content in my layout page, both are contained within a <form> in the layout.jsp. When the <h:commandLink> in the left menu is clicked, then the page is submited and the action is called to set the coresponding managedbean property used within the <jsp:include>, but this doesn't work as I run into errors like my scope getting resetted.

Any help and thoughts on this is highly appreciated.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
JSF
  • 57
  • 5
  • possible duplicate of [JSP tricks to make templating easier?](http://stackoverflow.com/questions/1296235/jsp-tricks-to-make-templating-easier) – BalusC Feb 13 '12 at 21:07
  • If you want a concrete answer to your problem with "scope getting resetted", you'd need to ask a more concrete question. Edit: based on your question history you seem to be using JSF 2.0. What's the rationale behind choosing the deprecated JSP view technology instead of its successor Facelets? – BalusC Feb 13 '12 at 21:08
  • Thanks BalusC i will try that out.. "Scope getting resetted" When the page gets submitted through the command link the manageed bean for the page included previously via the JSP :include is getting called and there i have a code related to session, i could see those varaibles during the constructor call but in one of the getter of that managed bean the session varaible is not available.Seems like one the method on the left menu click is resetting the session.. – JSF Feb 13 '12 at 21:16
  • I'm not sure what's the problem, without seeing some concrete code it's hard to pinpoint the cause, but do you really want to store request-specific data in the session scope? Have you thought at least twice about how exactly your webapp should behave when the enduser opens the same page in multiple browser tabs within the same session and interacts with each of them while switching between them? – BalusC Feb 14 '12 at 00:12
  • I am only doing the templating part and the sesssion , managed bean part is done by different team.. So my task is to remove the common code like the header, menu & footer from all the jsp's.i aware that facelets is the way to do but for some reason that was rejected by our arch group.. so i was thinking of having a layout.jsp and having a static include for the header footer ,menu and a dynamic for the content part. i am not sure if this the right approach.. – JSF Feb 14 '12 at 16:12

0 Answers0