当前位置: 代码迷 >> J2EE >> 实在是找不出来有关问题,
  详细解决方案

实在是找不出来有关问题,

热度:65   发布时间:2016-04-22 02:14:04.0
实在是找不出来问题,求助!!!
简单的struts,报错
type Status report

message Servlet action is not available

description The requested resource (Servlet action is not available) is not available.

都看了,是在是看不出哪有问题,请哪位高手解答?
login的form动作:<form action="<%=request.getContextPath()%>/login.do">
web.xml中配置:
XML code
<?xml version="1.0" encoding="UTF-8"?><web-app version="2.5">    <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-start>0</load-on-start>    </servlet>    <servlet-mapping>        <servlet-name>action</servlet-name>        <url-pattern>*.do</url-pattern>    </servlet-mapping></web-app>


struts-config中配置
XML code
<?xml version="1.0" encoding="UTF-8"?><struts-config>    <form-beans >        <form-bean name="loginForm"  type="cn.itcast.LoginForm"></form-bean>        <form-bean name="addStudentForm"  type="cn.itcast.AddStudentForm"></form-bean>    </form-beans>    <action-mappings>    <action path="/login"  type="cn.itcast.LoginAction"  name="loginForm">    <!--    name指定中心控制器带的东西,可以没有Form不会报错,但之后就不能使用path-->        <forward name="loginSuccess"  path="/loginSuccess.jsp"></forward>        <forward name="loginFailure"  path="/loginFailure.jsp"></forward>    </action>            </action-mappings></struts-config>

LoginAction内容:
public class LoginAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
……………………
}

请问怎么错了

------解决方案--------------------
<form action="${pageContext.request.contextPath}/login.do">

------解决方案--------------------
从你的的信息提示看来是struts-config中配置中的type="cn.itcast.LoginAction"有问题;
 

------解决方案--------------------
可能你的web服务器JRE不认识这个类字节码,确认下编译器与JRE是否一致,在部署运行试下;
------解决方案--------------------
直接login.do就能跳到action里了!
  相关解决方案