Post a Job  |   Ask a Question?   |   Already registered? login or register
Basanta Hota
06/02/2016 03:19 PM

Struts common Exception


Hi,guyzs i m trying to develope my First struts application but i get one Exception ,but i m not able to fix it.. can any one give solution how to overcome this exception java x.servlet.ServletException: org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url. org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
Spam    3 Comments

Basanta,Hota
06/02/2016 15:21:21
jsp: === <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Insert title here</title> </head> <body bgcolor="lightgreen"> <center> <h1> <font class="red">My Struts First Example</font> </h1> </center> <form action="msg.do" method="post"> <table align="center" width="40%"> <tr> <td align="center">message:-</td> <td><input type="text" name="message"></td> </tr> </table> <center> <input type="submit" value="click"> </center> </form> </body> </html> struts-config.xml ============ <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN" "http://struts.apache.org/dtds/struts-config_1_3.dtd"> <struts-config> <form-beans> <form-bean name="RenderMessageForm" type="com.struts.form.RenderMessageForm" /> <!-- <form-property name="message" type="java.lang.String"/> --> </form-beans> <global-forwards> <!-- <forward name="welcome" path="/message.do" /> --> </global-forwards> <action-mappings> <action path="/msg.do" type="com.struts.action.PrintMessageAction" name="RenderMessageForm"> <forward name="success" path="/welcome.jsp" /> </action> </action-mappings> </struts-config> web.xml: ========= <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>Welcome Display Message Example</display-name> <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> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>welcome.jsp</welcome-file> </welcome-file-list> </web-app>

polamarasetti,satyanarayana
07/02/2016 15:46:17
Hi Basanta, This exception ouccures due to ur configuration file that is struts-config.xml,in action-mapping tag action path name will be path="/msg" only (/msg.do) not required try this one ur exception will be overcome.path will be user url taken. thankyou.

Basanta,Hota
09/02/2016 03:14:10
Thanks bro. ....

Languages :
xml