•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Web Developers' Lounge section within the Web Development category of DaniWeb, a massive community of 456,520 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,816 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Web Developers' Lounge advertiser: Search Engine Optimization
Views: 1828 | Replies: 0
![]() |
| |
•
•
Join Date: May 2006
Posts: 58
Reputation:
Rep Power: 3
Solved Threads: 0
I am learning struts from various e-books.I am facing this problem.
i will show code to you all.
My struts-config.xml
My Java class.. called Dao.java
My index.jsp
what i want is when i click on "Test the Action" it should forward me to Failure.jsp
and here is my web.xml
I am using tomcat to run my application..
Waiting for help!
HTTP Status 500 - No action instance for path /Test could be created type Status report message No action instance for path /Test could be created description The server encountered an internal error (No action instance for path /Test could be created) that prevented it from fulfilling this request. Apache Tomcat/5.0.28
i will show code to you all.
My struts-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean
name="loginForm1"
type="org.apache.struts.action.DynaActionForm">
<form-property
name="username"
type="java.lang.String"/>
<form-property
name="password"
type="java.lang.String"/>
</form-bean>
</form-beans>
<action-mappings>
<action path="/Success" forward="/WEB-INF/jsp/success.jsp"/>
<action path="/index" forward="/WEB-INF/jsp/Index.jsp"/>
<action
path="/Test"
type="classes.com.Dao">
<forward name="testAction" path="/WEB-INF/jsp/Failure.jsp"/>
</action>
<action path=""
type=""
name=""
parameter="methode"
scope="request"
validate="true"
input="">
<forward name="success" path="" />
<forward name="failure" path="" />
</action>
</action-mappings>
</struts-config>My Java class.. called Dao.java
package com;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class Dao extends Action
{
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
return mapping.findForward("testAction");
}
}
My index.jsp
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-nested" prefix="nested" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
<head>
<html:base />
<title>Index.jsp</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
</head>
<body>
<html:link page="/Success.do">First Request to the controller</html:link>
<html:link page="/Test.do">Test the Action</html:link>
</body>
</html:html>what i want is when i click on "Test the Action" it should forward me to Failure.jsp
and here is my web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "D:\MarketLive\MarketLive\Libraries/resin-pro-3.0.14/webapps/web-app_2_3.dtd">
<web-app>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-tiles.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-tiles.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-template.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-template.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-nested.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-nested.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tlds/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
</taglib>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
</web-app>
I am using tomcat to run my application..
Waiting for help!
![]() |
•
•
•
•
•
•
•
•
DaniWeb Web Developers' Lounge Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
adult advertising blog browser browsers browsing community data design development devices domains firefox google html india internet java legal linux marketing math merger microsoft mobile applications mozilla msn multimedia news php privacy report research search security sex social networking software technology users video w3c web web development wiki wikipedia xml yahoo youtube
- struts tutorials (Java)
- About <error-page> tag in struts (JSP)
- Struts / Database connection (Java)
- deprecation in ActionError in struts (Java)
- Struts stuffs (IT Careers and Business)
- required technical guidence for Struts and XML (Java)
Other Threads in the Web Developers' Lounge Forum
- Previous Thread: Locator
- Next Thread: Need help with form/403 error


Hybrid Mode