Tomcat 5, EL Expressions in jsp:inlcude

M

Mark F

Tomcat 5

I would like to create my JSPs as all XML like so:

<?xml version="1.0" ?>
<jsp:root version="2.0"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<f:view>
<f:verbatim><![CDATA[<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>
</f:verbatim>
<html xmlns="http://www.w3.org/1999/xhtml">
<jsp:include flush="false" page="../inc/head.jspf">
<jsp:param name="title" value="Logout"/>
</jsp:include>
<body>
<f:loadBundle basename="general" var="msg"/>
<f:loadBundle basename="logout" var="logoutmsg"/>
<jsp:include flush="true" page="../inc/topnav.jspf"/>
<jsp:include flush="true" page="../inc/header.jspf"/>
<h:form>
<h:panelGrid>
<h:eek:utputText value="#{logoutmsg.loggedout}"/>
<h:eek:utputText value="#{logoutmsg.closebrowser}"/>
</h:panelGrid>
</h:form>
<jsp:include flush="true" page="../inc/footer.jspf"/>
</body>
</html>
</f:view>
</jsp:root>

Unfortunately the EL code in the included JSPs is not being evaluated.

It works fine if I use the <%@include%> directive but this is not XML
compatible.

Any help would be appreciated.

thanks,
-Mark
 
J

John C. Bollinger

Mark said:
Tomcat 5

I would like to create my JSPs as all XML like so:

<?xml version="1.0" ?>
<jsp:root version="2.0"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<f:view>
<f:verbatim><![CDATA[<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>
</f:verbatim>
<html xmlns="http://www.w3.org/1999/xhtml">
<jsp:include flush="false" page="../inc/head.jspf">
<jsp:param name="title" value="Logout"/>
</jsp:include>
<body>
<f:loadBundle basename="general" var="msg"/>
<f:loadBundle basename="logout" var="logoutmsg"/>
<jsp:include flush="true" page="../inc/topnav.jspf"/>
<jsp:include flush="true" page="../inc/header.jspf"/>
<h:form>
<h:panelGrid>
<h:eek:utputText value="#{logoutmsg.loggedout}"/>
<h:eek:utputText value="#{logoutmsg.closebrowser}"/>
</h:panelGrid>
</h:form>
<jsp:include flush="true" page="../inc/footer.jspf"/>
</body>
</html>
</f:view>
</jsp:root>

Unfortunately the EL code in the included JSPs is not being evaluated.

It works fine if I use the <%@include%> directive but this is not XML
compatible.

Any help would be appreciated.

I don't see any reason why EL code would not be executed in the
jsp:included JSPs, but you should recognize that those JSPs will run
within their own page contexts. That affects the scripting elements
available to them and the disposition of scripting elements that they
may create. Those issues are not relevant to JSP code included via
<%@include%> -- could they be the source of your problem? If not, then
you will probably get more help if you provide a simple but *complete*
example that exhibits the undesired behavior, along with a detailed
description of the desired alternative.


John Bollinger
(e-mail address removed)
 
T

The Abrasive Sponge

Mark said:
Tomcat 5

I would like to create my JSPs as all XML like so:

<?xml version="1.0" ?>
<jsp:root version="2.0"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<f:view>
<f:verbatim><![CDATA[<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">]]>
</f:verbatim>
<html xmlns="http://www.w3.org/1999/xhtml">
<jsp:include flush="false" page="../inc/head.jspf">
<jsp:param name="title" value="Logout"/>
</jsp:include>
<body>
<f:loadBundle basename="general" var="msg"/>
<f:loadBundle basename="logout" var="logoutmsg"/>
<jsp:include flush="true" page="../inc/topnav.jspf"/>
<jsp:include flush="true" page="../inc/header.jspf"/>
<h:form>
<h:panelGrid>
<h:eek:utputText value="#{logoutmsg.loggedout}"/>
<h:eek:utputText value="#{logoutmsg.closebrowser}"/>
</h:panelGrid>
</h:form>
<jsp:include flush="true" page="../inc/footer.jspf"/>
</body>
</html>
</f:view>
</jsp:root>

Unfortunately the EL code in the included JSPs is not being evaluated.

It works fine if I use the <%@include%> directive but this is not XML
compatible.

Any help would be appreciated.

thanks,
-Mark


It's a JSF issue.

http://java.sun.com/j2ee/javaserverfaces/faq.html#includes


Looks like you will have to do
<f:subview><jsp:include /></f:subview>
Please let me know what you find out!
 
T

The Abrasive Sponge

MF said:
Nope, I'm already using <f:subview> tags. I still get HTML with
unevaluated expressions.

You got me interested in using jspx. I did the following with something
like this. I get some errors with my xhtml right now, but this may be
something to consider.

P.S. I am using jstl, which may be more useful because the import tag
recognized the context path :)


<f:subview id="form_subview"><c:import url="form_1.jspf"/></f:subview>
 
M

Mark F

The said:
You got me interested in using jspx. I did the following with something
like this. I get some errors with my xhtml right now, but this may be
something to consider.

P.S. I am using jstl, which may be more useful because the import tag
recognized the context path :)


<f:subview id="form_subview"><c:import url="form_1.jspf"/></f:subview>

I've concluded that XML only JSPs with JSF isn't really supported right
now. Not in a practical way. I guess I'll be forced to go back to
non-XML JSPs. I guess I can live with that though I really wanted it to
work.

-Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top