What you have to do is make the collection available to the JSP. How you do that best depends on what sort of data is in the collection, in terms of how often the data will change. If the data is going to change on every request, then you should get it on every request, i.e. make you input attribute an action mapping path and go through an action to create the list.

If the data rarely changes, put the collection in the session or even application scope.

Adam

On 04/07/2004 06:47 PM Zakaria khabot wrote:

Hi all, I start runnig my application with an Action (action.do) which access to the database to get a collection and send it to the JSP. The problem is : when I put validate ="true" in struts-config an error is detected (because fields in the JSP are blank) so the collection is null and the JSP is not displayed. The solotion I want : to display the JSP with errors, and also the collection(not null). Thanks....





----- Original Message -----
From: "Matthias Wessendorf" <[EMAIL PROTECTED]>
To: "'Struts Developers List'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, April 07, 2004 11:37 AM
Subject: RE: validation.xml



i suggest you to use ActionMessage,
since ActionError is deprecated.

and ActionErrorS is only used in
ActionForm.valdiate();

however, why are we talking in struts-dev
on such a common thing ? :-)

Cheers!
Matthias

-----Original Message-----
From: Amiya Moharana [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 07, 2004 1:30 PM
To: Struts Developers List
Subject: RE: validation.xml


Hi Zakaria,


 Generally validator is called before the form is submitted to any
ActionClasses. Just check the sequence of events when we submitt our
form. The order is like this when we submit the form:

1: It goes and checks for any instances of the bean in the current
specified scope( the name of the class, type, and scope is got from the
struts-config.xml).
2: If found then call the reset method on it.
4: If not found than a new instanc is created and stored in the proper
scope.
5: Then the formBean is populated.
6: If the validate is true than the validate() method is get
called(autometically called, no need to call it explicitly.)
7: Than it checks for the action to which the form is to be submitted.

Common validation like: checking an integer, Date, floating point
number, not null are done with the help of validation.xml file. If you
need more specific validation you can put it in the validate() method.
If some more business logic related validations (like loggin, pw checks)
are needed than put these type of validation in the action classes.
Whenever there is some validation fails create a ActionError and add it
ActionErrors objects, and save it to request so that it can be shown to
the user.

When you are putting the logic in the validate method there is no need
to call it explicitly as you have done "form.validate(mapping,
request);". It is autometically get called on the form instance, as
mentioned in the sequence.

With Warm Regards.
Amiya.



-----Original Message-----
From: Zakaria khabot [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 07, 2004 4:26 PM
To: Struts Users Mailing List; Struts Developers List
Subject: validation.xml


Hi all,


How to call the validator from an Action.
- in struts-config I put validate="false",
- I am using validation.xml to control erors.
- In the action I wrote :
ActionErrors errors = new ActionErrors();

errors = form.validate(mapping, request);

but it executes the validate methode in the formAction not in the
validation.xml.



Thanks for help...




--------------------------------------------------------------------- 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]





---------------------------------------------------------------------
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]



Reply via email to