In struts config

<form-bean name="Form1" type="org.apache.struts.validator.DynaValidatorForm" dynamic="true">
       <form-property name="netRevenue" type="java.lang.Double"/>
.............................
..............................
......................
</form-bean>

In prepare action I am not doing anything with the data.

IN JSP
<html:text name="Form1" property="netRevenue" />


validation.xml
           <field property="netRevenue" depends="required,double">
               <msg name="required" key="lbl.required"/>
               <msg name="double" key="lbl.notvalid"/>
           </field>

Dispatch action :
public ActionForward save(ActionMapping mapping,
         ActionForm form,
         HttpServletRequest request,
         HttpServletResponse response)
         throws IOException, ServletException {
       DynaValidatorForm frm = (DynaValidatorForm)form;

ActionMessages messages = (ActionMessages)frm.validate( mapping, request );
       if ( messages != null && !messages.isEmpty() ) {
           saveErrors(request, messages);
           setUp(request, frm);
           return (mapping.findForward("validationFailed"));
       }else {
           if(isTokenValid(request, true)) {
               //save
           }
       }

       return mapping.findForward("successSave");
   }


When the page get displayed the value in the textfield for netRevenue is Blank i.e the textfield in empty.

When I debug and see netRevenue value is null.

But when the click a submit button the value is changed to 0.0. The textfield has 0.0 value in it.

When I debug, when it comes to the very first statement of save method before validating itself in Dispatch action i.e
DynaValidatorForm frm = (DynaValidatorForm)form;

itself the value of the netRevenue is 0.0 instead of null.

Not sure why it's null before and 0.0 when I validate.

can someone explain me why it's so? and how to make the values be same before and after clicking on submit button save.

Thanks.

_________________________________________________________________
Don’t just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to