struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Niall Pemberton" <niall.pember...@blueyonder.co.uk>
Subject Re: hiding jsp files under WEB-INF
Date Mon, 01 Mar 2004 17:50:54 GMT
Alternatively....

Change the <logic:forward> on your index.jsp page to an ordinary link and
see if that works.

<html:link action="/Welcome.do">Click Here</html:link>

Niall

----- Original Message ----- 
From: "Niall Pemberton" <niall.pemberton@blueyonder.co.uk>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
Sent: Monday, March 01, 2004 5:40 PM
Subject: Re: hiding jsp files under WEB-INF


> If you look in 'logic tags' package:
>
>
>
http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/taglib/logic/
>
> In LocalStrings.properties you will see that the message you are getting
> ("Exception forwarding for name ?????") matches the message named
> 'forward.forward'.
>
> If you then look in ForwardTag.java this message is only thrown when it
> tries to do:
>
>     pageContext.forward(path);
>
> This means that it has found your forward named "welcome" and the problem
> lies when it tries to forward to the path associated with that forward
(i.e.
> /Welcome.do).
>
> Quite why that throwing a ServletException I haven't got a clue. Maybe you
> could try setting up another forward for one of your other actions and see
> if that works - how about a "logoff" forward for the /Logoff.do action -
> that forwards to Welcome.jsp? Or can you just specify /WEB-INF/Welcome.jsp
> in your "welcome" forward?
>
> Niall
>
> ----- Original Message ----- 
> From: "Dean A. Hoover" <dhoover@rochester.rr.com>
> To: <struts-user@jakarta.apache.org>
> Sent: Monday, March 01, 2004 4:58 PM
> Subject: hiding jsp files under WEB-INF
>
>
> > I realized that the subject I filed this
> > under (getting started) may not get
> > attention. So I'm sending it out under
> > this subject. Did some google searching
> > but still don't see what the problem is.
> >
> > =====
> > I am experimenting with some code
> > from "Struts in Action" but I am moving
> > source code around abit. Specifically,
> > I am moving all of the .jsp files into
> > the WEB-INF directory except
> > index.jsp. This is so that a user cannot
> > hit a given .jsp directly. Anyway, I
> > am getting an exception right from the
> > get go and don't know what I am doing
> > wrong. Here's the relevant pieces:
> >
> > == index.jsp ===
> > <%@ taglib uri="/tags/struts-logic" prefix="logic" %>
> > <logic:forward name="welcome"/>
> >
> > == Welcome.jsp ===
> > <?xml version="1.0" encoding="UTF-8"?>
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> > "DTD/xhtml1-trans
> > itional.dtd">
> > <% taglib uri="/tags/struts-bean" prefix="bean" %>
> > <% taglib uri="/tags/struts-html" prefix="html" %>
> > <% taglib uri="/tags/struts-logic" prefix="logic" %>
> > <html:html xhtml="true">
> >  <head>
> >    <title>Welcome World!</title>
> >    <html:base/>
> >  </head>
> >  <body>
> >    <logic:present scope="session" name="user">
> >      <h3>Welcome <bean:write name="user" property="username"/>!</h3>
> >    </logic:present>
> >    <logic:notPresent scope="session" name="user">
> >      <h3>Welcome World!</h3>
> >    </logic:notPresent>
> >    <html:errors/>
> >    <ul>
> >      <li><html:link forward="logon">Sign in</html:link></li>
> >      <logic:present scope="session" name="user">
> >        <li><html:link forward="logoff">Sign out</html:link></li>
> >      </logic:present>
> >    </ul>
> >  </body>
> > </html:html>
> >
> > === struts-config.xml ===
> > <?xml version="1.0" encoding="ISO-8859-1" ?>
> > <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD
> > Struts Configuration 1.0//EN"
> > "http:/jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
> > <struts-config>
> >  <form-beans>
> >    <form-bean name="registerForm" type="app.RegisterForm"/>
> >    <form-bean name="logonForm" type="app.LogonForm"/>
> >  </form-beans>
> >    <global-forwards>
> >      <forward name="welcome" path="/Welcome.do"/>
> >    </global-forwards>
> >
> >  <action-mappings>
> >    <action
> >            path="/Welcome"
> >            type="org.apache.struts.actions.ForwardAction"
> >            parameter="/WEB-INF/Welcome.jsp"/>
> >
> >    <action path="/Logon"
> >            type="org.apache.struts.actions.ForwardAction"
> >            parameter="/WEB-INF/Logon.jsp"/>
> >
> >    <action path="/LogonSubmit"
> >            type="app.LogonAction"
> >            name="logonForm"
> >            scope="request"
> >            validate="true"
> >            input="/WEB-INF/Logon.jsp"/>
> >
> >    <action path="/Logoff"
> >            type="app.LogoffAction">
> >      <forward name="success" path="/WEB-INF/Welcome.jsp"/>
> >    </action>
> >
> >    <action path="/Register"
> >            type="app.RegisterAction"
> >            name="registerForm"
> >            input="/WEB-INF/Register.jsp"
> >    >
> >      <forward name="success" path="/WEB-INF/success.jsp"/>
> >      <forward name="failure" path="/WEB-INF/failure.jsp"/>
> >    </action>
> >
> >  </action-mappings>
> > </struts-config>
> >
> >
> > Here's the exception:
> >
> > *exception*
> >
> > javax.servlet.ServletException: Exception forwarding for name welcome:
> > javax.servlet.ServletException
> >
>
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI
> mpl.java:867)
> >
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:800)
> >     org.apache.jsp.index_jsp._jspService(index_jsp.java:66)
> >     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> >
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
> 11)
> >
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
> >     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> >
> > *root cause*
> >
> > javax.servlet.jsp.JspException: Exception forwarding for name welcome:
> > javax.servlet.ServletException
> >
> org.apache.struts.taglib.logic.ForwardTag.doEndTag(ForwardTag.java:173)
> >
org.apache.jsp.index_jsp._jspx_meth_logic_forward_0(index_jsp.java:82)
> >     org.apache.jsp.index_jsp._jspService(index_jsp.java:58)
> >     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> >
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
> 11)
> >
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
> >     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
> >     javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> >
> >
> > What am I doing wrong?
> > Dean Hoover
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message