关于Struts2的一点小问题
本帖最后由 u013119744 于 2014-02-28 16:18:49 编辑
              
            新手 jsp代码如下

web.xml代码如下
<?xml version="1.0" encoding="GBK"?>
<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_3_0.xsd" id="WebApp_ID" version="3.0">
	<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>
</web-app>
访问页面出现的问题如下 
------解决方案--------------------把action和struts.xml都贴出来
------解决方案--------------------说错了,是web.xml中的
  <!-- struts2核心过滤器配置开始 -->
  <filter>
  	<filter-name>struts</filter-name>
  	<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
  </filter>
  
  <filter-mapping>
  	<filter-name>struts</filter-name>
  	<url-pattern>/*</url-pattern>
  </filter-mapping>
  <!-- struts2核心过滤器配置结束 --> 
------解决方案--------------------你把jsp的第一行的一些空格去掉"text/html"后面不要空格写
检查下你的JSP页面,
//在struts页面上是需要带入.action的,配置文件不要,还有你的名称空间加上
还有就是你的<s:form action="login.action" namescapace="/" >
------解决方案--------------------楼主把lib下的jar截个图贴出来。。。