I usually code my index.jsp as follows:
<jsp:forward page="Welcome.do" />

If your index.jsp isn't being processed through the struts controller, I'm
not sure how much the logic tags like that.

That should eliminate at least one problem.

<<An Obstacle is something you see when you take your eyes off the goal>>

-----Original Message-----
From: Dean A. Hoover [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 01, 2004 11:59 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-----------------------------------------
This message and its contents (to include attachments) are the property of Kmart 
Corporation (Kmart) and may contain confidential and proprietary information. You are 
hereby notified that any disclosure, copying, or distribution of this message, or the 
taking of any action based on information contained herein is strictly prohibited. 
Unauthorized use of information contained herein may subject you to civil and criminal 
prosecution and penalties. If you are not the intended recipient, you should delete 
this message immediately.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to