struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Varun Garg" <varun_g...@yahoo.com>
Subject RE: Struts + EJB
Date Thu, 17 Jul 2003 18:20:47 GMT
You should create a actionform with all the incoming parameters and
whatever values that you might need to pass back.

Then in the action you can check for those values.
Say the ActionForm would contain a property called "category" and you
would have getter and setter for that. Then in the Action instead of
doing request.getParameter("category"); you would just do a
form.getCategory(); and also for outgoing values just create another
property for example if you have a collection that you want to pass to
the jsp page, say the jsp page wants to show a list of something.

You can then create a property in the form for that collection say
"coll" and then in the Action after getting the values from the
SessionEJB set them in the form. Then you can access them on the page
using the standard tags from struts.
form.setColl(lsb.getCollection(form.getCategory());

Varun

-----Original Message-----
From: Marc Gibert Ginestà [mailto:marcg@cometatech.com] 
Sent: Thursday, July 17, 2003 1:04 PM
To: Struts Users Mailing List
Subject: Re: Struts + EJB


Varun Garg wrote:
> I would call the SessionEJB from the actions and copy over the 
> contents that need to be displayed either in the ActionForm or a 
> VO/DTO in the form and then use that to display the information in the

> JSP.
> 
> What is the SessionEJB returning you?? It should be some object 
> serializable and that should be able to fit in the ActionForm.

The sessionEJB could return anything, depending on the method called. 
 From a Collection to a single value. The initial idea was to make 
getters for each value to be seen on the view.

We weren't planning on using ActionForms from the start. At the moment 
we're using URLs to pass parameters, like "showdetails.do?category=3" 
and getting the value of the parameter passed, in the Action with a 
request.getParameter("category");

I like your solution (use the ActionForm), could you provide an example 
of getting the category parameter from it and then add the result values

in the ActionForm?

Thanks in advance.

-- 
Sincerely,
Marc Gibert Ginestà               e-mail: marcg@cometatech.com
Cometa Technologies, S.L.         URL: http://www.cometatech.com
Telf.: 93 231 84 90               Fax: 93 245 93 43



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