项目是手动建立在tomcatwebapps下的。
目录结构:
Strutss
---login.jsp
---web-inf
---classes
---java
---LoginAction.class
struts.xml
---lib
---src
---java
---LoginAction.java
struts.xml
---web.xml
web.xml代码:
<?xml version="1.0" encoding="GBK"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
struts.xml代码:
<?xml version="1.0" encoding="GBK"?>
<!-- 指定Struts 2 配置文件的DTD 信息 -->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<!-- struts 是Struts 2 配置文件的根元素 -->
<struts>
<!-- Struts 2的Action必须放在指定的包空间下定义-->
<package name="default" extends="struts-default">
<!--定义login的Action,该Action的实现类为lee.Action 类 -->
<action name="Login" class="java.LoginAction" >
<!-- 定义处理结果和资源之间的映射关系 -->
<result name="error">/error.jsp</result>
<result name="success">/welcome.jsp</result>
</action>
</package>
</struts>
login.jsp部分代码:
<form action="Login.action" method="post">
点了登录按钮后一直出现The requested resource (There is no Action mapped for namespace / and action name Login.) is not available.这个错。
求大神指教怎么配置。小弟才学啊
目录结构:
Strutss
---login.jsp
---web-inf
---classes
---java
---LoginAction.class
struts.xml
---lib
---src
---java
---LoginAction.java
struts.xml
---web.xml
web.xml代码:
<?xml version="1.0" encoding="GBK"?>
<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter> <filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
struts.xml代码:
<?xml version="1.0" encoding="GBK"?>
<!-- 指定Struts 2 配置文件的DTD 信息 -->
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<!-- struts 是Struts 2 配置文件的根元素 -->
<struts>
<!-- Struts 2的Action必须放在指定的包空间下定义-->
<package name="default" extends="struts-default">
<!--定义login的Action,该Action的实现类为lee.Action 类 -->
<action name="Login" class="java.LoginAction" >
<!-- 定义处理结果和资源之间的映射关系 -->
<result name="error">/error.jsp</result>
<result name="success">/welcome.jsp</result>
</action>
</package>
</struts>
login.jsp部分代码:
<form action="Login.action" method="post">
点了登录按钮后一直出现The requested resource (There is no Action mapped for namespace / and action name Login.) is not available.这个错。
求大神指教怎么配置。小弟才学啊
解决方案 »
- 部署网上一个开源系统的代码,部署后报错如下
- 使用httpclient 验证码问题
- 高分求助isag接入,获取用户点播业务的linkid。最好贴上java源码,另有重谢。
- spring中如何根据时间调用dao中的方法
- commons-logging与Log4j的问题
- Struts中如何只返给Jsp页面一条消息(out.print)
- 关于oracle中blob字段的读取
- 诚聘:开发工程师
- 有关开源项目的问题
- HTTP Status 500 - For input string: "3.125" 求帮助,摆脱!
- 在Java中如何输入任何一个年份的,打印出全年的星期日
- 严重: Servlet.service() for servlet jsp threw exception页面访问出错!!!求解决方法!
如果还有问题 检查url吧
·
不然 需要 手动再改路径
在Login.action前加上你的命名空间,默认的话为/