锘??xml version="1.0" encoding="utf-8" standalone="yes"?>狠狠亚洲狠狠欧洲2019,久久精品国产亚洲Aⅴ蜜臀色欲,亚洲人色大成年网站在线观看http://www.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://www.tkk7.com/jinfeng_wang/archive/2008/03/20/187409.htmljinfeng_wangjinfeng_wangThu, 20 Mar 2008 01:52:00 GMThttp://www.tkk7.com/jinfeng_wang/archive/2008/03/20/187409.htmlhttp://www.tkk7.com/jinfeng_wang/comments/187409.htmlhttp://www.tkk7.com/jinfeng_wang/archive/2008/03/20/187409.html#Feedback0http://www.tkk7.com/jinfeng_wang/comments/commentRss/187409.htmlhttp://www.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://www.tkk7.com/jinfeng_wang/archive/2008/03/20/187406.htmljinfeng_wangjinfeng_wangThu, 20 Mar 2008 01:42:00 GMThttp://www.tkk7.com/jinfeng_wang/archive/2008/03/20/187406.htmlhttp://www.tkk7.com/jinfeng_wang/comments/187406.htmlhttp://www.tkk7.com/jinfeng_wang/archive/2008/03/20/187406.html#Feedback0http://www.tkk7.com/jinfeng_wang/comments/commentRss/187406.htmlhttp://www.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://www.tkk7.com/jinfeng_wang/archive/2005/04/01/2688.htmljinfeng_wangjinfeng_wangFri, 01 Apr 2005 02:22:00 GMThttp://www.tkk7.com/jinfeng_wang/archive/2005/04/01/2688.htmlhttp://www.tkk7.com/jinfeng_wang/comments/2688.htmlhttp://www.tkk7.com/jinfeng_wang/archive/2005/04/01/2688.html#Feedback0http://www.tkk7.com/jinfeng_wang/comments/commentRss/2688.htmlhttp://www.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.

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

jinfeng_wang 2005-04-01 10:22 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 99精品免费视频| 日韩成人毛片高清视频免费看| 中国性猛交xxxxx免费看| 亚洲va中文字幕无码| 好男人www免费高清视频在线| 亚洲成?v人片天堂网无码| 久久精品国产亚洲av天美18| 国产色婷婷精品免费视频| 国产亚洲美女精品久久久久狼| 亚洲videosbestsex日本| 久草视频免费在线观看| 亚洲国产精品第一区二区三区| 黄网站色视频免费看无下截 | 九一在线完整视频免费观看| 久久福利资源网站免费看| 国产亚洲日韩在线三区| 99久久免费国产精品热| 亚洲另类激情综合偷自拍| 无码日韩人妻AV一区免费l| 亚洲精品无码永久在线观看 | 男人的好看免费观看在线视频| 国产成人精品日本亚洲18图| 日韩黄色免费观看| 亚洲精品国产福利片| 免费人成网站在线观看不卡| 亚洲精品国产电影| 国产婷婷成人久久Av免费高清| 亚洲男人天堂影院| 在线免费观看韩国a视频| 成人a毛片视频免费看| 亚洲AV无码不卡在线播放| 2022免费国产精品福利在线| 久久精品国产亚洲AV果冻传媒| 18禁免费无码无遮挡不卡网站 | 亚洲AV综合色区无码二区爱AV| 日韩一品在线播放视频一品免费| 一边摸一边爽一边叫床免费视频| 久久精品国产亚洲AV无码麻豆| 成人免费无遮挡无码黄漫视频| 亚洲午夜精品一区二区公牛电影院| 人妻无码久久一区二区三区免费|