Advertisement

01.28.2005 at 05:36PM PST, ID: 21293399
[x]
Attachment Details

Struts ActionForms and Collections

Asked by eicheled in Java Server Pages (JSP)

Tags: struts, validation

I'm looking for opinions on best practices here, I think. Here is what I want to do:

I have a jsp (struts) page that I want to display some information in a list. Currently I have that data in a Collection.

One method I used is to place the collection right on the request using request.setAttribute() (in the action class before the mapping.findForward() )  I can display the contents with a <c:forEach> without issue, but the problem occurs on validation. If the form fails the validation and the jsp page is redisplayed, the attribute I set is lost and the list is not redisplayed.

Next method was to store the Collection in the ActionForm and set the form onto the request with a request.setAttribute(). The validation fails with an "argument type mismatch" error. From what I've read, I think I understand that issue now.

So I'm wondering, how do most people handle Collections and ActionForms?  Start Free Trial
 
Loading Advertisement...
 
[+][-]01.29.2005 at 01:03AM PST, ID: 13170567

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Server Pages (JSP)
Tags: struts, validation
Sign Up Now!
Solution Provided By: bloodredsun
Participating Experts: 2
Solution Grade: B
 
 
[+][-]01.29.2005 at 12:34PM PST, ID: 13173041

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.29.2005 at 07:54PM PST, ID: 13174427

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.30.2005 at 12:54PM PST, ID: 13177929

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.30.2005 at 08:10PM PST, ID: 13179847

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.15.2005 at 10:42AM PST, ID: 13316747

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.15.2005 at 03:38PM PST, ID: 13319570

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.28.2005 at 02:57PM PST, ID: 13424602

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32