struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dean A. Hoover" <dhoo...@rochester.rr.com>
Subject getting started
Date Mon, 01 Mar 2004 15:09:34 GMT
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(PageContextImpl.java:867)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.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:311)
	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:311)
	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


Mime
View raw message