I forgot to add one more thing. U had also mentioned that the form has the logic to get the list data from database.
In our project we had lot of problems because some of the forms were directly getting data from database to populate lists etc in case of errors. So i will say that you should avoid mixing model layer lggic(data access)in the form.If form needs any data let it go through action which interacts with Model to get the data.This seems a bit too much in some cases.But this keeps the design clean,.And u use the form classes the way they are meant to be.(Forms to collect data). regards, shirish -----Original Message----- From: meissa.Sakho [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 2:50 PM To: struts-user Cc: meissa.Sakho Subject: Réf. : RE: E: setting form attributes within jsp I'll try the approach 2 cause'it seems like much more flexible for me. Thank you Shirish for your advices. Meissa |---------+------------------------------> | | shirishchandra.sakh| | | [EMAIL PROTECTED] | | | | | | 06/12/2002 11:57 | | | Veuillez répondre à| | | "Struts Users | | | Mailing List" | | | | |---------+------------------------------> >------------------------------------------------------------------------------- ----------------------------------------| | | | Pour : [EMAIL PROTECTED] | | cc : | | Objet : RE: E: setting form attributes within jsp | >------------------------------------------------------------------------------- ----------------------------------------| There are 2 approaches to this problem . For the perticular action, change the input mapping to the action u want to forward control to in case of error(which in your case will be the error handler action which repopulates the data in the form from database and sends back to same jsp). And in the error handler action , the success forward will point back to same jsp. Approach 2: In my case, i have conditional error behaviour.SO depending on what error occurs, i want to forwqard to different pages/Actions.So in this case,Do as folows.In the Action mapping for action , disable the validation(validate=false).And in the actions perform method,call the different validate methods on form i have defined.And there conditionally decide which forward to use. But in your case , as u dont seem to have conditional error forward behaviour, u can go ahead with first approach. Hope this helps. Regards, Shirish -----Original Message----- From: meissa.Sakho [mailto:[EMAIL PROTECTED]] Sent: Friday, December 06, 2002 9:12 AM To: struts-user Cc: struts-user Subject: Réf. : RE: setting form attributes within jsp Shirish, The solution you suggest me is quite good for me and is near to my approach. In my ActionForm, I have a restoreDatas method which is called to repopulate datas in case of validation errors. This is a little bit cumbersome. Because I have to go back to the database from the ActionForm. Can you tell me in your case, how you are doing to forward to another action when a validation fails(from ActionForm). The only way I know to detect validation failure is to call ActionErrors.isEmpty() method. And as I know, It' the input of the action that called back . regards, Meissa |---------+------------------------------> | | shirishchandra.sakh| | | [EMAIL PROTECTED] | | | | | | 05/12/2002 17:15 | | | Veuillez répondre à| | | "Struts Users | | | Mailing List" | | | | |---------+------------------------------> > ------------------------------------------------------------------------------- ----------------------------------------| | | | Pour : [EMAIL PROTECTED] | | cc : | | Objet : RE: setting form attributes within jsp | > ------------------------------------------------------------------------------- ----------------------------------------| Ok.I got your problem. But as U dont want to put the collection in session , the only way out is to get it back from model and populate it in the form before sending it to jsp. I think in such case if u dont want to keep the list in session but repopulate it on validation error(Like a country list on a user input form..)you can forward to another action in case of error which will repopulate the form with the collection.and then forward it back to the same jsp. We have pretty much similar functionality.And u can even have a generic action class which will just populate the forms in case of errors and send them back to jsps. regards, Shirish -----Original Message----- From: meissa.Sakho [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 4:56 PM To: struts-user; meissa.Sakho Subject: setting form attributes within jsp Hi all, I would like to set some of my form attributes within the jsp so that to be able to get it back when the form validation fails. the conserned attribute is a collection and I don't want to put in in the session. I've tried the jsp setProperty tag in vain. the attributes have getters and setters method in the ActionForm bean. can someone help me about that Thanks meissa -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>