aspose file tools*
The moose likes Struts and the fly likes DynaValidtorform Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "DynaValidtorform" Watch "DynaValidtorform" New topic
Author

DynaValidtorform

Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Howdy guys,

I am using the "DynaValidation"form.Everything works fine.
If any field is missing the error message shows up on the reloaded page.
The Problem : it diaplays:----
???en_US.ABCFormPg2.fieldName??? instead of showing
fieldName not found or entered...
I have tried putting <html:html locale="false"> but no difference...

Thanks,
Sahil.
[ May 12, 2004: Message edited by: Sahil Singh ]
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
One More Question :-

When using the ActionError validation,the page is reloaded when either one or more i/p parameters are not entered---fine
But it also clear's other fields which the had been entered right.
How do i repopulate the correctly entered fields .
Thanks in advance.
-Sahil
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hi Guys,
You have never failed me before...need help urgently..

Thanks,
Sahil
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hello....ALOHA....

-Sahil
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Aloha-AloHa Aloha

Thanks,
-Sahil
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

The first problem I'm not sure about.

The second problem sounds like you might be clearing everything out in the reset method.


A good workman is known by his tools.
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
In first problem,
please explain detail of problem agian because your question is ambigurous.... (Locale or error in validattion)


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hi guys thanks for responding and my apologies for not responding earlier.

Now i have one problem of the lot described above.

The Dynavalidator - part.

The pages reloads itself if amy of the parameter of the page is left empty..
It's fine till here.

Also on the top of the page it shows the no. of parameters not entered as
for ex :"3" errors found.

Here is the 1) it does not display which parameter has been not entered.

2)Can i show this error message next to the "input box"n where the user has missed to entered.
3) How to customise my own error messages using DYNAvalidator.

Thanks again,
Sahil
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982

1) it does not display which parameter has been not entered.
3) How to customise my own error messages using DYNAvalidator

I think you have missed the checking using validate(), and did you define the checking rules in the validator.xml?

You can use the validate(ActionMapping mapping, HttpServletRequest request) method to perform the checking:

The super.validate() method defines in DynaValidatorForm checks the form values with the rules in the validator.xml. Then, you can continue to check the values that rules are not easy to be specified in XML files, like field1 is depends on field2 and field3. If field1=0, field2 and field3>10, etc, rules.

The "ERROR NAME" and the message can be customerized.


2)Can i show this error message next to the "input box"n where the user has missed to entered.

NO. The display of error messages, if you use Struts engine and Tiles to do the checking, is always on the top of the page.

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
This link will help you to solve this problem

http://www.manning.com/catalog/view.php?book=husted&item=chapters
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hi again Cool guys,
once again apologies for not responding earlier.Thats the problem when u r working on multiple quest's and at the same time trying to
catch on to something new.

Thanks to you all Nick / Somkiat and Marc.
It really took the problem of my face .

The manning pdf did help me not only for the validation part but also gave me a chance to look in to "Tiles".

-Sahil.



[ May 22, 2004: Message edited by: Sahil Singh ]
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

2)Can i show this error message next to the "input box"n where the user has missed to entered.


It shows up wherever the <html:errors> tag is placed. You can use the property attribute to display only a particular error when it occurs and place it wherever you want.

Weekend answers have lower accuracy with me, but it would be something like:

<html:text property="username"/> <html:errors property="username"/>

Custom error messages are produced with validation.xml and ApplicationResources.properties.
with validation.xml:
<form-validation>
<formset>
<form name="logonForm">
<field property="username" depends="required">
<msg name="required" key="error.username"/>
</field>
</form>
</formset>
</form-validation>

If ApplicationResources.properties has:
error.username =User Name

then the error will display as: User Name is required.

(If you want to change "is required." I think that can also be manipulated in the ApplicationResources.properties.
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hi Guys,
The question still is persisting....

The values entered by the user are not being repopulated when he/she misses to enter any one or more other fields of the same form.

Since i am using Dynvalidator, am not touching "Reset" method..

So how do i get the "filled" fields repopulated back?...

Thanks,
Sahil
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
I Know it's a Long Week End ....
but ........could u guys....

Thanks,
-Sahil
Kinjal Sonpal
Ranch Hand

Joined: Jun 06, 2003
Posts: 96
Originally posted by Sahil Singh:
If any field is missing the error message shows up on the reloaded page.
The Problem : it diaplays:----
???en_US.ABCFormPg2.fieldName??? instead of showing
fieldName not found or entered...

I also encountered similar problem. Though it sounds silly, but please check whether the ApplicationResources is being found and loaded by the application server. Most appservers log the details when they load the application. Please also check for the existance of the given field. It worked for me.

HTH.

Thanks and regards,
Kinjal Sonpal
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hi Kinjal,
Thanks for the response,actually i was able to remove that problem.
Could any of u guys respond on my latest-previous to this edit problem?

Thanks,
Sahil.
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Please i need this one badly now....

how to repopulate the already entered fields when using "Dynavalidator"

-Sahil.
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Hi, Sahil.

Are you using Struts tags in the jsp???
<html:text instead of <input type="text"

If you are not, you will not get the prepop.
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hi Marc,
Yes I am using Strut Tags...
<form action="UserPg1.do">
<html:text property="Name2" value="" size="10" maxlength="15"/>
...
...
</form>
If i try to remove the "value" part from the above it gives me the following error: -
"Cannot find bean org.apache.struts.taglib.html.BEAN in any scope
Error Code: 500"

If i do include the attribute "value" it just does not repopulate any value entered by the user.

It just clears the field.

I can see the form at the back being correctly setted by the values entered by the user.

I have a work around this but is this the only solution ??

On the JSP Page:-
String test = (String)session.getAttribute("Name2");
and then pass this value to the value attribute of "Name2".


Is this the only answer...Please help me out.

Thanks,
Sahil.
[ June 29, 2004: Message edited by: Sahil Singh ]
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
??
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

value overrides the attempt to call the appropriate getter method of your ActionForm. Rarely is that attribute desirable. Let's remove it and attempt to troubleshoot.

My hunch is that there is no surrounding html:form tag to let the html:text know which ActionMapping to get its ActionForm from.
Sahil Singh
Ranch Hand

Joined: Sep 03, 2003
Posts: 41
Hi Marc,
***** BullsEye *****
Thanks Again and again.U were right as usual

-Sahil.
AJ Bhambhani
Greenhorn

Joined: Jul 16, 2004
Posts: 1
I am getting the following error ...

[ServletException in:/WEB-INF/jsp/SearchGainLoss.jsp] Cannot find bean org.apache.struts.taglib.html.BEAN in any scope'

Following is my jsp snippet...
<form action="/itaac/dvValidate.do">
<html:text property="ProcessDate" size="30" maxlength="30"/>
<INPUT type="submit" name="Search" value="Search">
</P>
</form>


Here's a snippet from the struts-config..

<action path="/dvValidate" type="com.fidelity.fw.ilayer.ext.LayoutAction" validate="true" name="dvForm" input="failure">
<set-property property="modelOutputName" value="GainLossByFundGroupVO" />
<set-property property="modelName" value="SearchGainLossModel" />
<forward name="success" path="layouts.itaac" className="com.fmr.struts.action.FMRActionForward">
<set-property property="tilesParameters" value="body=/WEB-INF/jsp/GainLossByFundGroup.jsp"/>
</forward>
<forward name="failure" path="layouts.itaac" className="com.fmr.struts.action.FMRActionForward">
<set-property property="tilesParameters" value="body=/WEB-INF/jsp/SearchGainLoss.jsp"/>
</forward>

</action>
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Try using html:form instead of form tag.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DynaValidtorform