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

📄 lazyvalidatorform.html

📁 struts api,学习使用struts必备的文档
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Mar 09 15:31:25 GMT 2006 -->
<TITLE>
Apache Struts API Documentation: Class  LazyValidatorForm
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">

<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/LazyValidatorForm.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../org/apache/struts/validator/FieldChecks.html"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../../org/apache/struts/validator/Resources.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="LazyValidatorForm.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
  SUMMARY: &nbsp;INNER&nbsp;|&nbsp;<A HREF="#fields_inherited_from_class_org.apache.struts.validator.BeanValidatorForm">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: &nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->

<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
org.apache.struts.validator</FONT>
<BR>
Class  LazyValidatorForm</H2>
<PRE>
java.lang.Object
  |
  +--<A HREF="../../../../org/apache/struts/action/ActionForm.html">org.apache.struts.action.ActionForm</A>
        |
        +--<A HREF="../../../../org/apache/struts/validator/ValidatorForm.html">org.apache.struts.validator.ValidatorForm</A>
              |
              +--<A HREF="../../../../org/apache/struts/validator/BeanValidatorForm.html">org.apache.struts.validator.BeanValidatorForm</A>
                    |
                    +--<B>org.apache.struts.validator.LazyValidatorForm</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD>org.apache.commons.beanutils.DynaBean, java.io.Serializable</DD>
</DL>
<HR>
<DL>
<DT>public class <B>LazyValidatorForm</B><DT>extends <A HREF="../../../../org/apache/struts/validator/BeanValidatorForm.html">BeanValidatorForm</A></DL>

<P>
<p>Struts <i>Lazy</i> <code>ActionForm</code> which <i>wraps</i> a <code>LazyDynaBean</code>.</p> <p>There isn't really that much to this implementation as most of the <i>lazy</i> behaviour is in     <code>LazyDynaBean</code> and <i>wrapping</i> the <code>LazyDynaBean<code> is handled in the parent    <code>BeanValidatorForm</code>. The only thing it really does is populate <i>indexed</i> properties    which are a <code>List<code> type with a <code>LazyDynaBean<code> in the <code>get(name, index)</code>    method.</p> <p><i>Lazy</i> DynaBeans provide several types of <i>lazy</i> behaviour:</p> <ul>     <li><b><i>lazy</i> property addition</b> - properties which do not exist         are automatically added.</li>     <li><b><i>lazy</i> List facilities</b> - automatically <i>grows</i> a <code>List</code> or         <code>Array</code> to accomodate the index value being set.</li>     <li><b><i>lazy</i> List creation</b> - automatic creation of a <code>List</code>         or <code>Array</code> for <i>indexed</i> properties, if it doesn't exist.</li>     <li><b><i>lazy</i> Map creation</b> - automatic creation of a <code>Map</code>         for <i>mapped</i> properties, if it doesn't exist.</li> </ul> <p>Using this <i>lazy</i> <code>ActionForm</code> means that you don't have to define the ActionForm's     properties in the <code>struts-config.xml</code>. However, a word of warning, everything in the     Request gets populated into this <code>ActionForm</code> circumventing the normal <i>firewall</i>    function of Struts forms. Therefore you should only <i>take out</i> of this form properties you expect    to be there rather than blindly populating all the properties into the business tier.</p> <p>Having said that it is not necessary to pre-define properties in the <code>struts-config.xml</code>, it is    useful to sometimes do so for <i>mapped</i> or <i>indexed</i> properties. For example, if you want to use    a different <code>Map<code> implementation from the default <code>HashMap</code> or an array for indexed    properties, rather than the default <code>List</code> type:</p>  <pre><code>   &lt;form-bean name="myForm" type="org.apache.struts.validator.LazyValidatorForm"&gt;     &lt;form-property name="myMap" type="java.util.TreeMap" /&gt;     &lt;form-property name="myBeans" type="org.apache.commons.beanutils.LazyDynaBean[]" /&gt;   &lt;/form-bean&gt; </code></pre> <p>Another reason for defining <i>indexed</i> properties in the <code>struts-config.xml</code> is that    if you are validating indexed properties using the Validator and none are submitted then the indexed    property will be <code>null</code> which causes validator to fail. Pre-defining them in the    <code>struts-config.xml</code> will result in a zero-length indexed property (array or List) being    instantiated, avoiding an issue with validator in that circumstance.</p> <p>This implementation validates using the ActionForm <i>name</i>. If you require a version that    validates according to the <i>path</i> then it can be easily created in the following manner:</p>  <pre><code>    public class MyLazyForm extends LazyValidatorForm {        public MyLazyForm () {            super();            setPathValidation(true);        }    } </code></pre> <p>Rather than using this class, another alternative is to either use a <code>LazyDynaBean</code> or    custom version of <code>LazyDynaBean</code> directly. Struts now automatically <i>wraps</i> objects    which are not <code>ActionForms</code> in a <code>BeanValidatorForm</code>. For example:</p>  <pre><code>   &lt;form-bean name="myForm" type="org.apache.commons.beanutils.LazyDynaBean"&gt;     &lt;form-property name="myBeans" type="org.apache.commons.beanutils.LazyDynaBean[]" /&gt;   &lt;/form-bean&gt; </code></pre>
<P>
<DL>
<DT><B>Since: </B><DD>Struts 1.2.6</DD>
<DT><B>Version: </B><DD>$Rev: 56698 $ $Date: 2004-11-05 21:11:41 +0000 (Fri, 05 Nov 2004) $</DD>
<DT><B>See Also: </B><DD><a href="http://jakarta.apache.org/commons/beanutils/apidocs/org/apache/commons/beanutils/package-summary.html#dynamic.lazy">Commons BeanUtils JavaDoc</a>, <A HREF="../../../../serialized-form.html#org.apache.struts.validator.LazyValidatorForm">Serialized Form</A></DL>
<HR>

<P>
<!-- ======== INNER CLASS SUMMARY ======== -->


<!-- =========== FIELD SUMMARY =========== -->

<A NAME="fields_inherited_from_class_org.apache.struts.validator.BeanValidatorForm"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class org.apache.struts.validator.<A HREF="../../../../org/apache/struts/validator/BeanValidatorForm.html">BeanValidatorForm</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/struts/validator/BeanValidatorForm.html#dynaBean">dynaBean</A>, <A HREF="../../../../org/apache/struts/validator/BeanValidatorForm.html#logger">logger</A>, <A HREF="../../../../org/apache/struts/validator/BeanValidatorForm.html#pathValidation">pathValidation</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_org.apache.struts.validator.ValidatorForm"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class org.apache.struts.validator.<A HREF="../../../../org/apache/struts/validator/ValidatorForm.html">ValidatorForm</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/struts/validator/ValidatorForm.html#log">log</A>, <A HREF="../../../../org/apache/struts/validator/ValidatorForm.html#page">page</A>, <A HREF="../../../../org/apache/struts/validator/ValidatorForm.html#validatorResults">validatorResults</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="fields_inherited_from_class_org.apache.struts.action.ActionForm"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Fields inherited from class org.apache.struts.action.<A HREF="../../../../org/apache/struts/action/ActionForm.html">ActionForm</A></B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../../org/apache/struts/action/ActionForm.html#multipartRequestHandler">multipartRequestHandler</A>, <A HREF="../../../../org/apache/struts/action/ActionForm.html#servlet">servlet</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<!-- ======== CONSTRUCTOR SUMMARY ======== -->

<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/struts/validator/LazyValidatorForm.html#LazyValidatorForm()">LazyValidatorForm</A></B>()</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default Constructor which creates a <code>LazyDynaBean</code> to <i>back</i> this form.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../org/apache/struts/validator/LazyValidatorForm.html#LazyValidatorForm(org.apache.commons.beanutils.DynaBean)">LazyValidatorForm</A></B>(org.apache.commons.beanutils.DynaBean&nbsp;bean)</CODE>

<BR>

⌨️ 快捷键说明

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