<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.or[code=Java]g/dtds/struts-2.0.dtd">
<struts>
<!-- <constant name="struts.objectFactory" value="spring"/>-->
<include file="struts-default.xml"/>
<constant name="struts.custom.i18n.resources" value="globalMsges"></constant>
<package name="person" extends="struts-default">
<action name="login" class="loginAction">
<result>/index.jsp</result>
<result name="input">/pages/login.jsp</result>
</action>
</package>
</struts>
[/code]
这里是struts.xml的配置,我排错就到这里出了问题,在login中的 class 在spring配置文件中(如下)<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"><bean id="loginService" class="com.test.service.impl.LoginServiceImpl"></bean>
<bean id="loginAction" class="com.person.action.LoginAction" scope="prototype">
<property name="loginService">
<ref local="loginService"/>
</property>
</bean>
</beans>
就会报错: 严重: Error filterStart
2009-4-30 13:57:31 org.apache.catalina.core.StandardContext start
严重: Context [/person] startup failed due to previous errors
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
2009-4-30 13:57:31 org.apache.coyote.http11.Http11BaseProtocol start
解决方案 »
- ymprompt问题
- jdk 安装报了这样的错误?
- 200分,请大家解释一个关于hibernate的问题
- 都来帮我看看排序的小问题
- struts2获取jasperreportsd的显示数据
- 谁有j2ee的src源码包,给一份我。
- 谁能解释一下eclipse-rcp是什么技术?
- TreeSet ,HashSet 和LinkHashSet的性能比
- 急!有关课题研究问题!我选什么更好!
- 在EJB中只能指定一个数据源,那请问SessionBean如何操作多个数据库中的信息呢?
- 如何做jsp+javabean+servlet+oracle的查询
- Myeclipse+tomcat开发JSP网站时遇到的问题,在线等待
在web.xml设置一下使用Spring的过滤器给所有的地址进行转码就可以了:
<filter>
<filter-name>Spring character encoding filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>GBK</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Spring character encoding filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
上面那个为什么注释呢
应该是你的jdk的版本太低
你的jdk版本是多少,升级一下版本就可以了
问题应该能解决
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
2.指定对象工厂
struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory3.配置struts.xml和application.xml