[Seasar-user:7341] メソッドごとのValidationについて(S2Struts)
Ogino Yosihko
[E-MAIL ADDRESS DELETED]
2007年 4月 18日 (水) 19:14:55 JST
$B$$$D$b$*@$OC$K$J$C$F$*$j$^$9!#(B
$B2.Ln$H?=$7$^$9!#(B
$B2?EY$b?=$7Lu$4$6$$$^$;$s!#(B
$BJ8;z2=$1$7$F$$$?$h$&$J$N$G!"(B
$B:FEY%a!<%k$5$;$F$$$?$@$$$F$$$k$N$G$9$,!"(B
$B$^$?2=$1$F$$$?$i!"?=$7Lu$4$6$$$^$;$s!#(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
$BFC$K(Bs2struts:submit$B%?%0$N(Bproperty$[E-MAIL ADDRESS DELETED]$r;XDj$7$F$$$k$N$G$9$,!"(B
$BLdBj$J$$$7$g$&$+!#(B
$BB>$K$*A&$a$9$kJ}K!$,$"$j$^$7$?$i!"(B
$B$465<x$$$?$@$1$k$H!"$"$j$,$?$$$G$9!#(B
$B$*<j?t$G$9$,!"$h$m$7$/$*4j$$CW$7$^$9!#(B
_________________________________________________________________
$B%a%C%;%s%8%c!<H/%"%$%I%k$H$N%3%i%\<L??=8$r%A%'%C%/(B
http://campaign.live.jp/dizon/
Seasar-user メーリングリストの案内