锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲中久无码永久在线观看同,亚洲国产精品午夜电影,国产成人亚洲精品91专区高清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.

涔熻浣犱細濂囨紝涓轟綍鎵句簡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 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲成AV人片在线观看| 免费日本黄色网址| 亚洲国产一区二区a毛片| 中文在线观看免费网站| 超清首页国产亚洲丝袜| 五月天婷婷免费视频| 久久久久亚洲精品天堂久久久久久 | jzzjzz免费观看大片免费| 国产成人精品曰本亚洲79ren| 人妻仑乱A级毛片免费看| 久久久久亚洲精品天堂久久久久久| 中文在线日本免费永久18近| 亚洲成A∨人片在线观看不卡| 99re在线这里只有精品免费| 亚洲国产理论片在线播放| 最近免费中文字幕大全视频| 午夜在线a亚洲v天堂网2019| 国产网站在线免费观看| a一级爱做片免费| 色噜噜综合亚洲av中文无码| 免费视频专区一国产盗摄| 亚洲成a∨人片在无码2023 | 四虎www免费人成| 免费人成又黄又爽的视频在线电影| 国产亚洲精久久久久久无码AV| 未满十八18禁止免费无码网站| 国产成人精品日本亚洲专一区| 日本大片在线看黄a∨免费| 又粗又长又爽又长黄免费视频 | 亚洲日韩中文字幕在线播放| 精品无码国产污污污免费网站| 久久综合久久综合亚洲| 亚洲精品无码你懂的网站| 99久久久国产精品免费牛牛四川| 亚洲真人无码永久在线观看| 亚洲一区二区三区国产精品| 亚洲免费观看网站| 午夜免费国产体验区免费的| 337p日本欧洲亚洲大胆色噜噜| 国产精品四虎在线观看免费| 国产在线精品免费aaa片|