This should work.  I've used the same construct before.  Make sure that myObj !=
null in the Action and that you are referencing request.getAttribute("label") in
the JSP.

-Carl

"Rachell, Morgan" wrote:

> In a JSP page, I have a link that calls an Action. Usually, this is done
> with a submit button within a form, but I need it to be a link. Apparently,
> this introduces a problem, since I'm not using a form. Basically, I want to
> click a link, execute an Action which puts some object in request scope,
> then forward to some results page.
>
> Here's the link:
>
> [ jsp snippet ]
> ...
> <A href="/GetUsersAction.do">List Users</A>
>
> In my struts-cfg.xml, I have
>
> <action path="/GetUsersAction" type="GetUsersAction">
>         <forward name="ViewUsers" path="/ViewUsers.jsp"></forward>
> </action>
>
> In the GetUsersAction class, I put an object in request scope with
> request.setAttribute( "label", myObj ), and then call
>
> return (mapping.findForward("ViewUsers"));
>
> I believe that this Action class is not being called since no log messages
> are displayed in the console and myObj is not availabe in the ViewUsers JSP.
> However the request is forwarded to the ViewUsers.jsp file. (This part
> doesn't make sense.)
>
> Is it possible for me to call an action from a link without a form, or do I
> need to use a dummy form? Or do I need to change my stuts-cfg.xml somehow?
>
> Thanks in advance.
>
> Morgan
>
> ---------------------------------------------------------------------
> 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]

Reply via email to