Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DynaValidtorform

 
Sahil Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Guys,
You have never failed me before...need help urgently..

Thanks,
Sahil
 
Sahil Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello....ALOHA....

-Sahil
 
Sahil Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aloha-AloHa Aloha

Thanks,
-Sahil
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first problem I'm not sure about.

The second problem sounds like you might be clearing everything out in the reset method.
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In first problem,
please explain detail of problem agian because your question is ambigurous.... (Locale or error in validattion)
 
Sahil Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This link will help you to solve this problem

http://www.manning.com/catalog/view.php?book=husted&item=chapters
 
Sahil Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Know it's a Long Week End ....
but ........could u guys....

Thanks,
-Sahil
 
Kinjal Sonpal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please i need this one badly now....

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

-Sahil.
 
Sahil Singh
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
??
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marc,
***** BullsEye *****
Thanks Again and again.U were right as usual

-Sahil.
 
AJ Bhambhani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using html:form instead of form tag.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic