jinfeng_wang

G-G-S,D-D-U!

BlogJava 首页 新随笔 联系 聚合 管理
  400 Posts :: 0 Stories :: 296 Comments :: 0 Trackbacks
http://gocom.primeton.com/showblogarticle.php?cat_id=all&articleId=&blogId=14478&?PHPSESSID=0d485ace30025757c7b9a22da013c1a0&page=4&PHPSESSID=1370043e8b6d902ac0f6fdc3fe7776a8


 XDoclet的build.xml写法


  1. <?xml version="1.0" encoding="utf-8"?>
  2. <project name="appgen" default="web-demo" basedir=".">
  3.  
  4. <property file="build.properties" />
  5.  
  6. <path id="xdoclet.classpath">
  7. <fileset dir="${lib}">
  8. <include name="**/*.jar" />
  9. </fileset>
  10. <path location="${classes}" />
  11. </path>
  12.  
  13. <target name="clean">
  14. <delete>
  15. <fileset dir="${gen}">
  16. <include name="*.xml" />
  17. </fileset>
  18. </delete>
  19. </target>
  20.  
  21. <!-- 这个target可以生成,strutsconfigxml , strutsvalidationxml ,web.xml-->
  22.  
  23. <target name="web-demo" depends="clean,Spring-service-beans,Spring-action-beans,Spring-dao-beans">
  24. <taskdef name="webdoclet" classname="xdoclet.modules.web.WebDocletTask" classpathref="xdoclet.classpath" />
  25. <webdoclet destDir="${gen}" mergeDir="${merge}" force="false">
  26. <fileset dir="${src}">
  27. <include name="**/*Action.java" />
  28. <include name="**/*Form.java" />
  29. </fileset>
  30.  
  31. <strutsconfigxml Version="1.2" destDir="${gen}" validateXML="true"/>
  32. <strutsvalidationxml destDir="${gen}" />
  33. <deploymentdescriptor Servletspec="2.4" destDir="${gen}" />
  34.  
  35. </webdoclet>
  36. </target>
  37.  
  38. <target name="ReplaceConfigFile" depends="web-demo">
  39. <copy todir="${webinf}">
  40. <fileset dir="${gen}">
  41. <include name="struts-config.xml"/>
  42. <include name="validation.xml"/>
  43. <include name="action-beans.xml"/>
  44. <include name="dao-beans.xml"/>
  45. <include name="service-beans.xml"/>
  46. </fileset>
  47. </copy>
  48. </target>
  49. <!-- 生成spring的xml文件 -->
  50. <target name="Spring-service-beans" description="Spring-application-beans">
  51. <taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" />
  52. <springdoclet excludedTags="@version,@author,@todo" destDir="gen" verbose="true" addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}">
  53. <fileset dir="src" includes="**/*ServiceImpl.java"/>
  54. <springxml destinationFile="service-beans.xml" destDir="gen"/>
  55. </springdoclet>
  56. </target>
  57.  
  58.  
  59. <!-- 生成spring的xml文件 -->
  60. <target name="Spring-action-beans" description="Spring-servlet-beans">
  61. <taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" />
  62. <springdoclet excludedTags="@version,@author,@todo" destDir="gen" verbose="true" addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}">
  63. <springxml destinationFile="action-beans.xml" destDir="gen"/>
  64. <fileset dir="src" includes="**/*Action.java"/>
  65. </springdoclet>
  66. </target>
  67.  
  68.  
  69. <!-- 生成spring的xml文件 -->
  70. <target name="Spring-dao-beans" description="Spring-servlet-beans">
  71. <taskdef name="springdoclet" classname="xdoclet.modules.spring.SpringDocletTask" classpathref="xdoclet.classpath" />
  72. <springdoclet excludedTags="@version,@author,@todo" destDir="gen" verbose="true" addedTags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}">
  73. <springxml destinationFile="dao-beans.xml" destDir="gen"/>
  74. <fileset dir="src" includes="**/*DAOIbatis.java"/>
  75. </springdoclet>
  76. </target>
  77.  
  78. </project>
  79.  


============================================


  1. /**
  2. * @spring.bean id="UserDAO"
  3. * @spring.property name="dataSource" ref="dataSource"
  4. * @spring.property name="sqlMapClient" ref="sqlMapClient"
  5. *
  6. * @author Conan
  7. *
  8. */
  9. public class UserDAOIbatis extends BaseDAOIBatis implements UserDAO {....}


-------------------------------------------


  1. /**
  2. * @spring.bean id="UserService"
  3. * @spring.property name="userDao" ref="UserDAO"
  4. *
  5. * @author Conan
  6. *
  7. */
  8. public class UserServiceImpl extends BaseManager implements UserService {...}



 ---------------------------------------------


  1. /**
  2. *
  3. * @struts.action path="/add" name="UserForm" input="/add.jsp"
  4. * type="org.springframework.web.struts.DelegatingActionProxy"
  5. * validate="true" scope="request"
  6. *
  7. * @struts.action-forward name="success" path="/success.jsp" redirect="true"
  8. * @struts.action-forward name="failure" path="/failure.jsp" redirect="true"
  9. *
  10. * @struts.action-form name="UserForm"
  11. *
  12. * @spring.bean
  13. * name="/add"
  14. * @spring.property
  15. * name="userService"
  16. * ref="UserService"
  17. *
  18. */
  19. public final class AddAction extends BaseAction {...}


------------------------------------------


  1. /**
  2. * @struts.form name="UserForm"
  3. */
  4. public class UserForm extends BaseForm{
  5.  
  6. /**
  7. * @struts.validator type="required"
  8. * @struts.validator type="mask" msgkey="error.age"
  9. * @struts.validator-var name="mask" value="^[0-9]*$"
  10. */
  11. public void setAge(Integer age) {
  12. this.age = age;
  13. }
  14.  
  15. }




posted on 2008-03-20 09:52 jinfeng_wang 阅读(883) 评论(0)  编辑  收藏 所属分类: springantjavaZZstructs

只有注册用户登录后才能发表评论。


网站导航: