Answers to the questions below... I spent 10 hours on it so far, so I've tried many things. Now I did see the Action errors listed in the JSP. Either Struts is not putting the form bean on the request/session, or it's not populating what it did put on the request/session with was it found in the submitted form bean.
Dana On Tue, 2004-05-04 at 21:26, Riyad Kalla wrote: > Dana, > Yes Struts should and does do this. It actually does this so well, that > for login forms you need to manually clear the beans or else it > repopulates the values :) > > 1) Are you syncing up the names/properties of your fields on your JSP > page in the form with the property names of the Form? > .. Java snippet .. > public String getUserName(); > public void setUserName(String userName); > > ... JSP Snippet ... > <html:text name="userForm" property="userName" /> > Yes. I am following Struts' strict naming conventions. > 2) Did you implement your reset method cleanly? Yes. > > 3) Is your validate method straight forward? > if(userName == null || userName.length() == 0) > // make/add some errors > return actionErrors; Yes. > > 4) How is your action defined in your struts-config? Did you specify a > scope for the bean? Have you tried NOT specifying the scope? > I have tried both session and request, and neither worked, though it shouldn't matter which one you choose, no? > I want to reassure you that Struts does this very well and doesn't need > you to hack around it, so if this is not working for you, we just need > to keep trying. > > Dana Jeffrey Hata wrote: > > >I'm using Struts with WSAD, and I am attempting something very simple, which should > >happen automagically. Basically, I just need to have the form re-populate after > >submitting a form which doesn't pass the form bean's validate method. Should > >happen without any special coding from me, as this is supposed to be a feature of > >struts. Well, it didn't happen for me. I checked things like form-bean scope. By > >plugging in some strategically placed System.outs, I realized that struts was > >creating a new formbean object, and populating it, but when it came back to my JSP, > >that was using a different formbean object. Shouldn't it be getting the form bean > >which (should have been) placed in the request/session by the actionservlet? Well, > >it apparently wasn't, because the way I got it to work was simply putting the > >following line at the end of my formbean validate(): > > > >request.setAttribute(<my formbean name>,this); > > > >This made everhything work, so my question is, why the hell didn't struts do this? > >Isn't it supposed to? Is there anything I could have done to make struts not do > >this, or maybe place a different form bean instance on the request? It works now, > >but I don't like hacks. > > > >Thanks in advance, > > > >Dana > > > >--------------------------------------------------------------------- > >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]