⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 struts_form.xdt

📁 this is for appfuse1.8 source using strut 1.x, spring and hibernate.
💻 XDT
字号:
package <XDtPackage:packageOf><XDtActionForm:actionFormClass/></XDtPackage:packageOf>;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.ActionMapping;/** * <XDtI18n:getString bundle="xdoclet.modules.apache.struts.ejb.XDocletModulesApacheStrutsEjbMessages" resource="action_form_generated"/> * * @struts.form name="<XDtActionForm:actionFormName/>"  */public class <XDtClass:classOf><XDtActionForm:actionFormClass/></XDtClass:classOf>    extends    <XDtClass:classTagValue tagName="struts.form" paramName="extends" default="org.apache.struts.action.ActionForm" />    implements java.io.Serializable<XDtClass:ifHasClassTag tagName="struts.form" paramName="implements" superclasses="false">, <XDtClass:classTagValue tagName="struts.form" paramName="implements" superclasses="false"/></XDtClass:ifHasClassTag>{<XDtActionForm:forAllFormFields>    <XDtType:ifIsOfType value="return-type" type="java.lang.Boolean,boolean" extent="concrete-type">    protected boolean <XDtMethod:propertyName/>;    </XDtType:ifIsOfType>      <XDtType:ifIsOfType value="return-type" type="java.util.List" extent="concrete-type">    protected transient java.util.List <XDtMethod:propertyName/> = new java.util.ArrayList();    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="java.util.Set" extent="concrete-type">    protected transient java.util.Set <XDtMethod:propertyName/> = new java.util.HashSet();    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="org.appfuse.model.BaseObject">    <XDtVelocity:generator>        #set( $method = $currentMethod.name)        #set( $pojoName = $method.substring(3))        #set( $pojoType = $currentMethod.returnType.getType().getName() )    </XDtVelocity:generator>    protected <XDtVelocity:getVariable name="pojoType"/>Form <XDtMethod:propertyName/> = new <XDtVelocity:getVariable name="pojoType"/>Form();    </XDtType:ifIsOfType>    <XDtType:ifIsNotOfType value="return-type"         type="java.util.List,java.util.Set,org.appfuse.model.BaseObject,java.lang.Boolean,boolean">    protected String <XDtMethod:propertyName/>;    </XDtType:ifIsNotOfType></XDtActionForm:forAllFormFields>    /** <XDtI18n:getString bundle="xdoclet.modules.apache.struts.ejb.XDocletModulesApacheStrutsEjbMessages" resource="form_empty_constructor"/> */    public <XDtClass:classOf><XDtActionForm:actionFormClass/></XDtClass:classOf>() {}<XDtActionForm:forAllFormFields>    <XDtType:ifIsOfType value="return-type" type="java.lang.Boolean,boolean" extent="concrete-type">    public boolean <XDtMethod:getterMethod/>()<XDtMethod:exceptionList/>    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="java.util.List" extent="concrete-type">    public java.util.List <XDtMethod:getterMethod/>()<XDtMethod:exceptionList/>    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="java.util.Set" extent="concrete-type">    public java.util.Set <XDtMethod:getterMethod/>()<XDtMethod:exceptionList/>    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="org.appfuse.model.BaseObject">    <XDtVelocity:generator>        #set( $method = $currentMethod.name)        #set( $pojoName = $method.substring(3))        #set( $pojoType = $currentMethod.returnType.getType().getName() )    </XDtVelocity:generator>    public <XDtVelocity:getVariable name="pojoType"/>Form <XDtMethod:getterMethod/>Form()<XDtMethod:exceptionList/>    </XDtType:ifIsOfType>    <XDtType:ifIsNotOfType value="return-type"         type="java.util.List,java.util.Set,org.appfuse.model.BaseObject,java.lang.Boolean,boolean">    public String <XDtMethod:getterMethod/>()<XDtMethod:exceptionList/>    </XDtType:ifIsNotOfType>    {        return this.<XDtMethod:propertyName/>;    }       /**    <XDtMethod:forAllMethodTags tagName="struts.validator">    * @struts.validator <XDtMethod:methodTagValue tagName="struts.validator"/>    </XDtMethod:forAllMethodTags>    <XDtMethod:forAllMethodTags tagName="struts.validator-args">    * @struts.validator-args <XDtMethod:methodTagValue tagName="struts.validator-args"/>    </XDtMethod:forAllMethodTags>    <XDtMethod:forAllMethodTags tagName="struts.validator-var">    * @struts.validator-var <XDtMethod:methodTagValue tagName="struts.validator-var"/>    </XDtMethod:forAllMethodTags>    <XDtType:ifIsOfType value="return-type" type="org.appfuse.model.BaseObject">    * @struts.validator    </XDtType:ifIsOfType>    */    <XDtType:ifIsOfType value="return-type" type="java.lang.Boolean,boolean" extent="concrete-type">    public void <XDtMethod:setterMethod/>( boolean <XDtMethod:propertyName/> )    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="java.util.List" extent="concrete-type">    public void <XDtMethod:setterMethod/>( java.util.List <XDtMethod:propertyName/> )    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="java.util.Set" extent="concrete-type">    public void <XDtMethod:setterMethod/>( java.util.Set <XDtMethod:propertyName/> )    </XDtType:ifIsOfType>    <XDtType:ifIsOfType value="return-type" type="org.appfuse.model.BaseObject">    public void <XDtMethod:setterMethod/>Form( <XDtVelocity:getVariable name="pojoType"/>Form <XDtMethod:propertyName/> )    </XDtType:ifIsOfType>    <XDtType:ifIsNotOfType value="return-type"         type="java.util.List,java.util.Set,org.appfuse.model.BaseObject,java.lang.Boolean,boolean">    public void <XDtMethod:setterMethod/>( String <XDtMethod:propertyName/> )    </XDtType:ifIsNotOfType>    {        this.<XDtMethod:propertyName/> = <XDtMethod:propertyName/>;    }    <XDtType:ifIsOfType value="return-type" type="org.appfuse.model.BaseObject">    /**      *  Getter/Setter pair so BeanUtil.copyProperties(dest, orig) will work      *  Any properties modified in the web tier should use the get/set<XDtVelocity:getVariable name="pojoName"/>Form      *  methods.     */    public org.appfuse.model.<XDtVelocity:getVariable name="pojoType"/> get<XDtVelocity:getVariable name="pojoName"/>() throws Exception    {        return (org.appfuse.model.<XDtVelocity:getVariable name="pojoType"/>) org.appfuse.util.ConvertUtil.convert(this.<XDtMethod:propertyName/>);    }    public void set<XDtVelocity:getVariable name="pojoName"/>(org.appfuse.model.<XDtVelocity:getVariable name="pojoType"/> <XDtMethod:propertyName/>) throws Exception    {        set<XDtVelocity:getVariable name="pojoName"/>Form((<XDtVelocity:getVariable name="pojoType"/>Form) org.appfuse.util.ConvertUtil.convert(<XDtMethod:propertyName/>));    }    </XDtType:ifIsOfType>    </XDtActionForm:forAllFormFields>    <XDtClass:ifHasClassTag tagName="struts.form" paramName="indexedProperties" value="true"><XDtActionForm:forAllFormFields>    <XDtType:ifIsOfType value="return-type" type="java.util.List" extent="concrete-type">    public void <XDtMethod:setterMethod/>(int index, Object o) {        this.<XDtMethod:propertyName/>.set(index, o);    }    </XDtType:ifIsOfType>        <XDtType:ifIsOfType value="return-type" type="java.util.Set" extent="concrete-type">    public void <XDtMethod:setterMethod/>(Object o) {        this.<XDtMethod:propertyName/>.add(o);    }    </XDtType:ifIsOfType>    </XDtActionForm:forAllFormFields></XDtClass:ifHasClassTag>    <XDtMerge:merge file="xdoclet-<XDtClass:classOf><XDtActionForm:actionFormClass/></XDtClass:classOf>.java">        /* To add non XDoclet-generated methods, create a file named           xdoclet-<XDtClass:classOf><XDtActionForm:actionFormClass/></XDtClass:classOf>.java            containing the additional code and place it in your metadata/web directory.        */    </XDtMerge:merge>        /**     * @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping,     *                                                javax.servlet.http.HttpServletRequest)     */    public void reset(ActionMapping mapping, HttpServletRequest request) {        // reset any boolean data types to false<XDtActionForm:forAllFormFields>        <XDtType:ifIsOfType value="return-type" type="java.lang.Boolean,boolean" extent="concrete-type">        this.<XDtMethod:propertyName/> = false;        </XDtType:ifIsOfType></XDtActionForm:forAllFormFields><XDtClass:ifHasClassTag tagName="struts.form" paramName="indexedProperties" value="true"><XDtActionForm:forAllFormFields>        <XDtType:ifIsOfType value="return-type" type="java.util.List" extent="concrete-type">        <XDtVelocity:generator>        #set( $method = $currentMethod.name)        ## trim off the 'get'        #set( $objectName = $method.substring(3, $method.lastIndexOf('s')))        </XDtVelocity:generator>        this.<XDtMethod:propertyName/> = org.apache.commons.collections.ListUtils.lazyList(new java.util.ArrayList(), new ObjectFactory("<XDtVelocity:getVariable name="objectName"/>"));        </XDtType:ifIsOfType>                <XDtType:ifIsOfType value="return-type" type="java.util.Set" extent="concrete-type">        <XDtVelocity:generator>        #set( $method = $currentMethod.name)        ## trim off the 'get'        #set( $objectName = $method.substring(3, $method.lastIndexOf('s')))        </XDtVelocity:generator>        this.<XDtMethod:propertyName/> = new java.util.HashSet();        </XDtType:ifIsOfType></XDtActionForm:forAllFormFields></XDtClass:ifHasClassTag>    }    <XDtClass:ifHasClassTag tagName="struts.form" paramName="indexedProperties">    /**     * <code>ObjectFactory</code> - used if indexed properties exist on this form.     *     * @see org.apache.commons.collections.ListUtils     */    class ObjectFactory implements org.apache.commons.collections.Factory {        private String name;        /**         * Create a new instance of the specified object         */        public Object create() {            Class c = null;            try {                c = Class.forName("org.appfuse.webapp.form." + name + "Form");                return c.newInstance();            } catch (Exception e) {                System.err.println("Error instantiating class: " + c.getName());                throw new RuntimeException(e);            }        }        public ObjectFactory(String name) {            this.name = name;        }    }    </XDtClass:ifHasClassTag>}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -