dev@glassfish.java.net

Re: JSF2 and JSP questions

From: Kin-man Chung <kinman.chung_at_oracle.com>
Date: Wed, 15 Jun 2011 11:12:53 -0700

In what way is <jsp:include page="..." /> not working for you? This is
a basic JSP functionality and has been working in all the tests I have.
If you have a simple test (without JSF) demonstrating otherwise, please
file an issue at jsp.java.net. Thanks.

On 06/14/11 11:52, emiddio-frontier wrote:
> 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
>
>
>
>
>
>