Struts2.0+Spring2.0+Hibernate3.1整合 出现奇怪问题不能国际化

解决方案 »

  1.   

    我完全按照Struts2.0+Spring2.0+Hibernate3.1整合.pdf配置的!三位一体整合运行没有问题,可是就是写的国际化页面返回的是标签不是国际化后的内容!原来单独使用Struts2.0+Hibernate3.1的时候完全没有问题!
      

  2.   

    我按照Struts2.0的配置方法配置了很多次总是不行!
      

  3.   

    MyEclipse6.0 中整合SSH――Struts2.0+Spring2.0+Hibernate3.1
    第一节 配置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,将其添加后配置正常,布署工程,启动服务,进行测试。
    到此为止,配置完成。
      

  4.   

    高手指点!我是在不知道那里错了!
    Struts.xml
    加入了引用国际化文件!但是就是不行!
      

  5.   

    http://topic.csdn.net/u/20080520/16/b00dc418-33f8-4639-913a-303d654e95a5.html也是我问的!回答正确两题分数同时给!
      

  6.   

    看样子是缺少了【jar】类库文件