简体   繁体   中英

Simple usage of ActionForward Struts 1.3

I'm new to Struts...

I'm trying to implement the most basic ActionForward in Struts 1.3. It's my understanding the ActionForward is the most basic way to implement simple JSP navigation while still delegating the control logic to the Struts Controller. I have an index.jsp that is the default page when I deploy the app. I configured the .jsp with the appropriate struts tag lib and I think I have the struts config file setup correctly but It's not working. Below is my code...

Index.jsp

<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html"%>

<html>
<head>
</head>
<body>
    <html:link page="/welcome.do">Click Me</html:link>
</body>
</html>

Action Mapping in my struts config

<action-mappings>
        <action path="/welcome" parameter="/welcome.jsp" type="org.apache.struts.action.ActionForward" />
</action-mappings>

When I deploy the app and click the link to go to the welcome.jsp I get the below error...

javax.servlet.ServletException: java.lang.ClassCastException: org.apache.struts.action.ActionForward cannot be cast to org.apache.struts.action.Action
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

What in tarnation is going on here? Please let me know if you need any more code to help determine the issue.

您必须使用org.apache.struts.actions.ForwardAction(可扩展Action)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM