You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Skip Hollowell <sk...@hotmail.com> on 2004/04/05 19:14:19 UTC

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


Re: Problem with DynaValidatorForm

Posted by Skip Hollowell <sk...@hotmail.com>.
Not specifically.  A lot of the examples I found over the past few days deal
with Validator in realtion to Actions and Forms, but not DynaValidator
stuff.  'Strutting with Struts' had some great information, but didn't
explain it's examples completely, and even had inaccuracies, especially with
regards to the input on the action mapping (it didn't list an input, even
when it changed the validate to True).  You immediately find out it is
required, but examples should at least show correct strutcture.

Thanks Adam.

Skip Hollowell


"Adam Hardy" <ah...@cyberspaceroad.com> wrote in message
news:4072C03D.7040907@cyberspaceroad.com...
> Good point. I'll put some up there when I get a moment later.
>
> What do you mean about 'path relate to bean'? Are you talking
> ValidatorActionForm?
>
> On 04/06/2004 03:03 PM Skip Hollowell wrote:
> > Adam,
> >
> > I like seeing all the steps listed in there, but some examples are what
the
> > new user like myself needs.  Specificially, what is the path and the
input.
> > Can they be a mapping, or do they have to be a physical file.  What if I
am
> > using tiles, can the path or input  be a Tile definition?  How does the
path
> > relate to the bean or vice versa.  These are the things I had to
practice
> > with through trial and error, and usenet, of course.
> >
> > And thanks for all your help.
> >
> > Skip Hollowell




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


Re: Problem with DynaValidatorForm

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Good point. I'll put some up there when I get a moment later.

What do you mean about 'path relate to bean'? Are you talking 
ValidatorActionForm?

On 04/06/2004 03:03 PM Skip Hollowell wrote:
> Adam,
> 
> I like seeing all the steps listed in there, but some examples are what the
> new user like myself needs.  Specificially, what is the path and the input.
> Can they be a mapping, or do they have to be a physical file.  What if I am
> using tiles, can the path or input  be a Tile definition?  How does the path
> relate to the bean or vice versa.  These are the things I had to practice
> with through trial and error, and usenet, of course.
> 
> And thanks for all your help.
> 
> Skip Hollowell
> "Adam Hardy" <ah...@cyberspaceroad.com> wrote in message
> news:4071BCA9.8030600@cyberspaceroad.com...
> 
>>Done the same sort of time-wasting myself just recently with the
>>validator. My mistake was to forget to upgrade the validator-rules.xml.
>>
>>I thought I would try to help with the docs by writing out the setup
>>steps on the wiki. Perhaps if you could look over it and see if there's
>>anything I missed:
>>
>>http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorSetup
>>
>>Sorry it came just a bit too late to help you.
>>
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


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


Re: Problem with DynaValidatorForm

Posted by Skip Hollowell <sk...@hotmail.com>.
Adam,

I like seeing all the steps listed in there, but some examples are what the
new user like myself needs.  Specificially, what is the path and the input.
Can they be a mapping, or do they have to be a physical file.  What if I am
using tiles, can the path or input  be a Tile definition?  How does the path
relate to the bean or vice versa.  These are the things I had to practice
with through trial and error, and usenet, of course.

And thanks for all your help.

Skip Hollowell
"Adam Hardy" <ah...@cyberspaceroad.com> wrote in message
news:4071BCA9.8030600@cyberspaceroad.com...
> Done the same sort of time-wasting myself just recently with the
> validator. My mistake was to forget to upgrade the validator-rules.xml.
>
> I thought I would try to help with the docs by writing out the setup
> steps on the wiki. Perhaps if you could look over it and see if there's
> anything I missed:
>
> http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorSetup
>
> Sorry it came just a bit too late to help you.
>




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


Re: Problem with DynaValidatorForm

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Done the same sort of time-wasting myself just recently with the 
validator. My mistake was to forget to upgrade the validator-rules.xml.

I thought I would try to help with the docs by writing out the setup 
steps on the wiki. Perhaps if you could look over it and see if there's 
anything I missed:

http://nagoya.apache.org/wiki/apachewiki.cgi?ValidatorSetup

Sorry it came just a bit too late to help you.

On 04/05/2004 08:39 PM Skip Hollowell wrote:
> Son of a gun.  As my gramma would used to say, "Ain't that a pip?"
> 
> I guess I just have to ask myself  how I missed that part in the tags and
> validator documentation.
> 
> Thanks a million, Adam and Niall.  3 days down the drain, but you probably
> saved me at least 3 more.
> 
> Skip Hollowell
> 
> "Niall Pemberton" <ni...@blueyonder.co.uk> wrote in message
> news:008901c41b39$c00538b0$a8ad2b52@DELL1800...
> 
>>The validation is done before it calls the action's execute method - so if
>>you get validation errors you won't see the debug output you put into your
>>action - it forwards to what you defined in the "input" parameter before
>>that.
>>
>>Sounds to me like your validation is working - as Adam said - put an
>><errors/> tag on your form and you should see the errors.
>>
>>Niall
>>
>>----- Original Message ----- 
>>From: "Skip Hollowell" <sk...@hotmail.com>
>>To: <us...@struts.apache.org>
>>Sent: Monday, April 05, 2004 6:53 PM
>>Subject: Re: Problem with DynaValidatorForm
>>
>>
>>
>>>/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" <ni...@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" <sk...@hotmail.com>
>>>>To: <us...@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
>>>
>>>
>>>
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


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


Re: Problem with DynaValidatorForm

Posted by Skip Hollowell <sk...@hotmail.com>.
Son of a gun.  As my gramma would used to say, "Ain't that a pip?"

I guess I just have to ask myself  how I missed that part in the tags and
validator documentation.

Thanks a million, Adam and Niall.  3 days down the drain, but you probably
saved me at least 3 more.

Skip Hollowell

"Niall Pemberton" <ni...@blueyonder.co.uk> wrote in message
news:008901c41b39$c00538b0$a8ad2b52@DELL1800...
> The validation is done before it calls the action's execute method - so if
> you get validation errors you won't see the debug output you put into your
> action - it forwards to what you defined in the "input" parameter before
> that.
>
> Sounds to me like your validation is working - as Adam said - put an
> <errors/> tag on your form and you should see the errors.
>
> Niall
>
> ----- Original Message ----- 
> From: "Skip Hollowell" <sk...@hotmail.com>
> To: <us...@struts.apache.org>
> Sent: Monday, April 05, 2004 6:53 PM
> Subject: Re: Problem with DynaValidatorForm
>
>
> > /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" <ni...@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" <sk...@hotmail.com>
> > > To: <us...@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
> >
> >
> >




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


Re: Problem with DynaValidatorForm

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
The validation is done before it calls the action's execute method - so if
you get validation errors you won't see the debug output you put into your
action - it forwards to what you defined in the "input" parameter before
that.

Sounds to me like your validation is working - as Adam said - put an
<errors/> tag on your form and you should see the errors.

Niall

----- Original Message ----- 
From: "Skip Hollowell" <sk...@hotmail.com>
To: <us...@struts.apache.org>
Sent: Monday, April 05, 2004 6:53 PM
Subject: Re: Problem with DynaValidatorForm


> /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" <ni...@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" <sk...@hotmail.com>
> > To: <us...@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
>
>
>



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


Re: Problem with DynaValidatorForm

Posted by Skip Hollowell <sk...@hotmail.com>.
/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" <ni...@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" <sk...@hotmail.com>
> To: <us...@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


Re: Problem with DynaValidatorForm

Posted by Skip Hollowell <sk...@hotmail.com>.
I do not currently have any error tags in my JSP.  I was hoping to actually
see the validation work in the server logs first, then work on spitting out
messages as appropriate to the user.

Skip Hollowell

"Adam Hardy" <ah...@cyberspaceroad.com> wrote in message
news:40719B07.9080105@cyberspaceroad.com...
> Did you forget the errors tag?
>
> Adam
>
> On 04/05/2004 07:44 PM Niall Pemberton wrote:
> > 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" <sk...@hotmail.com>
> > To: <us...@struts.apache.org>
> > Sent: Monday, April 05, 2004 6:14 PM
> > Subject: Problem with DynaValidatorForm
> >




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


Re: Problem with DynaValidatorForm

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Did you forget the errors tag?

Adam

On 04/05/2004 07:44 PM Niall Pemberton wrote:
> 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" <sk...@hotmail.com>
> To: <us...@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
> 
> 


-- 
struts 1.2 + tomcat 5.0.19 + java 1.4.2
Linux 2.4.20 Debian


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


Re: Problem with DynaValidatorForm

Posted by Niall Pemberton <ni...@blueyonder.co.uk>.
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" <sk...@hotmail.com>
To: <us...@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