thanks Krishna for your reply again
you right.
I rethought my design, use case, and have determined that the best way to go
about it is to send it to the action method
first then forward it to my delete view page.
This will give me more control over the item deletion request. (e.g. check
"id" correctness, if not ok then announce error.)
I'll have a same delete action method that will accommodate both call from
listItems.jsp as request for deletion and deleteItem.jsp view that will
perform the post to action for actual deletion process.

So I'm thinking something like this in words...

public ActionForward deleteItem(...) {
    [if Form Bean not set as request attribute,
    set it with new Item bean and set "id" parameter in bean.
    Then forward to "deleteItem.jsp"]

   [Otherwise if Form Bean attribute is set (in this case if deleteForm has
been posted)
    then run the delete business logic process command and forward to
Success page!]
}

does this sound right to you? :)

--Alen






----- Original Message -----
From: "Krishnakumar N" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, June 13, 2003 2:12 PM
Subject: RE: Get request property value into Hidden field?


> Its considered "best practice" to always route the requests thru an action
> mapping which can be just an empty forward as follows:
>
> <action path="/deleteitem" name="deleteform" forward="deleteitem.jsp"/>
>
> Coz then you are able to add processing logic later (if the need arises)
by
> changing the action mapping without touching the pages which have the
link.
>
> In your case, this mechanism would help populate the action form
> (deleteform) with the id value.
>
> Cheers,
> Krishna
>
> > -----Original Message-----
> > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > Sent: Friday, June 13, 2003 4:35 PM
> > To: Struts Users Mailing List
> > Subject: Re: Get request property value into Hidden field?
> >
> >
> > why do I need to go the action before I have given the user a
> > e.g. delete
> > "yes/no" option?
> > my deleteItem.jsp?id=20 gives them the ui yes/no options.
> > is this because I would need to set the form bean as a
> > attribute there or?
> > something like this in action method...
> > request.setAttribute("deleteForm", new
> > Item().setId(request.getParameter("id")));
> > then forward to the deleteItem.jsp page?
> > is this necessary?
> > because after that I need to post again to delete the actual
> > object from
> > persistence storage.
> >
> > I know what the "id" is and that's the only info I need, and
> > I just wish to
> > grab into hidden field and post it to the delete action.
> >
> > --Alen
> >
> >
> >
> > ----- Original Message -----
> > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Friday, June 13, 2003 1:03 PM
> > Subject: RE: Get request property value into Hidden field?
> >
> >
> > > > -----Original Message-----
> > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, June 13, 2003 4:05 PM
> > > > To: Struts Users Mailing List
> > > > Subject: Re: Get request property value into Hidden field?
> > > >
> > > >
> > > > oops.
> > > > thanks.
> > > > I mean getParameter() of course.
> > > >
> > > > It's just simply an Id that gets passed as a parameter that I
> > > > will need to
> > > > store in hidden field and then post of to another action method.
> > > >
> > > > So, it's like this.
> > > >
> > > > > listItems.jsp
> > > > -------------------------------
> > > > ...
> > > > href="./deleteItem.jsp?id=20"
> > >
> > > Link to a deleteItem.do, the action mapping of which has
> > the same action
> > > form as for the delete.do. The action can be an empty
> > forward to the jsp.
> > >
> > > > ...
> > > > -------------------------------
> > > >
> > > > > deleteItem.jsp?id=20
> > > > ---------------------------------
> > > > <html:form action="/delete?method=deleteItem">
> > > >     <html:hidden property="id" />
> > > >     ...
> > > >     <html:submit value="delete" />
> > > > </html:form>
> > > > ---------------------------------
> > > >
> > > > When Struts renders the html, in browser / view source,
> > > > <html:hidden /> tag
> > > > doesn't store the "id" parameter value.
> > > > <input type="hidden" name="id" value="">
> > > > should of course be
> > > > <input type="hidden" name="id" value="20">
> > > >
> > > > Does this make sense? :)
> > > > If not, I'll need to look into the issue a bit more myself
> > > > with regards to
> > > > the design.
> > > >
> > > > Thanks
> > > > --Alen
> > > >
> > > >
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Krishnakumar N" <[EMAIL PROTECTED]>
> > > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > > Sent: Friday, June 13, 2003 12:27 PM
> > > > Subject: RE: Get request property value into Hidden field?
> > > >
> > > >
> > > > > request does not have a getProperty as far as I can see, so
> > > > do you mean
> > > > > getParameter()?
> > > > >
> > > > > In that case, the easy way to handle this is to get the
> > > > value into the
> > > > > action form (which happens automatically if the action form
> > > > has a matching
> > > > > property) and then populate the html:hidden from the action
> > > > form (which is
> > > > > also automatic, if you are on the same form).
> > > > >
> > > > > <html:hidden property="myproperty"/>
> > > > >
> > > > > Cheers,
> > > > > Krishna
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Alen Ribic [mailto:[EMAIL PROTECTED]
> > > > > > Sent: Friday, June 13, 2003 1:14 PM
> > > > > > To: Struts Users Mailing List
> > > > > > Subject: Get request property value into Hidden field?
> > > > > >
> > > > > >
> > > > > > Hi Everyone,
> > > > > >
> > > > > > How do I get a request property value into Hidden field
> > > > > > without writing any
> > > > > > java code.
> > > > > > (no <%=request.getProperty("Id")%>)
> > > > > > I tried using <bean:parameter /> with combination of
> > > > > > <html:hidden /> with no
> > > > > > success. (maybe I was doing it wrong or something)
> > > > > >
> > > > > > How do I accomplish this task?
> > > > > >
> > > > > > Thanks
> > > > > > --Alen
> > > > > >
> > > > > >
> > > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > > 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]
> > > > >
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > 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]
> > >
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to