Action.ERROR_KEY problem
Hello, I have a form in Struts which has a drop-down select list where the options are populated by a bean that reads the options from a database. On the form JSP, I use: " /> Within this bean, I have defined an ActionError field that is null unless some error occurs within the bean. So, this block of code will show the error: <% request.setAttribute(org.apache.struts.action.Action.ERROR_KEY, ERROR); %> With the above structure, the tag happily sees any errors. However, I have to use a JSP scriptlet, as you can see, to associate the ActionErrors object with the proper key name. The reason for this is that the actual Action.ERROR_KEY name is: "org.apache.struts.action.ERROR", and that isn't a valid Java variable name -- so I can't use it in the id parameter of the tag. So, I'm wondering ... why isn't Action.ERROR_KEY delimited by underscores or something that would make it a legal var name? Or, is there some other way to do this that I'm missing? Thanks, Doug
Re: Mainatinig Select list state
I have done this. The reason the contents of the boxes aren't saved when you come back is that all of the aren't sent to the server, only the selected one is. I use one field for every element of each select box. When the form loads, I populate the boxes with JavaScript by reading the hidden fields. Then, when the user moves something from one to the other, I write that change to the hidden fields with JavaScript. Then, when the form is submitted, the current state is stored in hidden fields, and will be properly restored when Struts returns you to the form again. It requires some interesting JavaScript to move things around as they should be, and enough placeholder hidden fields to contain all possible options from either select box. The other alternative would be to use , and then use an onSubmit() JavaScript method to select all of the options in both select boxes. Then, all elements of the select boxes will be sent to the server, and should be maintained by Struts. This would be simpler than the earlier suggestion, but, it won't work if you don't want to set multiple="true". Good luck, Doug Vinay Cerejo <[EMAIL PROTECTED]> cc: 09/06/2001 01:41 Subject: Mainatinig Select list state AM Please respond to struts-user HI, I have two select lists, one filled with data and the other empty Lets call the filled list as AllElements and the empty list as UserElements AllElementsUserElements -- --- | element1| | | | element2| >> || | element3|| | | element4| << || --- The user selects items from AllElements and moves them to UserElements and then submits the form. Now when any validation error in the Form bean. i throw the user back to the same form But my user selections have been lost. How do i maintain these. Ofcourse i can maintain it by doing some coding to retreive all elements again from the database and using the request attributes and filtereing the selected ones etc, but is there no support from struts for maintaing state in such scenario?? many Thanks, Vinay
Re: AW: Struts vs. JADE (from IBM) - feature and usability comparison- need help!
Also, Struts is bundled with WAS 4.0 and used to build their web-based admin tools. I'd say that's quite an endorsement from Big Blue. Doug "D. Veniseleas" <[EMAIL PROTECTED]> cc: 09/07/2001 01:05 AM Subject: AW: Struts vs. JADE (from IBM) - Please respond to feature and usability comparison - need help! struts-user Hi, in their Redbook for the Websphere Appl-Server they describe struts in detail. I had the impression, they liked struts. Dimitris > -Ursprüngliche Nachricht- > Von: Esterkin, Alex [SMTP:[EMAIL PROTECTED]] > Gesendet am: Donnerstag, 6. September 2001 19:49 > An: [EMAIL PROTECTED] > Betreff: Struts vs. JADE (from IBM) - feature and usability comparison - need help! > Wichtigkeit: Hoch > > Hello, > > There has emerged a new proprietary MVC framework called JADE and developed > and promoted by IBM Consulting National Practice people. I sense it is > inferior in comparison to Struts, but I don't have enough information about > JADE, and IBM is liked very much at my firm. I need to quickly prepare a > detailed feature for feature technical comparison. > > I wonder whether there are people on this discussion board, who are familiar > with JADE, and who could share their opinions or insights in this regards. > > Thanks!!! > > Best regards, > >Alex Esterkin > Fidelity Investments > E-mail: [EMAIL PROTECTED] > > = >