users@glassfish.java.net

JSF2 and JSP questions

From: emiddio-frontier <emiddio_at_frontier.com>
Date: Tue, 14 Jun 2011 10:48:54 -0700

I want to include content from a servlet into my JSF2 page.

My understanding is I can use JSP with JSF1.x and "include" content from
another servlet into the JSF1.x page being rendered ?

I believe I can do this with JSP1.x two ways:
<jsp:include page="..." /> with the JSP Core tag library
and
<c:import uri="..."/> with the http://java.sun.com/jsp/jstl/core - JSTL
tag library.

I have been unable to discover a way to accomplish this with JSP2 ?
--The above tag libraries seem to be unrecognized when added to the
xmlns=... of my xhtml file with JSF2.
--And the JSTL library that is recognized has fewer tags than the
standard JSTL ?

I have experimented with an EL expression in the JSF2 page calling a
void method that essentially does the following :

HttpServletRequest request = (HttpServletRequest)
FacesContext.getCurrentInstance().getExternalContext().getRequest();
HttpServletResponse response = (HttpServletResponse)
FacesContext.getCurrentInstance().getExternalContext().getResponse();
request.getRequestDispatcher("/servlet1").include(request, response);
request.getRequestDispatcher("/jspInclude3.jsp").include(request, response);

with apparent success -- but this seems perhaps the wrong thing to do?
and wondering what is the "better/correct" way to accomplish my intent?

I have also discovered I can use <ui:include src="http://..."/> to
invoke a servlet -- but without the 'http://' it seems to look for a
file with the name used in the 'src' arg rather than a servlet with said
mapping --- and if the page is a jsp file it seems to not invoke the jsp
servlet --just wants to include the raw text?.


Thanks

gary