I wasn't happy with not being able to pass parameters around! The following
now works for me:

            forward=mapping.findForward("success");
            forward.setRedirect(true);
            String path=forward.getPath();
            path+="?bugID="+userBean.getBugIDAsString();
            forward.setPath(path);

Perhaps this isn't the most elegant of solutions. If anyone knows of a
better way of doing this I'd like to hear about it.

Regards

Quentin

-----Original Message-----
From:
[EMAIL PROTECTED]
rg
[mailto:struts-user-return-17427-quentin=newbolds.gotadsl.co.uk@jakarta.
apache.org]On Behalf Of Quentin Cope
Sent: 19 September 2001 17:52
To: [EMAIL PROTECTED]
Subject: RE: setAttribute and ActionForward


Ted, Andre and Anish

Thanks for the response. I realise that I have been going about this the
wrong way and I didn't really want to do setAttribute at all. "success"
mapped on to an existing jsp that took a page with a parameter (like
?bugID=1102) and that's what I was trying to get to work. I have now
modified the jsp to either take parameters or values from the session. Sort
of wasn't what I wanted to do though but I can't see how achieve the desired
result with just parameters and ActionForward.

Regards and thanks for the advice

Quentin
-----Original Message-----
From:
[EMAIL PROTECTED]
rg
[mailto:struts-user-return-17425-quentin=newbolds.gotadsl.co.uk@jakarta.
apache.org]On Behalf Of Ted Husted
Sent: 19 September 2001 17:19
To: [EMAIL PROTECTED]
Subject: Re: setAttribute and ActionForward


Try it without

forward.setRedirect(true);

You should then be able to get to it using

<bean:write name="bugID"/>

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel +1 716 737-3463
-- http://www.husted.com/about/struts/Quentin Cope wrote:


> I am struggling to get a parameter to a page in my Action class. My code
> looks like :
>
>         BugUpdateForm bugForm = (BugUpdateForm) form;
>         ActionForward forward=new ActionForward();
>         try
>         {
>             System.out.println("going to call updateBug");
>             HttpSession session = request.getSession();
>             UserBean userBean =
(UserBean)session.getAttribute("userBean");
>             userBean.updateBug(bugForm.getStatus(),bugForm.getClosed());
>             request.setAttribute("bugID",userBean.getBugIDAsString());
>             forward=mapping.findForward("success");
>             forward.setRedirect(true);
>         }
>         catch (Exception e)
>         {
>             System.out.println(e);
>             forward=new ActionForward(mapping.getInput());
>         }
>         System.out.println("Going to "+forward.toString());
>         return (forward);
>
> The JSP page that is mapped to "success" gets called but it doesn't seem
to
> get the "bugID" parameter. This seems such a simple thing to do but I have
> spent a good few hours with no success. Anyone got any suggestions?
>
> Regards
>
> Quentin

Reply via email to