Struts2.0+Spring2.0+Hibernate3.1整合 出现奇怪问题不能国际化 Struts2.0+Spring2.0+Hibernate3.1整合 出现奇怪问题不能国际化 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我完全按照Struts2.0+Spring2.0+Hibernate3.1整合.pdf配置的!三位一体整合运行没有问题,可是就是写的国际化页面返回的是标签不是国际化后的内容!原来单独使用Struts2.0+Hibernate3.1的时候完全没有问题! 我按照Struts2.0的配置方法配置了很多次总是不行! MyEclipse6.0 中整合SSH――Struts2.0+Spring2.0+Hibernate3.1第一节 配置Struts2.01. 新建一web 工程。2. 加入struts2.0 jar 包:Commons-pool.jarFreeer-2.3.8.jarOgnl-2.6.11.jarStruts2-core-2.0.9.jarXwork-2.0.4.jar3.src 下新建两文件:struts.xml 和struts.propertiesStruts.xml 配置如下:<?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><include file="struts-default.xml" /><package name="song" extends="struts-default"><action name="hello" class="hello"><result>/success.jsp</result></action></package></struts>Struts.properties 配置如下:Struts.objectFactory=spring //等加入spring 后再写入4.修改web.xml 文件:<filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter><filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping>5.到此为止,struts2.0 的配置完成。写一个类,让她继承ActionSupport,写一个jsp页面,让她跳转到该类中去执行excute();方法,测试是否成功!Generated by Foxit PDF Creator © Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.第二节 spring2.0 配置1. 先添加struts.properties 中的语句2. 导入spring2.0 jar 包:前三个和最后一个,将jar 包一起copy 到/WEB-INF/lib 下3. 直接Next,finish4. 进行struts 和spring 的结合测试1) 在spring 配置文件中声明我们的actionBean:<bean id=”hello” class=”com.song.Login”/>2) 进行struts 和spring 的关联配置<struts><include file="struts-default.xml" /><package name="song" extends="struts-default"><action name="hello" class="hello"><result>/success.jsp</result></action></package></struts>3)修改web.xml<context-param><param-name>contextConfigLocation</param-name><param-value>/WEB-INF/classes/applicationContext.xml</param-value></context-param><filter><filter-name>struts2</filter-name><filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class></filter><filter><filter-name>struts-cleanup</filter-name><filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class></filter>Generated by Foxit PDF Creator © Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.5. 执行上面的action 类进行测试6. 删除多余的jar 包,留下如jar 包:第三节 加入Hibernate 功能1. 右击工程,导入hibernate jar 包:<filter-mapping><filter-name>struts2</filter-name><url-pattern>/*</url-pattern></filter-mapping><filter-mapping><filter-name>struts-cleanup</filter-name><url-pattern>/*</url-pattern></filter-mapping><listener><listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>Generated by Foxit PDF Creator © Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.2. 选择hibernate3.13.将hibernate 配置文件交给spring 去管理4. 选择现有的spring 配置文件Generated by Foxit PDF Creator © Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.5.Next,6.配置数据源Generated by Foxit PDF Creator © Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.7.不创建SessonFactory,然后finishGenerated by Foxit PDF Creator © Foxit Softwarehttp://www.foxitsoftware.com For evaluation only.8.反向生成表的映射文件和dao(注意:这个dao 也可以手动来写)9.next,选择主键生成方式:10.Next,finish11.发现spring 的applicationContext.xml 配置文件中有红色标记,然后添加一jar 包:commons-dbcp.jar,将其添加后配置正常,布署工程,启动服务,进行测试。到此为止,配置完成。 高手指点!我是在不知道那里错了!Struts.xml加入了引用国际化文件!但是就是不行! http://topic.csdn.net/u/20080520/16/b00dc418-33f8-4639-913a-303d654e95a5.html也是我问的!回答正确两题分数同时给! 看样子是缺少了【jar】类库文件 jsp表单分层 spring2.5+hibernat3.2反向oracle11G表 发发牢骚!缓解郁闷! 问大家什么弄一个全局的变量 急,,,,TOMCAT能不能显示FRAMESET??? JSP 一个很菜的问题! 有关javamail的问题 明明server上的cgi-bin/目录下有这个jsp文件,可是在客户端的IE中就是看不到,什么原因? Java 多线程执行顺序问题 ThreadPoolExecutor 请教各位大虾 既然CSDN不理那么我天天顶,请新来的朋友注意
第一节 配置Struts2.0
1. 新建一web 工程。
2. 加入struts2.0 jar 包:
Commons-pool.jar
Freeer-2.3.8.jar
Ognl-2.6.11.jar
Struts2-core-2.0.9.jar
Xwork-2.0.4.jar
3.src 下新建两文件:struts.xml 和struts.properties
Struts.xml 配置如下:
<?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>
<include file="struts-default.xml" />
<package name="song" extends="struts-default">
<action name="hello" class="hello">
<result>/success.jsp</result>
</action>
</package>
</struts>
Struts.properties 配置如下:
Struts.objectFactory=spring //等加入spring 后再写入
4.修改web.xml 文件:
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
5.到此为止,struts2.0 的配置完成。写一个类,让她继承ActionSupport,写一个jsp
页面,让她跳转到该类中去执行excute();方法,测试是否成功!
Generated by Foxit PDF Creator © Foxit Software
http://www.foxitsoftware.com For evaluation only.
第二节 spring2.0 配置
1. 先添加struts.properties 中的语句
2. 导入spring2.0 jar 包:
前三个和最后一个,将jar 包一起copy 到/WEB-INF/lib 下
3. 直接Next,finish
4. 进行struts 和spring 的结合测试
1) 在spring 配置文件中声明我们的actionBean:
<bean id=”hello” class=”com.song.Login”/>
2) 进行struts 和spring 的关联配置
<struts>
<include file="struts-default.xml" />
<package name="song" extends="struts-default">
<action name="hello" class="hello">
<result>/success.jsp</result>
</action>
</package>
</struts>
3)修改web.xml
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.FilterDispatcher
</filter-class>
</filter>
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ActionContextCleanUp
</filter-class>
</filter>
Generated by Foxit PDF Creator © Foxit Software
http://www.foxitsoftware.com For evaluation only.
5. 执行上面的action 类进行测试
6. 删除多余的jar 包,留下如jar 包:
第三节 加入Hibernate 功能
1. 右击工程,导入hibernate jar 包:
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
Generated by Foxit PDF Creator © Foxit Software
http://www.foxitsoftware.com For evaluation only.
2. 选择hibernate3.1
3.将hibernate 配置文件交给spring 去管理
4. 选择现有的spring 配置文件
Generated by Foxit PDF Creator © Foxit Software
http://www.foxitsoftware.com For evaluation only.
5.Next,
6.配置数据源
Generated by Foxit PDF Creator © Foxit Software
http://www.foxitsoftware.com For evaluation only.
7.不创建SessonFactory,然后finish
Generated by Foxit PDF Creator © Foxit Software
http://www.foxitsoftware.com For evaluation only.
8.反向生成表的映射文件和dao(注意:这个dao 也可以手动来写)
9.next,选择主键生成方式:
10.Next,finish
11.发现spring 的applicationContext.xml 配置文件中有红色标记,然后添加一
jar 包:commons-dbcp.jar,将其添加后配置正常,布署工程,启动服务,进行测试。
到此为止,配置完成。
Struts.xml
加入了引用国际化文件!但是就是不行!