`
- 浏览:
70435 次
- 性别:
- 来自:
上海
-
package
src;
public
class
App
{
/** */
/**
*
@param
args
*/
public
static
void
main(String[] args)
throws
Exception
{
//
TODO Auto-generated method stub
String[] domain
=
{
"
AssortItem
"
,
"
Assortment
"
,
"
Banner
"
,
"
Cin
"
,
"
Cupc
"
,
"
DiscontinueReason
"
,
"
IsmailCfg
"
,
"
PieceCost
"
,
"
PoCost
"
,
"
Product
"
,
"
Srp
"
,
"
Uom
"
,
"
Upc
"
}
;
java.io.FileWriter fileWriter1
=
new
java.io.FileWriter(
"
c:\\snrc\\xml\\daoxml.xml
"
);
java.io.FileWriter fileWriter2
=
new
java.io.FileWriter(
"
c:\\snrc\\xml\\managerxml.xml
"
);
for
(
int
i
=
0
,j
=
domain.length;i
<
j;i
++
)
{
printDao(domain[i]);
printDaoHibernate(domain[i]);
printManager(domain[i]);
printManagerImpl(domain[i]);
printAction(domain[i]);
fileWriter1.write(
"
<bean id=\
""
+ domain[i].toLowerCase() +
"
Dao\
"
class=\
"
com.staplesnrc.admin.dao.hibernate.
"
+domain[i]+
"
DaoHibernate\
"
/>\n\n
"
);
fileWriter2.write(
"
<bean id=\
""
+ domain[i].toLowerCase() +
"
Manager\
"
parent=\
"
baseTxService\
"
>\n
"
);
fileWriter2.write(
"
<property name=\
"
target\
"
>\n
"
);
fileWriter2.write(
"
<bean class=\
"
com.staplesnrc.admin.manager.impl.
"
+domain[i]+
"
ManagerImpl\
"
/>\n
"
);
fileWriter2.write(
"
</property>\n
"
);
fileWriter2.write(
"
</bean>\n\n
"
);
}
fileWriter1.flush();
fileWriter1.close();
fileWriter2.flush();
fileWriter2.close();
}
private
static
void
printDao(String domain)
throws
Exception
{
java.io.FileWriter fileWriter
=
new
java.io.FileWriter(
"
c:\\snrc\\dao\\
"
+
domain
+
"
Dao.java
"
);
fileWriter.write(
"
/*author: xxxx */\n
"
);
fileWriter.write(
"
package com.staplesnrc.admin.dao;\n
"
);
fileWriter.write(
"
public interface
"
+
domain
+
"
Dao extends Dao<
"
+
domain
+
"
>{}
"
);
fileWriter.flush();
fileWriter.close();
}
private
static
void
printDaoHibernate(String domain)
throws
Exception
{
java.io.FileWriter fileWriter
=
new
java.io.FileWriter(
"
c:\\snrc\\daoHibernate\\
"
+
domain
+
"
DaoHibernate.java
"
);
fileWriter.write(
"
/*author: xxxx */\n
"
);
fileWriter.write(
"
package com.staplesnrc.admin.dao.hibernate;\n
"
);
fileWriter.write(
"
public class
"
+
domain
+
"
DaoHibernate extends BaseDaoHibernate<
"
+
domain
+
"
> implements
"
+
domain
+
"
Dao {}
"
);
fileWriter.flush();
fileWriter.close();
}
private
static
void
printManager(String domain)
throws
Exception
{
java.io.FileWriter fileWriter
=
new
java.io.FileWriter(
"
c:\\snrc\\manager\\
"
+
domain
+
"
Manager.java
"
);
fileWriter.write(
"
/*author: xxxx */\n
"
);
fileWriter.write(
"
package com.staplesnrc.admin.manager;\n
"
);
fileWriter.write(
"
public interface
"
+
domain
+
"
Manager extends Manager<
"
+
domain
+
"
>{}
"
);
fileWriter.flush();
fileWriter.close();
}
private
static
void
printManagerImpl(String domain)
throws
Exception
{
java.io.FileWriter fileWriter
=
new
java.io.FileWriter(
"
c:\\snrc\\managerImpl\\
"
+
domain
+
"
ManagerImpl.java
"
);
fileWriter.write(
"
/*author: xxxx */\n
"
);
fileWriter.write(
"
package com.staplesnrc.admin.manager.impl;\n
"
);
fileWriter.write(
"
public class
"
+
domain
+
"
ManagerImpl extends BaseManager<
"
+
domain
+
"
> implements
"
+
domain
+
"
Manager{\n
"
);
fileWriter.write(
"
private
"
+
domain
+
"
Dao
"
+
domain.toLowerCase()
+
"
Dao;\n
"
);
fileWriter.write(
"
public void set
"
+
domain
+
"
Dao(
"
+
domain
+
"
Dao dao) {\n
"
);
fileWriter.write(
"
super.setDao(dao);\n
"
);
fileWriter.write(
"
this.
"
+
domain.toLowerCase()
+
"
Dao = dao;\n
"
);
fileWriter.write(
"
}\n
"
);
fileWriter.write(
"
}\n
"
);
fileWriter.flush();
fileWriter.close();
}
private
static
void
printAction(String domain)
throws
Exception
{
java.io.FileWriter fileWriter
=
new
java.io.FileWriter(
"
c:\\snrc\\action\\
"
+
domain
+
"
Action.java
"
);
fileWriter.write(
"
/*author: xxxx */\n
"
);
fileWriter.write(
"
package com.staplesnrc.admin.web;\n
"
);
fileWriter.write(
"
public class
"
+
domain
+
"
Action extends BaseAction implements Serializable {}\n
"
);
fileWriter.flush();
fileWriter.close();
}
}
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
是一个以spring为核心的项目脚手架(或者称为胶水框架),框架将各个零散的框架(struts,strust2,springmvc,hibernate,ibatis,spring_jdbc,flex)...dao,manager,struts+struts2 action类,可以生成jsp的增删改查及列表页面
1.POJO类,类的hibernate映射文件,DAO类,Manager类,spring的对hibernate封装的配置文件,如果你不使用webwork,只需要这些就行了 2.webwork的Action类,Action的资源文件,Action的校验文件,xwork.xml, 模板支持...
框架将各个零散的框架(struts,strust2,springmvc,hibernate,ibatis,spring_jdbc,flex)搭建好,并内置一个代码生成器,辅助项目开发,可以生成java的hibernat model,dao,manager,struts+struts2 action类,可以生成jsp...
public class ManagerAction implements Action, ModelDriven<Manager> { private Manager manager = new Manager(); @Override public Manager getModel() { return manager; } public String Manager...
XDoclet是一种基于Javadoc的元数据处理器,它可以读取类上的注解,并自动生成相关的代码,如Hibernate的映射文件或Spring的配置文件。 2. **使用Ant根据对象产生数据库表** 利用Appfuse的Ant构建脚本,我们可以...
Chapter_11可能涵盖服务端通信,如使用HTTPService或WebService与后端服务器进行数据交换,实现AMF(Action Message Format)数据序列化,以及数据访问对象(DAO)的设计模式。这部分内容对于实现Flex应用程序的数据...
例如,可能有一个`EmployeeAction`处理员工提交的报销单,`ManagerAction`处理部门经理的审批,`GeneralManagerAction`负责总经理的审核,`FinanceAction`处理财务部门的支付或拒绝,以及一个`QueryAction`用于查询...
5. ** ManagerAction和MemberAction类**:`ManagerAction`和`MemberAction`可能是针对管理员和会员不同角色的操作。管理员可能有权限执行更多的系统管理任务,如管理商品库存、用户信息等,而会员可能只涉及购物、...
3. **代码生成能力**:Appfuse 支持自动生成大量的基础代码,例如 CRUD 操作相关的代码,从而节省了大量的开发时间。 4. **易于定制和扩展**:虽然框架本身已经提供了丰富的功能,但其设计充分考虑到了灵活性和可...
7.2.1 配置Provider Manager 7.2.2 根据数据库验证身份 7.2.3 根据LDAP仓库进行身份验证 7.3 控制访问 7.3.1 访问决策投票 7.3.2 决定如何投票 7.3.3 处理投票弃权 7.4 保护Web应用程序 7.4.1 代理Spring ...
5. **事务管理**:在Struts2中,通常使用Spring框架进行事务管理,配置Transaction Manager,并在Action中注入Service层,Service层调用DAO层的方法并控制事务边界。 6. **结果处理**:Action执行完毕后,返回一个...
7.2.1 配置Provider Manager 7.2.2 根据数据库验证身份 7.2.3 根据LDAP仓库进行身份验证 7.3 控制访问 7.3.1 访问决策投票 7.3.2 决定如何投票 7.3.3 处理投票弃权 7.4 保护Web应用程序 7.4.1 代理Spring ...
这个项目的结构遵循了标准的Java Web开发模式,包括DAO层、Action层和表单对象,这有利于代码的组织和维护。WebRoot\WEB-INF目录结构表明了这是一个基于Servlet和JSP的Web应用,其中的`WEB-INF`目录存放了配置文件和...
- **Action层:** Springside3中Action层的设计主要依赖于Struts2的Convention插件,该插件能够自动识别和配置Action,使得Action的配置变得更加简洁。 - **示例代码:** ```java @Namespace("/security") public...
- **3层架构**:Web层(Action)、业务层(Manager)、数据层(DAO)的分层设计,提高了系统可扩展性和维护性。 - **MVC模式**:Struts作为前端框架,负责用户界面展示和请求处理;Spring作为中间层,管理业务逻辑和...
- **分层架构**:SSH整合通常采用分层架构,包括表现层(Action)、业务逻辑层(Manager)、数据访问层(DAO)和数据模型层(POJO),每层职责明确,易于扩展和维护。 通过以上介绍,我们可以理解SSH整合的关键点...
Spring会根据配置自动装配这些组件,而Hibernate的SessionFactory和Transaction Manager也会被声明并配置。 2. **请求处理**: 用户的HTTP请求到达Struts,Struts Controller(ActionServlet)会根据配置找到对应...