[Seasar-user:7310] メソッドごとのValidaionについて(S2Struts)

Ogino Yosihko [E-MAIL ADDRESS DELETED]
2007年 4月 16日 (月) 18:40:03 JST


$B$$$D$b$*@$OC$K$J$C$F$*$j$^$9!#(B
$B2.Ln$H?=$7$^$9!#(B

s2Struts$B%?%0!"(BStruts$B$N(Bvalidation.xml$B$r;H$C$F!"(B
$B%a%=%C%I$4$H$N(BValidation$B$r9T$*$&$H$7$F$$$^$9!#(B

$B0J2<$NJ}K!$G!"$G$-$?$N$G$9$,!"LdBj$J$$$G$7$g$&$+!#(B

$B#1!%(BActionForm
$B!!-!(Borg.apache.struts.validator.ValidatorForm $B$r7Q>5$7$?(BActionForm$B$r:[E-MAIL ADDRESS DELETED](B
$B!!-"(Bcommand$B%W%m%Q%F%#$rDj5A(B
$B!!-#(BgetValidationKey()$B%a%=%C%I$NDI2C(B

$B!!(Bpublic class DepartmentForm extends ValidatorForm{
 $B!!!&!&!&!&!&(B   
    protected String command;
    public String getCommand() {
        return command;
    }
    public void setCommand(String command)
    {
        this.command = command;
    }
    public String getValidationKey(ActionMapping mapping, 
HttpServletRequest request) {
       return super.getValidationKey(mapping, request) + "_" + 
this.command;
    }

$B#2!%(BAction$BDj?t%"%N%F!<%7%g%s$[E-MAIL ADDRESS DELETED](B

$B!!!!(Bpublic static final String ACTION = "name=departmentForm,
$B!!!!!!(B $B!!!!(Bscope=request,   parameter=command, 
$B!!!!!!!!!!!!(Bvalidate=true ,  input=error.jsp ";

$B#3!%(Bvalidation.xml$B$[E-MAIL ADDRESS DELETED](B
$B!!!!(BForm$BL>$N8e$K%\%?%sL>$[E-MAIL ADDRESS DELETED](B

$B!!!!(B<form name="departmentForm_Search">
        <field  property="deptId$B!H(B depends="required">
            <arg0 key="$BIt=p(BID" resource="false" />
        </field>
$B!!!!(B</form>
$B!!!!(B<form name="departmentForm_Update">
        <field  property="deptId"  depends="mask">
            <arg0 key="$BIt=p(BID" resource="false" />
            <var>
                <var-name>mask</var-name>
                <var-value>^[0-9a-zA-Z]*$</var-value>
            </var>
    </field>
$B!!!!(B</form>

$B#4!%(BJSP
$B!!!!(B<s2struts:submit action="#{departmentAction.goSearch}" 
property="command" >
$B!!!!!!!!!!!!!!!!(BSearch</s2struts:submit>
$B!!!!(B<s2struts:submit action="#{departmentAction.goUpdate}" 
property="command" >
$B!!!!!!!!!!!!!!!!(BUpdate</s2struts:submit>

$B$3$NJ}K!$G>-MhE*$KLdBj$,$"$j$=$&$G$7$?$i!"65$($F$$$?$@$1$J$$$G$7$g$&$+!#(B

$B$*<j?t$G$9$,!"$h$m$7$/$*4j$$CW$7$^$9!#(B

_________________________________________________________________
$B$3$N=U%V%m%0$r$O$8$a$??MI,8+!*$+$o$$$/$F?7463P$N%V%m%0%Q!<%D!V(BCAROL$B!W(B 
http://www.live-carol.jp/ 




Seasar-user メーリングリストの案内