struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Skip Hollowell" <skipda...@hotmail.com>
Subject Re: Problem with DynaValidatorForm
Date Mon, 05 Apr 2004 17:53:45 GMT
/PrepaidAccountInfo.do is the same form as prepaid.do, just a different path
name.  I couldn't get them to use the same path name.  The forward is
working, and it 'reloads' the form, but I get no validation issues.

The funny thing is I don't think the PrepaidDynaAction is being called
either.  None of my debug messages for this show up in the log file.  So I
guess I don't understand what is really being called.  Probably the default
dynaValidationAction instead, as defined in the bean for struts config?

Just when I thought I had a handle on this  I have lost it again.  I was
going like gangbusters with regular forms and actions and then decided to
'simplify' based on the number of forms in the syste, (30 at last count).

Skip Hollowell

"Niall Pemberton" <niall.pemberton@blueyonder.co.uk> wrote in message
news:005801c41b35$a0733d20$a8ad2b52@DELL1800...
> With your configuration validator will forward to /PrepaidAccountInfo.do
if
> validation errors are found - because thats what you set up as the "input"
> in your "/prepaid" action mapping - is that not happening?
>
> Niall
>
> ----- Original Message ----- 
> From: "Skip Hollowell" <skipdaddy@hotmail.com>
> To: <user@struts.apache.org>
> Sent: Monday, April 05, 2004 6:14 PM
> Subject: Problem with DynaValidatorForm
>
>
> > OK, I have a lot of things going on in my app, and something
> > is cancelling out my Validation, and I don't know what.    I load
> > the PrepaidAccoundInfo.do action, and the Tiles based
> > page loads properly.  I am able to submit the form on this
> > page, and it loads the prepaid.do action just fine, and r
> > emembers the bean info and redisplays it properly, but the
> > data is not validated.  I can omit any of the required fields,
> > and the AccountNum can be entered as anything, not just an int.
> >
> > I have tryed renaming some of my paths, but they all appear to
> > be correct.  Is the SAIF Intereceptor causing the problem?
> > My next test will be to remove it, but I was wondering if anyone
> > had incorporated all of these things together before.
> >
> > - DynaValidatorForm (I need to validate my user entered data, and
> > I am using lots of forms throughout the system)
> > - SAIF (I Want to be able to perform some common logic on all the
> > actions, for user authentication and authroization type functionality
> > mainly.  Tabs and actions will be available based upon what rights
> >  the user has)
> > -  Tiles for easy page creation (tabBar, header, body, footer)
> >
> > Thoughts?  Help? Possible alternatatives?  All would be greatly
> > appreciated.
> >
> > Skip Hollowell
> >
> >
> > struts-config.xml:
> > =========================================================
> >  <form-beans >
> >   <form-bean name="registerForm"
> type="skipdaddy.struts.form.RegisterForm">
> >   </form-bean>
> >   <form-bean name="prepaidDynaValidatorForm"
> > type="org.apache.struts.validator.DynaValidatorForm">
> >     <form-property name="parmVRUCode" type="java.lang.String" />
> >     <form-property name="parmAccountNum" type="java.lang.String" />
> >     <form-property name="parmDnis" type="java.lang.String" />
> >   </form-bean>
> >  </form-beans>
> >
> >  <global-forwards >
> >    <forward name="PrepaidAccountInfo" path="/PrepaidAccountInfo.do" />
> >  </global-forwards>
> >
> >  <action-mappings >
> >   <action path="/prepaid"
> >    type="skipdaddy.struts.action.PrepaidDynaAction"
> >    name="prepaidDynaValidatorForm"
> >    input="/PrepaidAccountInfo.do"
> >    scope="session"
> >    validate="true" >
> >    <forward name="success" path="/PrepaidAccountInfo.do" />
> >    <forward name="failure" path="/failure.html" />
> >   </action>
> >
> >   <action
> >    path="/PrepaidAccountInfo"
> >    type="org.apache.struts.actions.ForwardAction"
> >    parameter=".prepaid.accountInfoLayout" />
> >
> >  </action-mappings>
> >
> >  <plug-in className="org.apache.struts.tiles.TilesPlugin">
> >   <set-property property="definitions-config"
> > value="/WEB-INF/tiles-defs.xml" />
> >   <set-property property="moduleAware" value="true" />
> >   <set-property property="definitions-parser-validate" value="true" />
> >  </plug-in>
> >  <!-- end comment if struts1.0.x -->
> >
> >  <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
> >   <set-property property="pathnames"
value="/WEB-INF/validator-rules.xml,
> > /WEB-INF/validation.xml" />
> >       <set-property property="definitions-debug" value="1" />
> >  </plug-in>
> >
> >    <plug-in className="net.sf.struts.saif.SAIFPlugin">
> >      <set-property property="interceptor-config"
> > value="/WEB-INF/interceptor-config.xml" />
> >    </plug-in>
> >
> >
> > validation.xml:
> > ==============================
> >   <formset>
> >      <form name="prepaidDynaValidatorForm">
> >         <field property="parmVRUCode"
> >                         depends="required">
> >           <arg0 key="prepaid-vru.displayname"/>
> >         </field>
> >         <field property="parmAccountNum"
> >                         depends="required,integer">
> >           <arg0 key="prepaid-pin.displayname"/>
> >         </field>
> >         <field property="parmDnis"
> >                         depends="required,integer">
> >           <arg0 key="prepaid-dnis.displayname"/>
> >         </field>
> >     </form>
> >   </formset>
> >
> >
> > header.jsp (part of my tile)
> > =============================================
> >   <table id="getaccnt" align="center" width="95%">
> >     <html:form action="/prepaid" focus="parmAccountNum">
> >       <html:hidden property="parmAction" value="hld"/>
> >       <tr>
> >         <td id="staticVrucode" align="right">VRUCode&nbsp;</td>
> >         <td align="left"><html:text property="parmVRUCode" size="10"
> > maxlength="10"/></td>
> >         <td>&nbsp;</td>
> >       </tr>
> >
> > PrepaidDynaAction.java:
> > ================================================
> > /Created by MyEclipse Struts
> > // XSL source (default):
> >
>
platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_2.6.200/xslt/
> > JavaClass.xsl
> >
> > package skipdaddy.struts.action;
> >
> > import javax.servlet.http.HttpServletRequest;
> > import javax.servlet.http.HttpServletResponse;
> >
> > import org.apache.struts.action.ActionForm;
> > import org.apache.struts.action.ActionForward;
> > import org.apache.struts.action.ActionMapping;
> > import org.apache.struts.tiles.actions.TilesAction;
> > import org.apache.struts.validator.DynaValidatorForm;
> >
> > /**
> >  * MyEclipse Struts
> >  * Creation date: 01-13-2004
> >  *
> >  */
> > public class PrepaidDynaAction extends TilesAction
> > {
> >
> >   // --------------------------------------------------------- Instance
> > Variables
> >
> >   // --------------------------------------------------------- Methods
> >
> >   /**
> >    * Method execute
> >    * @param ActionMapping mapping
> >    * @param ActionForm form
> >    * @param HttpServletRequest request
> >    * @param HttpServletResponse response
> >    * @return ActionForward
> >    * @throws Exception
> >    */
> >   public ActionForward execute(
> >     ActionMapping mapping,
> >     ActionForm form,
> >     HttpServletRequest request,
> >     HttpServletResponse response)
> >     throws Exception
> >   {
> >     //String parmAccountNum = prepaidForm.getParmAccountNum();
> >     // String parmDnis = prepaidForm.getParmDnis();
> >     //String parmVruCode = prepaidForm.getParmVRUCode();
> >
> >     DynaValidatorForm prepaidDynaValidatorForm =
(DynaValidatorForm)form;
> >     System.out.println(prepaidDynaValidatorForm.toString());
> >     String parmAccountNum = request.getParameter("parmAccountNum");
> >     String parmDnis = request.getParameter("parmDnis");
> >     String parmVruCode = request.getParameter("parmVRUCode");
> >
> >     System.out.println(
> >       "Entering the ActionForward in PrepaidAction"
> >         + request.getParameter("parmAccountNum"));
> >     if (parmAccountNum.equals(parmAccountNum))
> >     {
> >       System.out.println("PrepaidAction: SUCCESS");
> >       return mapping.findForward("success");
> >     }
> >     else
> >     {
> >       System.out.println("PrepaidAction: FAILURE");
> >       return mapping.findForward("failure");
> >     }
> >   }
> > }
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >




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


Mime
View raw message