Aaah...but these are not related to form actions and are more like query
strings. I guess in this case, request.getParameter would still be  the
best bet, rather than trying to go for an overkill with the hidden id
field  etc etc ...just my thought. 
 
If you still don't want to request object, you may have a hidden form
with a hidden field. With onclick, you can call a java script function
to update the hidden field and then submit the form. Never tried this
though with links. 




-----Original Message-----
From: Patrick Cheng [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 13, 2004 3:33 AM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object

Hi ,
Can you elaborate a bit?  The situation in my mind is, a jsp page with a
list of records, but no form at all.
Like....
<a href="details.jsp?id=1>Apple</a>
<a href="details.jsp?id=2>Orange</a>

Of course the a links are generate by struts. Then how couldthe form be
used in this case? 
I can think of using a hidden field in a form, and then on click, change
the hidden value to the id, and call the form submit.

Rgds,
Patrick.

-----Original Message-----
From: Richard Hightower [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 3:08 PM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


forgive me....but could'nt your form have an id property?

then your action's execute method could get the id from the form.

Rick Hightower
Developer

Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm

Struts/J2EE consulting --
http://www.arc-mind.com/consulting.htm#StrutsMentoring

-----Original Message-----
From: Patrick Cheng [mailto:[EMAIL PROTECTED]
Sent: Monday, January 12, 2004 7:34 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: RE: Mandatory use of form rather than request object


Hi,
I understand that the request.getParameter should not be used when the
info is readily available in the 'form' object. But can we really take
it out? When I create a list of records in a table, with links to each
record details, I would be generating an <html:link> object with
parameters attached, resulting in sth like: <a
href="/aaa/details.do?id=1">. Then I need to use the
request.getParameter to get the id, then retrieve the record details
from db.  So my question is, is there a way to get around this, so I can
get rid of request.getParameter completely?

Rgds,
Patrick.



-----Original Message-----
From: Andrew Hill [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 13, 2004 10:09 AM
To: Struts Users Mailing List
Subject: RE: Mandatory use of form rather than request object


No. He would provide setters in the form for anything that needs to be
passed along in request scope. This has the dual advantages of type
safety and making the design more explicit to anyone reading the code.

-----Original Message-----
From: Brice Ruth [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 13 January 2004 02:25
To: Struts Users Mailing List
Subject: Re: Mandatory use of form rather than request object


This precludes you from storing data in the request scope, though - so
you're left with only storing things in the session scope, which I
wouldn't consider ideal.

Right?

Richard Hightower wrote:

>Create a superclass that overides the execute method and calls an 
>abstract execute method that does not pass the request object. The 
>subclasses overide the execute method without the request object being 
>passed.
>
>Also look into the ProcessAction, which is part of the scaffold.
>
>You can get the scaffold code by downloading the struts source.
>
>
>Rick Hightower
>Developer
>
>Struts/J2EE training -- http://www.arc-mind.com/strutsCourse.htm
>
>Struts/J2EE consulting -- 
>http://www.arc-mind.com/consulting.htm#StrutsMentoring
>
>-----Original Message-----
>From: Abhishek Srivastava [mailto:[EMAIL PROTECTED]
>Sent: Monday, January 12, 2004 8:19 AM
>To: 'Struts Users Mailing List'
>Subject: Mandatory use of form rather than request object
>
>
>Hello All,
>
>I did some code reviews recently for my project being done on struts.
>
>I found that most people still do a request.getAttribute("NAME") kind 
>of code even when the name is a property of the form object and is 
>available
in
>the form object.
>
>My question is should the use of form be mandatory. If yes, how it can 
>be enforced. Is there quick way I can remove all the params/attributes 
>from
the
>request object once the corresponding values have been set in the form 
>object?
>
>Thanks in advance for your advise.
>
>Regards,
>Abhishek.
>
>---------------------------------------------------------------------
>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]
>
>
>

--
Brice D. Ruth
Sr. IT Analyst
Fiskars Brands, Inc.


---------------------------------------------------------------------
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