You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/01/27 05:20:42 UTC
DO NOT REPLY [Bug 6051] -
Provide access to pageContext from Action or ActionForm
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6051>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=6051
Provide access to pageContext from Action or ActionForm
craig.mcclanahan@sun.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
------- Additional Comments From craig.mcclanahan@sun.com 2002-01-27 04:20 -------
In general, it is not possible to do this -- PageContext only exists during the
execution of a JSP page, not a servlet.
The standard design pattern is for an Action to store beans needed by the
presentation layer JSP pages as request attributes or session attributes, which
then become visible to the JSP page (when you forward to it) as request-scope or
session-scope beans.
ActionForm instances should be designed to be independent of their environment
-- their only reason to exist is to store the state of the last inputs from the
user somewhere on the server. If you find yourself needing references to other
request or session scope beans, you are probably trying to put too much logic in
them.
Note that ActionForm beans *do* have access to application-scope data, because
you can call getServlet().getServletContext().getAttribute() to access them.
This is useful, for example, in the validate() method of a form bean, in order
to access a dynamically created bean that defines the valid values for a
particular property.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>