Could you elaborate or point to an example of usage of the adaptor class?

I am very interested in the appraoch.

** I usually put the VO into the form and use the bean write tags to fomat
the display.
If I do something else I put a specific property on the form bean and
populate it in the action.**

This can be a bit of work, but I use the nested tags, so grabbing direct
values from s VO is very easy.






"Rao, Nagraj" <[EMAIL PROTECTED]> on 02/06/2003 11:32:03 AM

Please respond to "Struts Users Mailing List"
       <[EMAIL PROTECTED]>

To:    'Struts Users Mailing List' <[EMAIL PROTECTED]>
cc:

Subject:    RE: What should and should not be in an Action class.


What if the OutPut needs some formatting /or conversions ?
I recommend a Adaptor/s associatd with the Action classes which does all
the
necessary conversions
(to and from the business layer) and then return the bean to the Action
(and
in turn to the request/jsp)
The Adaptor would thus do 2 things:
1)In comming transform the request (form) in to the format which is needed
to call the Service layer
2)Get data out of the service layer and format it as the application front
end depends (JSP,XML WAP..)
and stuff data in to either the form or an output bean.
The output bean being really dumb and whose only job is to paint/help
render
the JSP.


-Naggi


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 6:28 AM
To: [EMAIL PROTECTED]
Subject: RE: What should and should not be in an Action class.


U will have some thing like following ..

The action classes are handlers...So when u need to get some data to the
screen,U will call the action class and the action class will then call a
Busines Layer class to perform the database access logic and return the
result.And action will then put the result in required scope(mostly in
request
scope ) and forward to jsp.The jsp will then use this data,usually a java
bean
,to render result.
(Lets take an example...To get EmkployeeDetails,u will call
GetEmployeeDetailsAction from jsp by passing the employee id.
In GetEmployeeDetailsAction action , u will have some thing lie this.

EmployeeService empService = new EmpService();//u can use servuice factory
here...
EmployeeDetailsBean empDetailBean = empService.getEmployeeDetails(empId);
EmpDetailForm empDetailForm = (EmpDetailForm )form;
empDetailForm .setEmpDetails(empDetailBean );

return mappig.FindForward("success");// successs points to empDetails.jsp
which
access the empDetailForm  to render the page...

hope this helps,
regards,
Shirish



-----Original Message-----
From: kelly [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 06, 2003 11:20 AM
To: struts-user
Cc: kelly
Subject: What should and should not be in an Action class.


Hi All,

I'm just trying to work out where I need to put all of my database access
code within the struts architecture.  If I'm reading Craigs comments on the
Action class correctly and have got the MVC set up right, all the action
class should do is gather any necessary information, add it to the form and
then forward it on.  But if I need to get data from the db and put it in
the
form, should I do it in the action class or pass it to the business logic
and make the business logic forward it to the output servlet?

I'm getting a bit confused with all this so sorry if the question's a bit
simple.

Regards

Simon

Institut fuer
Prozessdatenverarbeitung
und Elektronik,
Forschungszentrum Karlsruhe GmbH,
Postfach 3640,
D-76021 Karlsruhe,
Germany.

Tel: (+49)/7247 82-4042
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