Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how will arrange in the action mapping in the strut-config.xml?

 
karthik ekantha
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is strut-config.xml file
1)doubt for the <action-mappings> inside the
11) first page is page login.jsp
after login success go to success.jsp page but success page contain registration name ,mobile no again save the details.
12) second page is success.jsp
this page follow <action mapping >


how will arrange in the action mapping in the strut-config.xml???



<?xml version="1.0" encoding="UTF-8"?>

<!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 Bean Definitions ================================== -->
<form-beans>

<form-bean name="loginForm" type="com.raistudies.forms.LoginForm"/>
<form-bean name="RegistrationForm" type="com.raistudies.forms.RegistrationForm"/>

</form-beans>

<!-- ========== Action Mapping Definitions ============================= -->
<action-mappings>
<action name="loginForm" path="/Login" type="com.raistudies.actions.LoginAction" scope="request" input="/Login.jsp">
<forward name="failure" path="/Failure.jsp" redirect="true"/>
<forward name="success" path="/Success.jsp" redirect="true"/>
</action>

<action name="RegistrationForm" path="/Save" type="com.raistudies.actions.RegistrationAction" scope="request" input="/Success.jsp">
<forward name="Save" path="/Save.jsp" redirect="true"/>
</action>

</action-mappings>

<message-resources parameter="com/raistudies/ApplicationResource"/>
<!-- ========================= Validator plugin ================================= -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>



dont know how actionmapping in the structconfig.xml


after i got some error in my application

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: java.lang.ClassCastException: com.raistudies.actions.RegistrationAction 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.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.ClassCastException: com.raistudies.actions.RegistrationAction cannot be cast to org.apache.struts.action.Action
org.apache.struts.chain.commands.servlet.CreateAction.createAction(CreateAction.java:98)
org.apache.struts.chain.commands.servlet.CreateAction.getAction(CreateAction.java:68)
org.apache.struts.chain.commands.AbstractCreateAction.execute(AbstractCreateAction.java:91)
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
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:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.


--------------------------------------------------------------------------------

Apache Tomcat/6.0.18
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic