What about putting the object PageBeans, which is
actually a Collection, in an application scope. When
the object is no longer in use, code:
getComputer().getPlug().pull();
Do you think this approach is going to work?
--- Jeff Beal <[EMAIL PROTECTED]> wrote:
> Caroline Jen wrote:
> > Q1. How come I do not see validation warning
> messages?
> > I have prepared validation.xml and put it
> together
> > with the validator-rules.xml in the
> AppName/WEB-INF
> > directory. I have also prepared the warning
> messages
> > in the
> >
>
AppName/WEB-INF/classes/resources/application.properties
> > corresponding to the value of the 'key'
> > attributes.
>
> The idea with form validation is that validation
> errors should be
> displayed close to where the errors occurred -- that
> is, on the input
> form. When Struts detects validation errors,
> control is returned to the
> resource identified in the input attribute of the
> ActionMapping, which
> is typically coded in such a way that the form is
> populated with exactly
> what the user typed into them (which is why form
> bean attributes are
> usually all Strings) and the errors are displayed
> next to each field in
> error.
>
> In your case, part of the JSP page is trying to read
> from a request bean
> that was originally populated in some other action
> as part of another
> request. When the <bean:define/> tag is called from
> the JSP page, it
> throws a ServletException. Struts at this point is
> completely out of
> the picture (it forwarded control to the JSP page),
> so the default JSP
> exception handling mechanism kicks in and you get
> something ugly.
> >
> > Q2. What should I do? My action servlet passes
> this
> > Collection PageBeans in a request scope to create
> a
> > drop-down menu in the 'content.jsp'. If
> validation
> > errors occur and the control returns to the
> > 'content.jsp', I have the error message 'cannot
> find
> > bean PageBeans' in scope request'. How to handle
> this
> > kind of situation?
>
> That's a trickier question and depends a lot on how
> the PageBeans bean
> was originally populated. You will probably need to
> write an Action
> whose execute method reads something like:
>
> public ActionForward execute(...) {
> if (request.getAttribute("PageBeans") == null)
> request.setAttribute("PageBeans",
> model.getPageBeans());
> return mapping.findForward("success");
> }
>
> Then, create an action mapping like:
> <action path="/content/newContent.do"
> type="new.action.from.above">
> <!-- forward to JSP page -->
> <forward name="success" path=".frame.Content"/>
> </action>
>
> and change all references to .frame.Content to the
> new action path.
>
>
>
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]