You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by kothapallibc <ko...@mailcity.com> on 2002/02/20 07:10:34 UTC
My problems with Struts...
Hi,
I'm a newbie to Struts and trying to fit it into an application
that's modeled after Blueprints. I feel frustrated at many
places...It could be just that I don't understand Struts properly
yet.I feel like just using the classes that I like and leaving those
features I don't prefer.
I agree that it provides a nice working framework, but I find too
many limitations...
1.Struts automatically read your form data into request/session scope
as specified in struts-config.xml.
My problems with this are
Firstly, I need to transform the data types other than Strings.
And then it gets funny when using arrays...
If you have a 'String[] str', you don't have to initialize it in your
form bean.
But if you have an object array like 'Monkey[] monkeys', you need to
initilize it in the form bean, or else it throws NullPointerException.
How am I supposed to know the number of 'monkeys' the user wants to
key in?
One more thing is, for 'String[] str', the HTML parameter names
should be just 'str'. All the parameters with the same name will
be read into 'str[]'.
But with 'Monkey[] monkeys', the parameter names should have the index
like 'monkey[0].name','monkey[1].name' etc.
Why is it so? And this indexed naming makes the javascript difficult
to code and read.
With such problems with transformation and nested bean arrays, I feel
like reading the HTML data on my own. I fail to see how this feature
adds much value.
2.Provides form validation.
This is a good feature to have, but anyway, generally we push as much
validation as we can into Javascript and if there are any real
business validation to be done, I'd prefer doing it in business tier
rather than in Form bean.
Again it adds value, but in a large application, I don't feel it is
that much.
3.Internationalization - again good, but it's not that difficult to
implement on our own.
4.Tag libraries - I never really used tag libraries in JSPs, so
cannot comment on the usefulness of them. Do people find the tag
libraries so useful? I want to know where this feature stands the
list of good things about struts.
There seem to be many experienced Struts users on this list. Could
you please tell me the features you find very useful and the kind of
applications you are building using them? And if I'm missing
something badly in my understanding?
Regards,
Choudary.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: My problems with Struts...
Posted by Ted Husted <hu...@apache.org>.
Yes, it's very true that Struts does not do anything you could not do
for yourself. The point is that with Struts, you do not have to do it
yourself. It's already been done, documented, and put into production.
Not just by your team, but by hundreds of teams.
Since the framework is closely aligned with published specifications and
standard components, it is also very easy to swap in your own code
wherever needed.
Many people use the Struts controller and completely ignore the JSP tag
extensions, substituting XLST, Velocity templates, or some other
presentation layer.
If the Struts ActionForm doesn't serve your every need, the request and
response are provided to the Action, and you can do whatever you want in
any way you want.
If you need to go to another servlet for something, and don't even need
an Action, go for it. Any URI will do.
The real question is whether you want to use the Struts configuration
and Actions (at least some of the time). If so, there's no downside in
using Struts in your application. Every option you had before is still
an option, and you gain a great front controller that your application
can use as needed.
-- Ted Husted, Husted dot Com, Fairport NY US
-- Developing Java Web Applications with Struts
-- Tel: +1 585 737-3463
-- Web: http://husted.com/about/services
kothapallibc wrote:
>
> Hi,
>
> I'm a newbie to Struts and trying to fit it into an application
> that's modeled after Blueprints. I feel frustrated at many
> places...It could be just that I don't understand Struts properly
> yet.I feel like just using the classes that I like and leaving those
> features I don't prefer.
>
> I agree that it provides a nice working framework, but I find too
> many limitations...
>
> 1.Struts automatically read your form data into request/session scope
> as specified in struts-config.xml.
>
> My problems with this are
>
> Firstly, I need to transform the data types other than Strings.
> And then it gets funny when using arrays...
> If you have a 'String[] str', you don't have to initialize it in your
> form bean.
> But if you have an object array like 'Monkey[] monkeys', you need to
> initilize it in the form bean, or else it throws NullPointerException.
> How am I supposed to know the number of 'monkeys' the user wants to
> key in?
>
> One more thing is, for 'String[] str', the HTML parameter names
> should be just 'str'. All the parameters with the same name will
> be read into 'str[]'.
>
> But with 'Monkey[] monkeys', the parameter names should have the index
> like 'monkey[0].name','monkey[1].name' etc.
> Why is it so? And this indexed naming makes the javascript difficult
> to code and read.
>
> With such problems with transformation and nested bean arrays, I feel
> like reading the HTML data on my own. I fail to see how this feature
> adds much value.
>
> 2.Provides form validation.
>
> This is a good feature to have, but anyway, generally we push as much
> validation as we can into Javascript and if there are any real
> business validation to be done, I'd prefer doing it in business tier
> rather than in Form bean.
>
> Again it adds value, but in a large application, I don't feel it is
> that much.
>
> 3.Internationalization - again good, but it's not that difficult to
> implement on our own.
>
> 4.Tag libraries - I never really used tag libraries in JSPs, so
> cannot comment on the usefulness of them. Do people find the tag
> libraries so useful? I want to know where this feature stands the
> list of good things about struts.
>
> There seem to be many experienced Struts users on this list. Could
> you please tell me the features you find very useful and the kind of
> applications you are building using them? And if I'm missing
> something badly in my understanding?
>
> Regards,
> Choudary.
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>