appfuse备注

第一部分 Appfuse基本信息
1、appfuse3.5搭建过程
(1)安装jdk,安装maven
c:\workspace\appfuse\>mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=3.5.0 -DgroupId=com.xxx -DartifactId=a -DarchetypeRepository=https://oss.sonatype.org/content/repositories/appfuse

mvn appfuse:full-source
开启MySQL5
mvn jetty:run
自动建表
mvn eclipse:eclipse
导入eclipse

2、熟悉appfuse结构
导入eclipse,jdk1.8,tomcat8.0运行中文有乱码。
用jetty运行中文正常。
问题主要出在i18n国际化上,乱码的文件是:
/a/src/main/resources/ApplicationResources_zh.properties
/a/src/main/resources/ApplicationResources_zh_CN.properties
/a/src/main/resources/displaytag_zh.properties
/a/src/main/resources/displaytag_zh_CN.properties
在eclipse里安装插件Properties Editor插件,编辑以上文件非常方便。
打开后保存,再运行项目,乱码消除了。

首页文件是:/a/src/main/webapp/login.jsp登录页面
该页面被装饰,装饰页面:decorators/default.jsp
装饰配置文件:/WEB-INF/decorators.xml文件。




3、组件
3.1、sitemesh组件,采用装饰器设计模式,
版本:2.4.2

3.2、Spring Security组件
版本:3.2.5
官网文档参考:http://docs.spring.io/spring-security/site/docs/3.2.5.RELEASE/reference/htmlsingle/
3.3、Struts Menu组件
版本:2.4.3
http://www.blogjava.net/gdufo/archive/2008/06/26/210947.html
http://zhouliming-521.iteye.com/blog/125083
http://blog.csdn.net/springmvc_freemarker/article/details/50384600
3.4、Velocity模板引擎
版本:1.7
http://blog.csdn.net/qq_25237663/article/details/52262532
http://blog.csdn.net/nengyu/article/details/6671904
https://www.ibm.com/developerworks/cn/java/j-lo-velocity1/
http://ifeve.com/apache-velocity-dev/#header

3.5、URLWriting
版本:4.0.3

3.6、displaytag
版本:1.2

3.7、Hibernate
版本:4.3.6
http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html_single/
http://docs.jboss.org/hibernate/orm/4.3/devguide/en-US/html_single/

3.8、Spring
版本:4.1.3



第二部分 创建实体类
步骤:
1、用客户端工具在数据库里建表。
2、Eclipse自动生成实体类,项目,右键,JPA tools,根据数据库表生成实体类。
3、在项目资源下/META-INF/persistence.xml自动添加了实体类
4、在hibernate.cfg.xml添加新建的实体类。
注意:实体类映射的时候建议把int类型修改为Integer
前台向后台传值的时候,注意空格问题,查询的时候避免查询不到结果集


appfuse3.5打开Hibernate的show_sql日志方法
环境JDK1.8+Tomcat8
在Tomcat启动项增加-Dorg.jboss.logging.provider=slf4j参数。
打开Server,Overview页,Open launch configuration,在Arguments标签页,VM arguments框里最后增加:-Dorg.jboss.logging.provider="slf4j"增加完参数启动Tomcat就可以看到hibernate执行的sql了。



猜你喜欢

转载自fanzhenzhen1.iteye.com/blog/2381048