En l'instant précis du 21/03/07 16:01, Olivier Ziller GMail Lists s'exprimait en ces termes: > Hello, > > David Delbecq wrote: >> Hi, you have 2 possibilities >> >> 1) You move this code to a facelet tag handler and make foo a JSF >> managed bean >> >> 2) you create 2 custom facelets tags that support JSP inclusion (this is >> a pretty usefull thing to do when migrating code, we did it here) >> (why 2 tags, because you have case when you want jsp included during >> facelets restor view, and case when you want this to occur during >> component rendering, depending on jsp code) >> > could you please give a small example on how to do that? For (1), there are docs and example on the net about creating your own facelets tag handler ( http://www.jsfcentral.com/articles/facelets_2-2.html http://wiki.apache.org/myfaces/Use_Facelets_with_Tomahawk )
For (2), it's just a matter of, in your taghandler or custom component renderer, getting the servlet controller, locate the appropriate servlet and make a forward() to it servlet (yes, a JSP is a servlet). It will then naturally execute and give back, immediatly after execution, control to your component or taghanlder. This way, execution of facelets don't stop. PS: another thing you might want to consider, it's possible to have both facelets and JSP based JSF at the same time (see this http://wiki.java.net/bin/view/Projects/FaceletsFAQ#How_do_I_use_Facelets_and_JSP_in ) > > thanks in advance >> En l'instant précis du 21/03/07 13:29, [EMAIL PROTECTED] s'exprimait >> en ces termes: >> >>> I have been considering moving to Facelets. I have studied it and like >>> what I see. One problem I see is how to port my JSP code into Facelets. >>> By this I mean, in some of my pages, I have JSP code >>> >>> <jsp:useBean id="foo" class="com.myapp.bean.fooClass" scope="session" /> >>> <% >>> if (!foo.isLoaded()) >>> { >>> response.sendRedirect("login.jsf"); >>> } >>> %> >>> >>> >>> Does anyone know how you might port this? I am open to design changes >>> as well. >>> >>> Thanks! >>> >>> >> >> >>

