[thelist] JSP question
Tom Dell'Aringa
pixelmech at yahoo.com
Tue Oct 21 10:28:10 CDT 2003
--- Hassan Schroeder <hassan at webtuitive.com> wrote:
> It doesn't work because you've set 'orderInfo' within a
> PageContext, and `dashboards.jsp` has its own PageContext --
> everything in it is evaluated *before* being including.
Ahh that makes sense.
> However, both pages are part of one *request*, though, so you can
> do:
>
> <%
> String orderInfo = "1";
> request.setAttribute("orderInfo", orderInfo);
> /* you could combine those two statements, of course */
> %>
>
> <jsp:include page="dashboards.jsp"/>
>
> Then in dashboards.jsp:
> <%
> if ( request.getAttribute("orderInfo").equals("1") )
> {
> %>
> conditional content goes here ....
> <%
> }
> %>
For some reason that didn't work, and I am getting a 500/null pointer
exception.
Here is my exact code:
(html opening here)
<jsp:include page="includes/banner.jsp"/>
<%
String orderInfo = "1";
request.setAttribute("orderInfo", orderInfo);
%>
<jsp:include page="includes/dashboards.jsp"/>
(rest of page html here)
(I also tried request.setAttribute("orderInfo", "1"); didn't work)
and in dashboards.jsp:
<%
if (request.getAttribute("orderInfo").equals("1"))
{
%>
<div class='dashboard'><strong>Order:</strong> Sat 10/20/03 8:00 AM |
8:00 AM - 10:00 AM | ServiceMaster Clean | <%=
session.getAttribute("orderNum") %></div>
<% } %>
Have I missed something? Also how do you get weblogic to show the
whole error on the page instead of just 500 -- internal server error?
Tom
=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: Premium Content Author / JavaScript / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life
"That's not art, that's just annoying." -- Squidward
More information about the thelist
mailing list