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" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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"
/>
platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_2.6.200/xslt/</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 </td> <td align="left"><html:text property="parmVRUCode" size="10" maxlength="10"/></td> <td> </td> </tr>
PrepaidDynaAction.java: ================================================ /Created by MyEclipse Struts // XSL source (default):
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- struts 1.2 + tomcat 5.0.19 + java 1.4.2 Linux 2.4.20 Debian
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]