struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sundar Narasimhan <>
Subject Re: question re. struts
Date Sun, 02 Feb 2003 22:34:58 GMT
>>     - set each individual attribute of my model into request
>>       parameters
>Why would you do this if you have the form bean from the previous

Hi, Paul: Thanks for your thoughtful reply. Your above statement is
what I guess I'm having trouble with. (i.e. if I have a Point model
object.. say read from the db.. according to a unique ID..
	 Point -- getX(), getY(), setX(int x), setY(int y) .. 
now I need a 
with similar methods.. may be getting and setting with String instead
of ints :). and Let's postulate a PointAction. 

The point of confusion I have is.. I understand that the struts
servlet instantiates PointAction, and can map "parameter" X, and Y from/to
PointForm's X and Y.. but in my perform method .. I still need to

	perform.. () {
	     Point p = new Point(id);
	     request.setAttribute("X", p.getX());
	     call the jsp
do I not? 
What I would have liked to be able to do is..

        class PointForm extends Point implements SomeStrutsFormInterface { 

in cases where this is possible. The advantage of this is that it
still maintains and allows for the *Form classes to be decoupled from
the Model classes, but allows for "code" re-use.. I don't have to
write several lines of repeated code.. or just spend a lot of time
writeing to string and from string methods for every single
attribute. In a language such as Java where no pointers exist taking
the reflection overhead seems like a big waste -- and writing all
these repeated methods seems such a productivity reducer :)

Am I making sense? 

If it does, what I'd like to know is what people do to reduce the
amount of code.. is there a tool that can perhaps 'generate' the form
given a model.. ? Or something.. I have tens of objects w/ hundreds of
attributes and I'm overwhelmed w/ the amount of code Struts seems to


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message