struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Chisholm" <David_Chish...@i2.com>
Subject RE: Struts--question about bean/form name.
Date Wed, 21 Jun 2000 06:17:32 GMT
On a similar note, can you associate non-standard attributes for an action
in the action.xml, and then retrieve those values in the Action.perform()
method?  For example, adding the useDefaultHomePage attribute shown below to
the example logon action:

  <action path="/logon"
    actionClass="org.apache.struts.example.LogonAction"
    formAttribute="logonForm"
    formClass="org.apache.struts.example.LogonForm"
    inputForm="/logon.jsp">
    <forward name="logon"      path="/logon.jsp"/>
    <forward name="success"    path="/mainMenu.jsp"/>
    useDefaultHomePage="true"
  </action>


One suggestion, add a 'public void init(ActionMapping mapping)' method to
Action that is called when the Action is instantiated to allow the Action to
perform any static initialization that it needs, and a 'public void
destroy()' to allow it to do any cleanup.  ActionBase would then provide
default implementations of these methods.

David


> -----Original Message-----
> From: Kevin Duffey [mailto:kduffey@buymedia.com]
> Sent: Wednesday, June 21, 2000 1:09 AM
> To: struts-user@jakarta.apache.org
> Cc: struts-dev@jakarta.apache.org
> Subject: Struts--question about bean/form name.
>
>
> Hi,
>
> is there any way in each of my action perform() methods to get
> the "name" of
> the bean that was set in the action.xml, so that I can use that
> String name
> for various purposes? For example, we don't use EJB yet, so we
> separate our
> logic into "logic_session" classes. These session classes are
> stored in the
> HttpSession, with a reference to our bean, and I would like to
> store them by
> using the name of the bean (form passed in) and appending
> "Session" to that
> name. In the JSP page I have to hardcode it though..which means I
> still have
> to change the bean name in two places..if I change it for any reason.
>
> Thanks.
>


Mime
View raw message