锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲中久无码永久在线观看同,亚洲国产精品午夜电影,国产成人亚洲精品91专区高清http://m.tkk7.com/jinfeng_wang/category/483.htmlG-G-S,D-D-U!zh-cnThu, 20 Mar 2008 09:53:05 GMTThu, 20 Mar 2008 09:53:05 GMT60XDoclet鐨刡uild.xml鍐欐硶 zzhttp://m.tkk7.com/jinfeng_wang/archive/2008/03/20/187409.htmljinfeng_wangjinfeng_wangThu, 20 Mar 2008 01:52:00 GMThttp://m.tkk7.com/jinfeng_wang/archive/2008/03/20/187409.htmlhttp://m.tkk7.com/jinfeng_wang/comments/187409.htmlhttp://m.tkk7.com/jinfeng_wang/archive/2008/03/20/187409.html#Feedback0http://m.tkk7.com/jinfeng_wang/comments/commentRss/187409.htmlhttp://m.tkk7.com/jinfeng_wang/services/trackbacks/187409.html

 XDoclet鐨刡uild.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鍙互鐢熸垚錛宻trutsconfigxml , 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鐨剎ml鏂囦歡 -->
  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鐨剎ml鏂囦歡 -->
  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鐨剎ml鏂囦歡 -->
  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. }






jinfeng_wang 2008-03-20 09:52 鍙戣〃璇勮
]]>
XDoclet Spring+Struts HowTo zzhttp://m.tkk7.com/jinfeng_wang/archive/2008/03/20/187406.htmljinfeng_wangjinfeng_wangThu, 20 Mar 2008 01:42:00 GMThttp://m.tkk7.com/jinfeng_wang/archive/2008/03/20/187406.htmlhttp://m.tkk7.com/jinfeng_wang/comments/187406.htmlhttp://m.tkk7.com/jinfeng_wang/archive/2008/03/20/187406.html#Feedback0http://m.tkk7.com/jinfeng_wang/comments/commentRss/187406.htmlhttp://m.tkk7.com/jinfeng_wang/services/trackbacks/187406.html

For all those out there using Spring together with Struts, i created a small howTo regarding automatic generation of relevant files, especially the boring action-servlet-xml file which must be in synch with your struts-config.xml, at least for all Struts actions which should be injected by Spring.

Lets start with the Action class:

/**
* Action to delete a Client
* Date: 09.02.2005
* Time: 15:29:15
*
* @author Logemann - Logentis e.K. (ml@logentis.de)
* @version $Id$
* @struts.action path="clientDelete" validate="false"
* type="org.springframework.web.struts.DelegatingActionProxy"
* name="emptyform"
* @struts.action-forward name="back"
* path="/clientManager.html" redirect="true"
* @spring.bean name="clientDelete"
*/
public class ClientDeleteAction extends Action {

ClientManager clientManagerService;



/**

* Spring injection

*

* @param clientManagerService clientManagerService

* @spring.property ref="clientManagerService"

*/

public void setClientManagerService(ClientManager clientManagerService) {

this.clientManagerService = clientManagerService;

}

[..]


With this tags, the ant build target outlined below will create a struts-config.xml and the necessary action-servlet.xml needed by Spring. Lets see how the target looks:

<path id="classpath">

<fileset dir="c:/xdoclet-1.2.2" includes="*.jar"/>
<fileset dir="c:/j2sdkee1.3.1/lib" includes="*.jar"/>
<fileset dir="c:/struts/lib" includes="struts.jar"/>
</path>

<taskdef name="springdoclet"
classname="xdoclet.modules.spring.SpringDocletTask"
classpathref="classpath"/>

<taskdef name="webdoclet"
classname="xdoclet.modules.web.WebDocletTask"
classpathref="classpath"/>

<target name="myTest">
<webdoclet destDir="c:\" force="true" verbose="true">
<fileset dir="${src.dir}">
<include name="**/*Form.java" />
<include name="**/*Action.java" />
<include name="**/*Servlet.java" />
</fileset>
<strutsconfigxml version="1.1" validateXml="true"/>
</webdoclet>

<springdoclet destDir="c:\" verbose="true">
<fileset dir="${src.dir}">
<include name="**/*Action.java" />
</fileset>
<springxml destinationFile="action-servlet.xml"/>
</springdoclet>
</target>

Be sure to modify the classpath definition and the destDir values of springdoclet and webdoclet to suit your needs. Right now the Spring task only searches for Actions in order to create action-servlet.xml, if you also want to create your normal service beans like ClientManagerService, you should create another springdoclet task and output things to applicationContext.xml if you like.

But this is mostly users choice, as you know, Spring supports from one to many bean definition files and its up to you how you want to have your spring xml world.

This will be created when you run the mentioned target:

(action-servlet.xml)


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC
"-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">

<beans
default-autowire="no"
default-lazy-init="false"
default-dependency-check="none"
>

<bean
name="clientDelete"
class="de.logentis.versysng.action.clientmanager.ClientDeleteAction"
>

<property name="clientManagerService">

<ref bean="clientManagerService"/>
</property>

</bean>

<!--
To include additional bean definitions for Spring in the generated
application context file, add a file to your XDoclet merge directory
called spring-beans.xml that contains the <bean></bean> markup.
-->
</beans>


(struts-config.xml)


<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">

<struts-config>

<!-- ========== Data Sources Definitions =================================== -->
<!--
Define your Struts data sources in a file called struts-data-sources.xml and place
it in your merge directory.
-->

<!-- ========== Form Bean Definitions =================================== -->
<form-beans>

<!--
If you have non XDoclet forms, define them in a file called struts-forms.xml and
place it in your merge directory.
-->
</form-beans>

<!-- ========== Global Exceptions Definitions =================================== -->
<!--
Define your exceptions in a file called global-exceptions.xml and place
it in your merge directory.
-->

<!-- ========== Global Forward Definitions =================================== -->
<!--
Define your forwards in a file called global-forwards.xml and place
it in your merge directory.
-->

<!-- ========== Action Mapping Definitions =================================== -->
<action-mappings>
<action
path="clientDelete"
type="org.springframework.web.struts.DelegatingActionProxy"
name="emptyform"
scope="request"
unknown="false"
validate="false"
>
<forward
name="back"
path="/clientManager.html"
redirect="true"
/>
</action>

<!-- If you have non XDoclet actions, define them in a file called struts-actions.xml and place it in your merge directory. -->
</action-mappings>

<!-- Define your Struts controller in a file called struts-controller.xml and place it in your merge directory. -->

<!-- Define your Struts message-resources in a file called struts-message-resources.xml and place it in your merge directory. -->

<!-- Define your Struts plugins in a file called struts-plugins.xml and place it in your merge directory. -->

</struts-config>



jinfeng_wang 2008-03-20 09:42 鍙戣〃璇勮
]]>
hbm2java錛宻chemaexporthttp://m.tkk7.com/jinfeng_wang/archive/2005/04/01/2688.htmljinfeng_wangjinfeng_wangFri, 01 Apr 2005 02:22:00 GMThttp://m.tkk7.com/jinfeng_wang/archive/2005/04/01/2688.htmlhttp://m.tkk7.com/jinfeng_wang/comments/2688.htmlhttp://m.tkk7.com/jinfeng_wang/archive/2005/04/01/2688.html#Feedback0http://m.tkk7.com/jinfeng_wang/comments/commentRss/2688.htmlhttp://m.tkk7.com/jinfeng_wang/services/trackbacks/2688.html 

<?xml version="1.0"?>
<project name="Harnessing Hibernate: The Developer's Notebook"
         default
="db" basedir=".">

  
<!-- Set up properties containing important project directories -->
  
<property name="source.root" value="src"/>
  
<property name="class.root" value="classes"/>
  
<property name="lib.dir" value="lib"/>
  
<property name="data.dir" value="data"/>

  
<!-- Set up the class path for compilation and execution -->
  
<path id="project.class.path">
      
<!-- Include our own classes, of course -->
      
<pathelement location="${class.root}" />
      
<!-- Include jars in the project library directory -->
      
<fileset dir="${lib.dir}">
        
<include name="*.jar"/>
      
</fileset>
  
</path>

  
<target name="db" description="Runs HSQLDB database management UI
against the database file--use when application is not running"
>
      
<java classname="org.hsqldb.util.DatabaseManager"
            fork
="yes">
         
<classpath refid="project.class.path"/>
         
<arg value="-driver"/>
         
<arg value="org.hsqldb.jdbcDriver"/>
         
<arg value="-url"/>
         
<arg value="jdbc:hsqldb:${data.dir}/music"/>
         
<arg value="-user"/>
         
<arg value="sa"/>
      
</java>
  
</target>

  
<!-- Teach Ant how to use Hibernate's code generation tool -->
  
<taskdef name="hbm2java"
           classname
="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
           classpathref
="project.class.path"/>

  
<!-- Generate the java code for all mapping files in our source tree -->
  
<target name="codegen"
          description
="Generate Java source from the O/R mapping files">
    
<hbm2java output="${source.root}">
      
<fileset dir="${source.root}">
        
<include name="**/*.hbm.xml"/>
      
</fileset>
    
</hbm2java>
  
</target>

  
<!-- Create our runtime subdirectories and copy resources into them -->
  
<target name="prepare" description="Sets up build structures">
    
<mkdir dir="${class.root}"/>

    
<!-- Copy our property files and O/R mappings for use at runtime -->
    
<copy todir="${class.root}" >
      
<fileset dir="${source.root}" >
        
<include name="**/*.properties"/>
        
<include name="**/*.hbm.xml"/>
      
</fileset>
    
</copy>
  
</target>

  
<!-- Compile the java source of the project -->
  
<target name="compile" depends="prepare"
          description
="Compiles all Java classes">
    
<javac srcdir="${source.root}"
           destdir
="${class.root}"
           debug
="on"
           optimize
="off"
           deprecation
="on">
      
<classpath refid="project.class.path"/>
    
</javac>
  
</target>

  
<!-- Generate the schemas for all mapping files in our class tree -->
  
<target name="schema" depends="compile"
          description
="Generate DB schema from the O/R mapping files">

    
<!-- Teach Ant how to use Hibernate's schema generation tool -->
    
<taskdef name="schemaexport"
             classname
="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
             classpathref
="project.class.path"/>

    
<schemaexport properties="${class.root}/hibernate.properties"
                  quiet
="no" text="no" drop="no">
      
<fileset dir="${class.root}">
        
<include name="**/*.hbm.xml"/>
      
</fileset>
    
</schemaexport>
  
</target>

</project>

 

You may be wondering why the taskdef for the schema update tool is inside our schema target, rather than at the top of the build file, next to the one for hbm2java. Well, I wanted it up there too, but I ran into a snag that's worth explaining. I got strange error messages the first time I tried to build the schema target, complaining there was no hibernate.properties on the class path and our compiled Track class couldn't be found. When I ran it again, it worked. Some detective work using ant -verbose revealed that if the classes directory didn't exist when the taskdef was encountered, Ant helpfully removed it from the class path. Since a taskdef can't have its own dependencies, the solution is to move it into the schema target, giving it the benefit of that target's dependencies, ensuring the classes directory exists by the time the taskdef is processed.

涔熻浣犱細濂囨紝涓轟綍鎵句簡schema鏇存柊宸ュ叿鐨則askdef浼氬湪schema鐨則arget涓繘琛屽畾涔夛紝鑰屼笉鏄湪build鏂囦歡鐨勯《閮紝绱ф帴鐫hbm2java榪涜瀹氫箟銆傚垰寮濮嬫垜涔熸槸閭f牱鎯崇殑錛岃繖閲屾垜闇瑕佽В閲婁竴涓嬭繖閲岀殑闂銆傚綋絎竴嬈℃瀯寤簊chema鏃訛紝鎴戝緱鍒頒簡璁稿鑾悕濂囧鐨勯敊璇紝鎶ラ敊淇℃伅鏄細鍦╟lasspath涓壘涓嶅埌hibernate.properties鍜孴rack綾匯備絾鏄啀嬈℃瀯寤虹殑鏃跺欙紝灝卞彲浠ヤ簡銆傚綋浣跨敤鍛戒護鈥渁nt -verbose鈥濇椂錛屼綘灝卞彲浠ュ彂鐜板叾涓殑緇嗚妭涔嬫墍鍦ㄣ傚鏋滃湪ant瑙f瀽鍒皌askdef鏃訛紝build鏂囦歡涓墍浣跨敤鐨刢lass鐩綍騫朵笉瀛樺湪錛岄偅涔坅nt灝變細鑷繁灝嗘鐩綍浠巆lasspath涓Щ闄ゃ備絾鏄痶askdef鍙堟棤娉曞畾涔夎嚜宸辯殑dependencies錛屽洜姝よ繖閲屼笉寰椾笉灝嗗叾縐誨叆鍒皊chema target涓紝榪欐牱涔熷氨鍙互浣跨敤鍒皌arget鐨刣ependencies錛屼繚璇佸湪ant澶勭悊taskdef鐨勬椂鍊欙紝class鐩綍蹇呯劧宸茬粡瀛樺湪銆?/P>

jinfeng_wang 2005-04-01 10:22 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲jizzjizz少妇| 亚洲精品影院久久久久久| 亚洲中文字幕AV每天更新| 久久久久久久综合日本亚洲| 视频免费1区二区三区| 亚洲av麻豆aⅴ无码电影| 久久久久亚洲AV无码专区首| a级毛片毛片免费观看久潮喷| 亚洲一区二区女搞男| 中文字幕在线免费视频| 亚洲乱色熟女一区二区三区丝袜| 国产精品成人免费观看| 久久久久国产精品免费免费搜索| 亚洲精品偷拍无码不卡av| 欧洲乱码伦视频免费| 亚洲人片在线观看天堂无码| 国产精品四虎在线观看免费| 免费大片av手机看片| 国产亚洲美女精品久久久2020| 国产午夜成人免费看片无遮挡| 暖暖免费高清日本一区二区三区| 亚洲精品无码成人AAA片| 亚欧免费一级毛片| 久久影院亚洲一区| 99久久国产免费-99久久国产免费| 久久亚洲AV无码精品色午夜| 18禁成人网站免费观看| 日韩亚洲人成在线| 国产99视频免费精品是看6| 国产一级a毛一级a看免费视频| 亚洲视频一区二区在线观看| 日本免费网站观看| 在线涩涩免费观看国产精品| 亚洲成AV人片久久| 亚洲国产精品尤物YW在线观看| 亚洲乱码日产精品一二三| 亚洲精品99久久久久中文字幕| 蜜桃成人无码区免费视频网站 | 伊人久久综在合线亚洲91| 免费播放一区二区三区| 亚洲色偷偷综合亚洲av78|