Hi there; I wonder if someone could tell me why the following happens:
I have a JSP form that looks something like this:
............................................
<jsp:include page="menu.jsp" flush="true">
<jsp:param name="currentPage" value="sendmail"/>
</jsp:include>
</td>
<td colspan=2 class="bodybold">
<br/>
Want to get in touch? Just fill in the form below, and
press 'send'
<br/>
<html:form action="sendmail">
<table width="100%" border="0" class="body">
<tr><td> </td></tr>
<tr>
..............................................
The included page simply inserts a menu onto the page:
..............................................
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<a href="index.jsp"><img src="graphics/Home.gif" width=138 height=20
border="0"></a>
<img src="graphics/MenuSpacerLarge.gif" width=138 height=15> <a
href="services.jsp"><img src="graphics/Services.gif" width=138 height=16
border="0"></a>
<img src="graphics/MenuSpacerSmall.gif" width=138 height=16> <a
href="action/propertylist"><img src="graphics/Properties.gif" width=138
height=20 border="0"></a>
<img src="graphics/MenuSpacerSmall.gif" width=138 height=16> <a
href="action/tenantlist"><img src="graphics/Tenants.gif" width=138
height=17 border="0"></a>
<%
if (request.getParameter("currentPage") == null)
{
%>
<img src="graphics/MenuSpacerLarge.gif" width=138 height=16> <a
href="action/sendmail"><img src="graphics/ContactUs.gif" width=138
height=20 border="0"></a>
<%
}
%>
..............................................
Now when I try to call the page; I get the following error:
..............................................
Location: /letsco/editmail.jsp
Internal Servlet Error:
javax.servlet.ServletException
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:460)
at editmail_17._jspService(editmail_17.java:743)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at
org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at
org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:536)
Root cause:
javax.servlet.jsp.JspException
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:600)
at editmail_17._jspService(editmail_17.java:211)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at
org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at
org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:485)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
at
org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:536)
.....................................................
Now going back to the original page; if I move the <html:form> tag above
the <jsp:include> tag like this:
............................................
<html:form action="sendmail">
<jsp:include page="menu.jsp" flush="true">
<jsp:param name="currentPage" value="sendmail"/>
</jsp:include>
</td>
<td colspan=2 class="bodybold">
<br/>
Want to get in touch? Just fill in the form below, and
press 'send'
<br/>
<table width="100%" border="0" class="body">
<tr><td> </td></tr>
<tr>
..............................................
Then everything works fine.
I'm just very curious as to why the tag position makes a different; I have
this idea that it has something to do with the flush attribute, but I'm not
quite sure why (programmer's intuition).
My other question concerns the condition in the included page:
.........................................
<%
if (request.getParameter("currentPage") == null)
{
%>
<img src="graphics/MenuSpacerLarge.gif" width=138 height=16> <a
href="action/sendmail"><img src="graphics/ContactUs.gif" width=138
height=20 border="0"></a>
<%
}
%>
..........................................
Is there a way to do this without having Java code on the page (i.e. using
Stuts logic tag for example)