当前位置: 代码迷 >> Java Web开发 >> struts2找不到action投射
  详细解决方案

struts2找不到action投射

热度:2078   发布时间:2013-02-25 21:15:31.0
struts2找不到action映射
运行时出现这个问题:

HTTP Status 404 - There is no Action mapped for action name userlogin.

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

type Status report

messageThere is no Action mapped for action name userlogin.

descriptionThe requested resource (There is no Action mapped for action name userlogin.) is not available.

struts.xml 放在WIB-INF下了
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
  "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
  <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory"/>
  <package name="strutsspring" namespace="/user" extends="struts-default">
  <action name="userlogin" class="UserLoginAction">
  <result name="success">/showpage/index.jsp</result>
  <result name="input">/showpage/login.jsp</result>
  </action>
  </package>
</struts>

ApplicationContext.xml配置
  <!-- action injection -->
  <bean id="UserLoginAction" class="com.bjoraclewdp.ticket.controller.UserLoginAction" scope="prototype">
  <property name="userService" ref="UserService"></property>
  </bean>

JSP文件
<s:form action="/user/userlogin.action" theme="simple">
  <p>用户名:&nbsp;&nbsp;<input type="text" id="username" name="username" value="${param.username}" style=" background:none;border:none;width:160px;height:27px;border:solid 1px #499EB3; line-height:27px;padding-left:5px;"/></p>
  <span id="usernameInfo">
  <s:fielderror>
  <s:param>usernameInfo</s:param>
  </s:fielderror>
  </span>
  <p>密&nbsp;&nbsp;码:&nbsp;&nbsp;<input id="password" name="password" type="password" style=" background:none;border:none;width:160px;height:27px;border:solid 1px #499EB3; line-height:27px;padding-left:5px;"/></p>
  <span id="passwordInfo">
  <s:fielderror>
  <s:param>passwordInfo</s:param>
  </s:fielderror>
  </span>
  <p><input name="" type="submit" value="登&nbsp;&nbsp;录" onclick="text()" style="background:none;border:none;width:78px;height:30px; background:url(../images/button.jpg) no-repeat;color:#FFFFFF;font-size:14px;margin-left:55px;"/><input name="" type="button" value="取&nbsp;&nbsp;消" style="background:none;border:none;width:78px;height:30px; background:url(../images/button.jpg) no-repeat;color:#FFFFFF;font-size:14px;margin-left:5px;"/></p>
   
  </s:form> 

1:烦大家帮忙看看 是哪里错误 找半天都找不到?
2:部署出现这个问题 应该怎么解决
警告: No configuration found for the specified action: '/user/userlogin.action' in namespace: '/showpage'. Form action defaulting to 'action' attribute's literal value.
  相关解决方案