欢迎使用CSDN-markdown编辑器

                开发平台配置文档

开始日期 2009年7月27号

开发环境:
MyEclipse(版本6.5)
Tomcat(版本5.5.26)
Weblogic(版本10.3)
Struts(版本 2.0.14)
Hibernate(版本3.2.0)
Spring(版本2.0.8)
系统:windows server 2003

Tomcat的配置:
请看Tomcat配置文档.docx

MyEclipse的配置:
请看Myeclipse6.5绿色版制作、配置和优化.doc

Weblogic的配置:
请看Weblogic10.3使用和配置.docx

Struts2的例子:
新建一个web项目,名字为struts2.
1. commons-logging-1.0.4.jar
2. freemarker-2.3.8.jar
3. ognl-2.6.11.jar
4. struts2-core-2.0.14.jar
xwork-2.0.7.jar
第一步,修改web.xml文件, FilterDispatcher是struts2的一个重要的过滤器;

datasource.type=oracle

datasource.driverClassName=oracle.jdbc.driver.OracleDriver

datasource.url=jdbc:oracle:thin:@localhost:1521:orcl

datasource.username=jbhx

datasource.password=jbhx

hibernate.dialect=org.hibernate.dialect.Oracle9Dialect

datasource.type=sqlserver
datasource.driverClassName=com.microsoft.jdbc.sqlserver.SQLServerDriver
datasource.url=jdbc:microsoft:sqlserver://127.0.0.1:1433;databaseName=jbhx;SelectMethod=cursor
datasource.username=sa
datasource.password=sa
hibernate.dialect=org.hibernate.dialect.SQLServerDialect

c3p0.acquireIncrement=3
c3p0.initialPoolSize=3
c3p0.idleConnectionTestPeriod=900
c3p0.minPoolSize=2
c3p0.maxPoolSize=50
c3p0.maxStatements=100
c3p0.numHelperThreads=10
c3p0.maxIdleTime=600

hibernate.hbm2ddl.auto=update
hibernate.show_sql=true

applicationContext-common.xml文件的内容为

登录成功!

struts2.login.success=登录成功!

提交

struts2.submit=提交

用户名

struts2.username=用户名

密码

struts2.password=密码
messageResource_en_US.propertie文件内容
struts2.login.success=Login Success!
struts2.submit=Submit
struts2.username=UserName
struts2.password=Password

2, 添加struts.properties文件,去掉struts.xml文件的constant转移到struts.properties下
struts.xml文件的内容为:

配置国际化资源的位置

struts.custom.i18n.resources=com.jbhx.struts2.international.messageResource

配置jsp为默认的html格式

struts.ui.theme=simple

配置本属性,可以使得改动struts配置文件不用重启应用服务器,开发中使用

struts.configuration.xml.reload=true

配置struts的编码

struts.i18n.encoding=GBK

配置struts2中的Action对象交给spring创建

struts.objectFactory=spring
3,使用国际化
在index.jsp和success.jsp中使用国际化
Index.jsp的内容如下:
<%@ page language=”java” contentType=”text/html; charset=UTF-8”
pageEncoding=”UTF-8”%>
<%@ taglib prefix=”s” uri=”/struts-tags”%>




Insert title here







:

                <td>
                    <s:textfield name="username" />
                </td>
            </tr>
            <tr>
                <td>
                    <s:text name="struts2.password" />
                    :
                </td>

                <td>
                    <s:textfield name="password" label="password" />
                </td>
            </tr>
            <tr>
                <td>
                    <s:submit value="%{getText('struts2.submit')}" />
                </td>
            </tr>
            </table>
    </s:form>

Success.jsp内容如下

<%@ page language=”java” contentType=”text/html; charset=UTF-8”
pageEncoding=”UTF-8”%>
<%@ taglib prefix=”s” uri=”/struts-tags”%>




Insert title here





可以验证了,就是把浏览器的语言添加一个英语的,并上移到中文的上面刷新界面是不是可以看到英文界面了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值