struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alen Ribic" <al...@mweb.co.za>
Subject Re: Get request property value into Hidden field?
Date Fri, 13 Jun 2003 13:02:19 GMT


----- Original Message -----
From: "Krishnakumar N" <krishnakumar.n@ctp.ilabsgroup.com>
To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
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"/>
will this automatically create a "deleteForm" bean with my "id" parameter
and store it as an request/session attribute?

then I understand how the <html:hidden property="id" /> will get populated.

--Alen

>
> 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:alenr@mweb.co.za]
> > 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" <krishnakumar.n@ctp.ilabsgroup.com>
> > To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> > Sent: Friday, June 13, 2003 1:03 PM
> > Subject: RE: Get request property value into Hidden field?
> >
> >
> > > > -----Original Message-----
> > > > From: Alen Ribic [mailto:alenr@mweb.co.za]
> > > > 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" <krishnakumar.n@ctp.ilabsgroup.com>
> > > > To: "Struts Users Mailing List" <struts-user@jakarta.apache.org>
> > > > 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:alenr@mweb.co.za]
> > > > > > 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:
> > struts-user-unsubscribe@jakarta.apache.org
> > > > > > For additional commands, e-mail:
> > > > struts-user-help@jakarta.apache.org
> > > > > >
> > > > >
> > > > >
> > > >
> > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > struts-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > > > >
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail:
> > struts-user-help@jakarta.apache.org
> > > >
> > >
> > >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message