You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by st...@bb.com.br on 2003/12/03 19:21:20 UTC

Enhancement in forms


Hello pros,

     I am using Struts and found a bad problem: it doesn't accept
internacionalized input for dates and numbers.
     As experimented, dates are accepted only in the 'yyyy-MM-aa' pattern.
I posted this bug at bugzilla for  Struts and commons-beanutils as I
couldn't use it in the RequestProcessor to perform the localized populate.
     I have a version of the RequestProcessor and common-beanutils here
that works all right as I fixed them, posted the patches to bugzilla and I
am waiting for something to happen!
     Why doesn't Struts implement this feature? If it implements, how's
it's used?

     Will my patches be used for fixing theses bugs or I am doing it the
wrong way?
     I really need answers because it involves a very important project
that will change the future of my company... one of our problems is that we
have proprietary frameworks everywhere and we want to change to Struts if
it fits our needs for the view layer.

     Thank you guys,

Stutz





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


Re: Disadvantages of Struts?

Posted by "Robert H. Tran" <rh...@hotmail.com>.
Thanks, Ted. I agree that Struts is the best option available today. Like
you said, there are areas that Struts can, and probably should, improve. I
am delighted to hear that some of them will be addressed in 2.0.

- Robert.

----- Original Message ----- 
From: "Ted Husted" <hu...@apache.org>
To: <st...@jakarta.apache.org>
Sent: Thursday, December 04, 2003 4:40 AM
Subject: Re: Disadvantages of Struts?


> Yes, we should be passing an API context object instead of tucking
> things away here and there in the various contexts. We started work on
> one during the 1.1 march, but it was sidetracked by the module
> initiative. At this point, it will probably be slated for Stuts 2.0.
>
> The other questions speak to whether you want to take a declarative
> approach to writing a web application. If you are writing a small
> application, the strategy of using XML configurations to deploy object
> graphs can be more trouble than it's worth. But if you are writing a
> larger application, most developers believe it is much better than the
> alternatives. (Been there, done that.) Of course, your mileage may vary.
>
> There are several other web application frameworks available, most of
> which are tracked by the wafer project.
>
> Choosing a framework is like choosing shoes. You really need to try them
> on for yourself to be sure.
>
> Like most software products, Struts is far from perfect. But, like Java
> itself, for complex enterprise applications, many developers find it's
> the best alternative available today. Neither Struts nor Java is the
> best choice for all applications and all teams, but most people do find
> that it is a good choice for larger applications that need to be
> maintained and improved over time.
>
> If there is a disadvantage to using Struts, it's that the underlying
> design is so darn useful that people try to use it as an application
> framework rather than a WEB application framework. Many teams invest
> *way* too much business logic in ActionForms and Actions. Why? Because
> most large application do need to utilize the Context and Command
> patterns. But because they don't have a distinct business framework,
> people usurp the Struts classes.
>
> The Chain of Responsibility package in the Commons Sandbox is a first
> step toward creating a business layer framework. Webwork is doing
> something similiar with their xwork package.
>
> -Ted.
>
> Robert H. Tran wrote:
> > I am not sure that is true. Struts seems to lack of an API. IMO, there
are
> > more required configurations than necessary. Take Action for example, to
> > write an Action, one has to paddle back and forth between the code and
the
> > configuration. It is like an executable having to configure each of its
> > dlls. The visibility of the mappings is nice to have but the mappings
can
> > be generated after the fact as in a debugging view. When the application
is
> > finished, configurations become static. But since configurations are
> > required, they will be like loose ends of the application. Another
issue:
> > how can one componentize his code and deploy it in a self-contained
plug-in,
> > as with Eclipse? Please forgive my novice.
> >
> > - Robert.
> >
> > ----- Original Message ----- 
> > From: "Rick Hightower" <rh...@triveratech.com>
> > To: "'Struts Developers List'" <st...@jakarta.apache.org>
> > Sent: Wednesday, December 03, 2003 6:24 PM
> > Subject: RE: Disadvantages of Struts?
> >
> >
> >
> >>Don't be silly. Struts is perfect.
> >>
> >>-----Original Message-----
> >>From: Robert H. Tran [mailto:rhtran2000@hotmail.com]
> >>Sent: Wednesday, December 03, 2003 2:10 PM
> >>To: Struts Developers List
> >>Subject: Disadvantages of Struts?
> >>
> >>I just wonder if Struts comes with any significant drawback. I mean not
in
> >>terms of when to use Struts and when not to use it necessarily, but more
> >
> > in
> >
> >>the line of anyone's wishes that it had been better. Any advice is very
> >>appreciated.
> >>
>
>
>
> ---------------------------------------------------------------------
> 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


Re: Disadvantages of Struts?

Posted by Ted Husted <hu...@apache.org>.
Yes, we should be passing an API context object instead of tucking 
things away here and there in the various contexts. We started work on 
one during the 1.1 march, but it was sidetracked by the module 
initiative. At this point, it will probably be slated for Stuts 2.0.

The other questions speak to whether you want to take a declarative 
approach to writing a web application. If you are writing a small 
application, the strategy of using XML configurations to deploy object 
graphs can be more trouble than it's worth. But if you are writing a 
larger application, most developers believe it is much better than the 
alternatives. (Been there, done that.) Of course, your mileage may vary.

There are several other web application frameworks available, most of 
which are tracked by the wafer project.

Choosing a framework is like choosing shoes. You really need to try them 
on for yourself to be sure.

Like most software products, Struts is far from perfect. But, like Java 
itself, for complex enterprise applications, many developers find it's 
the best alternative available today. Neither Struts nor Java is the 
best choice for all applications and all teams, but most people do find 
that it is a good choice for larger applications that need to be 
maintained and improved over time.

If there is a disadvantage to using Struts, it's that the underlying 
design is so darn useful that people try to use it as an application 
framework rather than a WEB application framework. Many teams invest 
*way* too much business logic in ActionForms and Actions. Why? Because 
most large application do need to utilize the Context and Command 
patterns. But because they don't have a distinct business framework, 
people usurp the Struts classes.

The Chain of Responsibility package in the Commons Sandbox is a first 
step toward creating a business layer framework. Webwork is doing 
something similiar with their xwork package.

-Ted.

Robert H. Tran wrote:
> I am not sure that is true. Struts seems to lack of an API. IMO, there are
> more required configurations than necessary. Take Action for example, to
> write an Action, one has to paddle back and forth between the code and the
> configuration. It is like an executable having to configure each of its
> dlls. The visibility of the mappings is nice to have but the mappings can
> be generated after the fact as in a debugging view. When the application is
> finished, configurations become static. But since configurations are
> required, they will be like loose ends of the application. Another issue:
> how can one componentize his code and deploy it in a self-contained plug-in,
> as with Eclipse? Please forgive my novice.
> 
> - Robert.
> 
> ----- Original Message ----- 
> From: "Rick Hightower" <rh...@triveratech.com>
> To: "'Struts Developers List'" <st...@jakarta.apache.org>
> Sent: Wednesday, December 03, 2003 6:24 PM
> Subject: RE: Disadvantages of Struts?
> 
> 
> 
>>Don't be silly. Struts is perfect.
>>
>>-----Original Message-----
>>From: Robert H. Tran [mailto:rhtran2000@hotmail.com]
>>Sent: Wednesday, December 03, 2003 2:10 PM
>>To: Struts Developers List
>>Subject: Disadvantages of Struts?
>>
>>I just wonder if Struts comes with any significant drawback. I mean not in
>>terms of when to use Struts and when not to use it necessarily, but more
> 
> in
> 
>>the line of anyone's wishes that it had been better. Any advice is very
>>appreciated.
>>



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


RE: Disadvantages of Struts?

Posted by Rick Hightower <rh...@triveratech.com>.
I don't want to clog up the dev list with a philosophical debate (however
well meaning on Robert's part); no offense intended. I will have to try
harder to avoid such bait in the future. I was being facetious (Playfully
jocular; humorous: facetious remarks), when I said Struts is perfect.

I use Struts and find it useful for projects that I have worked on. It is
not perfect, nor have I found a framework that was perfect. However, I do
not wish to defend it (time is money). Next time you are in Tucson AZ, we
can grab a beer (or coffee) and discuss the finer points at length.

I am going to go with the other well thought out responses and say this
question belongs on the user list.

I will not respond to this thread any longer. My apologies for continuing
this thread on the dev list.

-----Original Message-----
From: Robert H. Tran [mailto:rhtran2000@hotmail.com] 
Sent: Wednesday, December 03, 2003 6:29 PM
To: Struts Developers List
Subject: Re: Disadvantages of Struts?

I am not sure that is true. Struts seems to lack of an API. IMO, there are
more required configurations than necessary. Take Action for example, to
write an Action, one has to paddle back and forth between the code and the
configuration. It is like an executable having to configure each of its
dlls. The visibility of the mappings is nice to have but the mappings can
be generated after the fact as in a debugging view. When the application is
finished, configurations become static. But since configurations are
required, they will be like loose ends of the application. Another issue:
how can one componentize his code and deploy it in a self-contained plug-in,
as with Eclipse? Please forgive my novice.

- Robert.

----- Original Message ----- 
From: "Rick Hightower" <rh...@triveratech.com>
To: "'Struts Developers List'" <st...@jakarta.apache.org>
Sent: Wednesday, December 03, 2003 6:24 PM
Subject: RE: Disadvantages of Struts?


> Don't be silly. Struts is perfect.
>
> -----Original Message-----
> From: Robert H. Tran [mailto:rhtran2000@hotmail.com]
> Sent: Wednesday, December 03, 2003 2:10 PM
> To: Struts Developers List
> Subject: Disadvantages of Struts?
>
> I just wonder if Struts comes with any significant drawback. I mean not in
> terms of when to use Struts and when not to use it necessarily, but more
in
> the line of anyone's wishes that it had been better. Any advice is very
> appreciated.
>
> - Robert.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>

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



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


Re: Disadvantages of Struts?

Posted by "Robert H. Tran" <rh...@hotmail.com>.
I am not sure that is true. Struts seems to lack of an API. IMO, there are
more required configurations than necessary. Take Action for example, to
write an Action, one has to paddle back and forth between the code and the
configuration. It is like an executable having to configure each of its
dlls. The visibility of the mappings is nice to have but the mappings can
be generated after the fact as in a debugging view. When the application is
finished, configurations become static. But since configurations are
required, they will be like loose ends of the application. Another issue:
how can one componentize his code and deploy it in a self-contained plug-in,
as with Eclipse? Please forgive my novice.

- Robert.

----- Original Message ----- 
From: "Rick Hightower" <rh...@triveratech.com>
To: "'Struts Developers List'" <st...@jakarta.apache.org>
Sent: Wednesday, December 03, 2003 6:24 PM
Subject: RE: Disadvantages of Struts?


> Don't be silly. Struts is perfect.
>
> -----Original Message-----
> From: Robert H. Tran [mailto:rhtran2000@hotmail.com]
> Sent: Wednesday, December 03, 2003 2:10 PM
> To: Struts Developers List
> Subject: Disadvantages of Struts?
>
> I just wonder if Struts comes with any significant drawback. I mean not in
> terms of when to use Struts and when not to use it necessarily, but more
in
> the line of anyone's wishes that it had been better. Any advice is very
> appreciated.
>
> - Robert.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>

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


Re: Disadvantages of Struts?

Posted by Graham Leggett <mi...@sharp.fm>.
Robert H. Tran wrote:

> I just wonder if Struts comes with any significant drawback. I mean not in
> terms of when to use Struts and when not to use it necessarily, but more in
> the line of anyone's wishes that it had been better. Any advice is very
> appreciated.

I battled initially to get my head around struts, as it was not clear 
enough to me exactly what the software did, and exactly what the 
software didn't do (which in turn answered the question "what do _I_ 
have to code to get something meaningful to work").

The second hassle I've had is with exceptions being caught and thrown 
away, especially in the DynaBean stuff - as a result I have an unpacked 
version of the struts code in my development tree, which is easy to 
access and amend in a debugger.

Struts is a bit like a swiss army knife, it does many diverse and very 
useful things as part of the greater goal: building a web app. It's just 
not all that clear as to exactly what it does sometimes. On the whole 
though, it's really useful - I have just had the opportunity to build a 
system from scratch (as opposed to retrofit struts to a previous 
disas^H^H^H^H^Hproject, yuck), and it has on the whole been an enormous 
timesaver, and really useful.

Regards,
Graham
--


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


RE: Disadvantages of Struts?

Posted by Rick Hightower <rh...@triveratech.com>.
Don't be silly. Struts is perfect. 

-----Original Message-----
From: Robert H. Tran [mailto:rhtran2000@hotmail.com] 
Sent: Wednesday, December 03, 2003 2:10 PM
To: Struts Developers List
Subject: Disadvantages of Struts?

I just wonder if Struts comes with any significant drawback. I mean not in
terms of when to use Struts and when not to use it necessarily, but more in
the line of anyone's wishes that it had been better. Any advice is very
appreciated.

- Robert.

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



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


RE: Disadvantages of Struts?

Posted by Steve Raeburn <sr...@apache.org>.
This question should really be addressed to the struts-user list.

Thanks

Steve

> -----Original Message-----
> From: Robert H. Tran [mailto:rhtran2000@hotmail.com]
> Sent: December 3, 2003 2:10 PM
> To: Struts Developers List
> Subject: Disadvantages of Struts?
> 
> 
> I just wonder if Struts comes with any significant drawback. 
> I mean not in
> terms of when to use Struts and when not to use it 
> necessarily, but more in
> the line of anyone's wishes that it had been better. Any 
> advice is very
> appreciated.
> 
> - Robert.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
> 
> 


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


Disadvantages of Struts?

Posted by "Robert H. Tran" <rh...@hotmail.com>.
I just wonder if Struts comes with any significant drawback. I mean not in
terms of when to use Struts and when not to use it necessarily, but more in
the line of anyone's wishes that it had been better. Any advice is very
appreciated.

- Robert.

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


RE: Enhancement in forms

Posted by Steve Raeburn <sr...@apache.org>.
Struts *does* support both the input and validation of dates in
international formats. See struts-validator.war in the Struts
distribution for an example.

I suspect you are defining a field on your ActionForm as type
java.util.Date and expecting Struts to correctly populate it. That is
not recommended and would only work with a date in yyyy-MM-dd format, as
you have found.

The ActionForm is *not* a business bean, it is merely a buffer for data
from your HTML form. ActionForms allow data to be validated before being
passed to your application and buffer the input values so they can be
redisplayed to the user (if a validation error occurs, for example).
Since form values are supplied via HTTP as Strings, it is recommended
that you only use Strings (and possibly booleans) in your ActionForms.

There are a couple of ways you can transfer form values to your business
beans:
1. Copy the properties to a business bean in your Action (possibly using
BeanUtils).
2. Add extra getters to your ActionForm that perform the type
conversions.

If you employ the second strategy you might have an ActionForm with a
StartDate property that returns a String. To get a Date, you could add a
second method, e.g. getStartDateAsDate() that performs the conversion
and returns a Date.

The two options are not mutually exclusive. Use whatever works for you.

For more info, please search the struts-user list archives. This subject
has cropped up before and you may find alternative explanations useful.

Steve


> -----Original Message-----
> From: stutz@bb.com.br [mailto:stutz@bb.com.br]
> Sent: December 3, 2003 10:21 AM
> To: Struts Developers List
> Subject: Enhancement in forms
>
>
>
>
> Hello pros,
>
>      I am using Struts and found a bad problem: it doesn't accept
> internacionalized input for dates and numbers.
>      As experimented, dates are accepted only in the
> 'yyyy-MM-aa' pattern.
> I posted this bug at bugzilla for  Struts and commons-beanutils as I
> couldn't use it in the RequestProcessor to perform the
> localized populate.
>      I have a version of the RequestProcessor and
> common-beanutils here
> that works all right as I fixed them, posted the patches to
> bugzilla and I
> am waiting for something to happen!
>      Why doesn't Struts implement this feature? If it
> implements, how's
> it's used?
>
>      Will my patches be used for fixing theses bugs or I am
> doing it the
> wrong way?
>      I really need answers because it involves a very
> important project
> that will change the future of my company... one of our
> problems is that we
> have proprietary frameworks everywhere and we want to change
> to Struts if
> it fits our needs for the view layer.
>
>      Thank you guys,
>
> Stutz
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-dev-help@jakarta.apache.org
>
>
>



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