commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From javaant <arun.kis...@hurix.com>
Subject Re: partial bean submission with SimpleFormController
Date Mon, 30 Jul 2007 14:03:52 GMT

i think i got the soln for this.......
what we need to hav is 
1.a hidden field page in our jsp
<spring:bind path="person.page">
<input type="hidden" name="page" value="0" />
</spring:bind>


this wil be used for assigning no. to  the pages

2.use validwhen in the validator.xml


if anybody needs more explanation,feel free to mail me.
here is an example:-

                                person1.jsp
                                -------------

<%@ page session="true" %>

<%@ include file="/WEB-INF/jsp/taglibs.jsp" %>

<c:set var="ctx" value="${rc.contextPath}"/>

<html>
<body>

<h3>Personal informations1</h3>

<spring:bind path="person.*">
    
        <c:out value="${status.value}"/>
        
    
</spring:bind>

<form action="" method="post" >
<spring:bind path="person.page">
<input type="hidden" name="page" value="0" />
</spring:bind>
        <table>
        
            <tr>
                <td><fmt:message key="person.first.name"/></td>
                <td>
                    <spring:bind path="person.firstName">
                        <input type="text" name="firstName" value="<c:out
value="${status.value}"/>" size="15" maxlength="60"/>
                        <c:out value="${status.errorMessage}"/>
                    </spring:bind>
                </td>
            </tr>
            <tr>
                <td><fmt:message key="person.last.name"/></td>
                <td>
                    <spring:bind path="person.lastName">
                        <input type="text" name="lastName" value="<c:out
value="${status.value}"/>" size="15" maxlength="60"/>
                        <c:out value="${status.errorMessage}"/>
                    </spring:bind>
                </td>
            </tr>
            </table>

        <br/>

        <input type="submit" value="<fmt:message key="form.submit"/>"/>
	
    </form>

</body>

</html>


                        person2.jsp
                    ------------------------

<%@ page session="true" %>

<%@ include file="/WEB-INF/jsp/taglibs.jsp" %>

<c:set var="ctx" value="${rc.contextPath}"/>

<html>





<body>

<h3>Personal informations2</h3>

<spring:bind path="person.*">
    
        <c:out value="${status.value}"/>
        
    
</spring:bind>

<form action="person2.html"  method="post" >
<spring:bind path="person.page">
<input type="hidden" name="page" value="1" />
</spring:bind>
        <table>
        		<tr>
                <td><fmt:message key="person.email"/></td>
                <td>
                    <spring:bind path="person.email">
                        <input type="text" name="email" value="<c:out
value="${status.value}"/>" size="15" maxlength="60"/>
                        <c:out value="${status.errorMessage}"/>
                    </spring:bind>
                </td>
            </tr>
           
            
           
            <tr>
                <td><fmt:message key="person.password"/></td>
                <td>
                    <spring:bind path="person.password">
                        <input type="password" name="password" value="<c:out
value="${status.value}"/>" size="15" maxlength="60"/>
                        <c:out value="${status.errorMessage}"/>
                    </spring:bind>
                </td>
            </tr>
            <tr>
                <td><fmt:message key="person.verify.password"/></td>
                <td>
                    <spring:bind path="person.verifyPassword">
                        <input type="password" name="verifyPassword"
value="<c:out value="${status.value}"/>" size="15" maxlength="60"/>
                        <c:out value="${status.errorMessage}"/>
                    </spring:bind>
                </td>
            </tr>

        </table>

        <br/>

        <input type="submit" value="<fmt:message key="form.submit"/>"/>

    </form>

</body>

</html>


                               validator.xml
                              --------------

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE form-validation PUBLIC 
    "-//Apache Software Foundation//DTD Commons Validator Rules
Configuration 1.1//EN" 
    "http://jakarta.apache.org/commons/dtds/validator_1_1.dtd">

<form-validation>
 <formset>

        <form name="personData">
<field property="page" >
</field>
			<field property="firstName"  depends="validwhen" >
				<arg0 key="person.first.name" />
				<var>
					<var-name>test</var-name>
					<var-value>((page=="1") or (*this* != null)) </var-value>
				</var>
		
			</field>
			<field property="lastName"  depends="validwhen">
				<arg0 key="person.last.name" />
				<var>
					<var-name>test</var-name>
					<var-value>((page=="1") or (*this* != null)) </var-value>
				</var>
		
			</field>
			<field property="email"  depends="validwhen">
				<arg0 key="person.email" />
				<var>
					<var-name>test</var-name>
					<var-value>((page=="0") or (*this* != null)) </var-value>
				</var>
			</field>
            <field property="password"  depends="validwhen">
				<arg0 key="person.password" />
				<var>
					<var-name>test</var-name>
					<var-value>((page=="0") or (*this* != null)) </var-value>
				</var>
			
       
			</field>
			<field property="verifyPassword" depends="validwhen">
				<arg0 key="person.password.not.matching" />
				<var>
					<var-name>test</var-name>
					<var-value>(*this* == password)</var-value>
				</var>
			</field>
        </form>
    </formset>

    

 <formset>

        <form name="personData1">
			<field property="firstName" depends="required">
				<arg0 key="person.first.name" />
			</field>

			<field property="lastName" depends="required">
				<arg0 key="person.last.name" />
			</field>
			</form>
</formset>
<formset>
		<form name="personData2">
    	<field property="email" depends="required,email">
				<arg0 key="person.email" />
			</field>
            <field property="password" depends="required">
				<arg0 key="person.password" />
			</field>
			<field property="verifyPassword" depends="validwhen">
				<arg0 key="person.password.not.matching" />
				<var>
					<var-name>test</var-name>
					<var-value>(*this* == password)</var-value>
				</var>
			</field>
        </form>
</formset>


</form-validation>
                         
-- 
View this message in context: http://www.nabble.com/partial-bean-submission-with-SimpleFormController-tf4151563.html#a11864262
Sent from the Commons - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message