Java 架构的一些配置信息
2011-06-13 15:08
260 查看
(1)配置主 struts.xml 文件:
完整 src/struts.xml 文件请参见(附录1)。
(2)配置 src/user/struts.xml
完整 src/user/struts.xml 文件请参见(附录2)。
(3)配置 src/app-context.xml
完整 src/app-context.xml 文件请参见(附录3)。
(4)配置 src/user/action/getUser.java
完整 src/user/action/getUser.java 文件请参见(附录4)。
(5)以下文件配置略去,请参见项目:NLMRPII 中的相应文件:
src/user/service/dao/UserDao.java
src/user/service/dao/UserDaoImpl.java
src/user/service/UserService.java
src/user/service/UserServiceImpl.java
============================================
( 附录1:src/struts.xml )
(附录2:src/user/struts.xml )
( 附录3:src/app-context.xml )
( 附录4:src/user/action/getUser.java )
<include file="user/struts.xml"/>
完整 src/struts.xml 文件请参见(附录1)。
(2)配置 src/user/struts.xml
<!-- userJson --> <package name="userJson" extends="json-default"> <!-- getUser.action 2011-0613 Livon --> <action name="getUser" class="user.action.getUser"> <result type="json" /> </action> </package>
完整 src/user/struts.xml 文件请参见(附录2)。
(3)配置 src/app-context.xml
<!-- 用户 --> <bean id="user.action.getUser" class="user.action.getUser" scope="prototype"> <property name="userService"> <ref bean="userServiceImpl"/> </property> </bean> <bean id="userServiceImpl" class="user.service.UserServiceImpl" scope="prototype"> <property name="userDao"> <ref bean="userDaoImpl"/> </property> </bean> <bean id="userDaoImpl" class="user.service.dao.UserDaoImpl" parent="daoTemplate.flm" scope="prototype"> </bean>
完整 src/app-context.xml 文件请参见(附录3)。
(4)配置 src/user/action/getUser.java
/** 用户 Service 接口. */ private UserService userService = null; public void setUserService(UserService userService) { this.userService = userService; } public UserService getUserService() { return userService; }
完整 src/user/action/getUser.java 文件请参见(附录4)。
(5)以下文件配置略去,请参见项目:NLMRPII 中的相应文件:
src/user/service/dao/UserDao.java
src/user/service/dao/UserDaoImpl.java
src/user/service/UserService.java
src/user/service/UserServiceImpl.java
============================================
( 附录1:src/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> <constant name="struts.custom.i18n.resources" value="Constants"></constant> <include file="userManage/userManage-struts.xml"/> <include file="loginManage/loginManage-struts.xml"/> <include file="customerInfo/customerInfoManager-struts.xml"/> <include file="areaCategory/areaCategory-struts.xml"/> <include file="area/area-struts.xml"/> <include file="serviceCategory/serviceCategory-struts.xml"/> <include file="agreement/struts.xml"/> <include file="productMaintainFrequency/struts.xml"/> <include file="filterMaintainFrequency/struts.xml"/> <include file="feesHistory/struts.xml"/> <include file="customerService/struts.xml"/> <include file="customerFilter/struts.xml"/> <include file="customerAllService/struts.xml"/> <include file="commonCategory/struts.xml"/> <include file="comment/struts.xml"/> <include file="bom/struts.xml"/> <include file="mps/struts.xml"/> <include file="item/struts.xml"/> <include file="tag/struts.xml"/> <include file="savedSearch/struts.xml"/> <include file="stockBill/stockBill-struts.xml"/> <include file="user/struts.xml"/> </struts>
(附录2:src/user/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> <!-- user --> <package name="user" extends="struts-default"> <!-- getUser.action 2011-0613 Livon --> </package> <!-- userJson --> <package name="userJson" extends="json-default"> <!-- getUser.action 2011-0613 Livon --> <action name="getUser" class="user.action.getUser"> <result type="json" /> </action> </package> </struts>
( 附录3:src/app-context.xml )
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsp="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsp:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> <!-- 用户 --> <bean id="user.action.getUser" class="user.action.getUser" scope="prototype"> <property name="userService"> <ref bean="userServiceImpl"/> </property> </bean> <bean id="userServiceImpl" class="user.service.UserServiceImpl" scope="prototype"> <property name="userDao"> <ref bean="userDaoImpl"/> </property> </bean> <bean id="userDaoImpl" class="user.service.dao.UserDaoImpl" parent="daoTemplate.flm" scope="prototype"> </bean> </beans>
( 附录4:src/user/action/getUser.java )
/*********************************************************************** * System : NEWLIFE_ONLINE_ORDER * Date : 2010/4/06 * Description : 用户管理画面初始化Action ************************************************************************/ package user.action; import java.util.HashMap; import java.util.Map; import user.service.UserService; import jp.co.ana.fmc.fis.fid.common.json.JSON; import common.action.AbstractCommonAction; /** * 用户管理画面初始化Action. */ @SuppressWarnings("serial") public class getUser extends AbstractCommonAction { /** 用户 Service 接口. */ private UserService userService = null; /** * Action处理执行. * * @return Action处理执行结果. */ public String doAction() throws Exception { this.writeLog(this.getClass().getName(), ACTION_START); Map<String, Object> jsonMap = new HashMap<String, Object>(); getResponse().setCharacterEncoding("UTF-8"); jsonMap.put("actionResult", "true"); jsonMap.put("errCode", "0"); jsonMap.put("errMsg", ""); getResponse().getWriter().write(JSON.serialize(jsonMap)); this.writeLog(this.getClass().getName(), ACTION_END); return NONE; } public void setUserService(UserService userService) { this.userService = userService; } public UserService getUserService() { return userService; } }
相关文章推荐
- java中jdk安装配置信息
- java中经常用到的读写配置文件的信息properties属性的写入,读取例子
- Java Properties 类读取配置文件信息,Java properties文件的操作(zz)
- jvm工具系列之 -- Java配置信息工具
- Java Collections Framework(Java 集合架构)来学习Java定义的一些ADT
- JavaWeb_Servlet_应用_读取文件配置信息
- [置顶] android开发之java JDK环境变量配置的信息代码 附详细教程。
- Java 查询数据库的一些基本信息
- Java开发小技巧(四):配置文件敏感信息处理
- 开启Java8来启用Lambda表达式在Android Studio的一些配置
- java获取服务器一些信息的方法
- JavaWeb - Tomcat的配置信息
- 对Java配置文件中敏感信息进行加解密的工具类
- 在ubuntu中配置java环境变量遇到的一些问题
- java 利用ManagementFactory获取jvm,os的一些信息--转
- Apache服务器默认配置的一些基本信息
- Spring MVC一些配置信息解析
- java中正则表达式,切割和验证一些信息
- C# .NET 可灵活配置登录窗体、主窗体的快速信息管理系统开发架构参考
- Java Properties 类读取和修改配置文件信息