You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Navjot Singh <na...@net4india.net> on 2003/04/10 14:07:56 UTC

Design Practice: Handling umpteen params in Action

Hi,

__Q1__
Say i have a form with 12 fields.
Submitted -> Request comes to Action.

I need to pass these form fields to the business logic class.
+ One way to do this is --call(p1,p2,p3,p4,p5.....)
+ Other way could be ----call(map of form fields)

Which one should be used?

__Q2__
test.jsp -> TestAction.java -> Test.java

Say i need a session value(set of session values) in Test.

In TestAction
+ One way to do this is --Test.call(session.getAttribute(..))
+ Other way is to prepare the map like composite object and pass it on.

Which one should be used?

Both the Qs seem to be primitive but most of us must have faced them like a
tough problem.
Any sugestions are welcome.

-----------------------
regards
Navjot Singh


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


RE: Design Practice: Handling umpteen params in Action

Posted by Andrew Hill <an...@gridnode.com>.
Third option is to create a DTO bean instead of using a map, that has
typesafe getters and setters for the stuff you need to pass to the business
logic class.

-----Original Message-----
From: Navjot Singh [mailto:navjot.s@net4india.net]
Sent: Thursday, 10 April 2003 20:08
To: Struts Users Mailing List
Subject: Design Practice: Handling umpteen params in Action


Hi,

__Q1__
Say i have a form with 12 fields.
Submitted -> Request comes to Action.

I need to pass these form fields to the business logic class.
+ One way to do this is --call(p1,p2,p3,p4,p5.....)
+ Other way could be ----call(map of form fields)

Which one should be used?

__Q2__
test.jsp -> TestAction.java -> Test.java

Say i need a session value(set of session values) in Test.

In TestAction
+ One way to do this is --Test.call(session.getAttribute(..))
+ Other way is to prepare the map like composite object and pass it on.

Which one should be used?

Both the Qs seem to be primitive but most of us must have faced them like a
tough problem.
Any sugestions are welcome.

-----------------------
regards
Navjot Singh


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