You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Carlos Pita <cp...@tycdigital.com> on 2001/03/07 04:14:19 UTC
Some proposals
Hi!
I'm writing to this list for the first time. I have recently been using
struts 1.0 b1 for a commercial development and I feel that some important
functionality is missing (at least in the tag libraries). So I would like to
help coding these tags or functionality if you agree with me; really, I
would not write a line of code (well, perhaps I'd write one) for my project
if I feel that I'm going to far from Struts' way or Struts next release and
also I'd like to callaborate with you.
So, here are the proposals:
1) The define tag, in the beans tag library is ok, but sometimes I'd
like to assign a new value to an already defined "variable". Perhaps this is
a too programmatic feature that we should avoid in JSP pages, what do you
think? But then we could have a tag that defines some kind of scope inside
which defined beans are accessible. The reason for suggesting this was that
I had to write a page where some large collections of items were generated
(and returned by getter methods in beans) and showed, and reassigning them
or putting them out of scope after use, in order to let them be
garbage-collected, would be the right thing to do (they were an important
number of really large collections).
2) Some functionallity is missing from the iterate tag in the logic tag
library. For example, iterating over an Enumeration (well, I'm not sure this
is not currently possible, but documentation says that the tag iterates over
Collections). This would be useful because a lot of Java APIs returns
Enumerations instead of Collections. Another good thing (although
dangerous... you have the last word about this) that this pretty tag could
do for us is to iterate over ResultSets; this would be very handy if
moderately used (sometimes -often- we are in a hurry).
3) For the options tags in the html library a good suggestion is: giving
the tag a name and a property, it should be able of iterating over the
collection/array/enumeration/?resultset? returned by this property; I mean,
sometimes beans don't have a property with a collection of values and a
property with a collection of labels but a property with a collection of
beans with 2 different properties for values and labels instead. I know the
tag offers the collection attribute, but this would be a little cumbersome
to use in the explained case. Also, from the utilities currently offered by
the tag, the proposed one seems to be someway logically missing.
4) The conditional tags in the logic library are too coarse. They need
some kind of alternative-clause, like an else or cases. Most of the code
that I was able to get with the current conditional logic facilities is very
inefficient and hard to read; this is an almost free addon to the inherent
inefficience and code mess appearing in the normal process of writing HTML
pages.
5) The errors tag should be more capable of controlling the presentation
of its output. I think it's a very dirty solution to write html in the
application resources file. The examples someway hide this, showing property
values like: "<li>Invalid format for From Address</li>", but real
applications would have an important percentage of html (or some kind of
presentational information) embedded in the resources file. This is not
easily mantenible and internationalization support would be very cumbersome
to achieve in this scenario (having to update several files and lot of items
in these files with duplicated information about presentation). I suggest
that the errors tag should let the programmer to specify some kind of
formatting content, preferently as the content of the tag and inside
sections like
<start-of-item>,<end-of-item>,<start-of-list>,<end-of-list>,<no-errors>,
etc. (by the way, this would be very useful with any iterator tag; perhaps
we should have to subclass from some basic iterator tag class, or to have
some kind of hierarchy here, but I've not seen the current code so I could
not say any more about this).
Well, I think this is all for now. I've thought some solutions for each
of the enumerated problems, but I would like to hear your oppinion about
these being real problems before explaining or discussing them.
See you,
Carlos
Ah... sorry if my English is not the best
Re: Some proposals
Posted by Carlos Pita <cp...@tycdigital.com>.
Hi!
The constant is named Action.ERROR_KEY, and under it you can find the
entire ActionErrors instance. So if you have to show individual errors (or
lists of errors) under keys, you will find yourself dealing with code like:
<bean:define id="errors" name="<%=Action.ERROR_KEY%>" scope="request"
type="ActionErrors"/>
<% if(errors!=null && errors.size("firstName")>0) { %>
<tr bgcolor="#FFCCCC" align="center" valign="middle" bordercolor="#FFCCCC">
<td colspan="2" height="31" class="arial9-pad6l-red" align="left">Error:
<struts:errors property="firstName"/></td>
</tr>
<% } %>
This seems to me far from ideal and it's based on the supossition that
there will be only one error under each key. And if all that you want to do
is to list the entire collection of errors, you still should put the
presentational content related to individual items (the <tr><td> o <li>
stuff, if you are lucky) in the resources file.
If I am too wrong and there is a really better way to get the same
results, please stop me.
See you,
Carlos
----- Original Message -----
From: "Nick Pellow" <ni...@cortexebusiness.com.au>
To: <st...@jakarta.apache.org>
Sent: Wednesday, March 07, 2001 1:13 AM
Subject: Re: Some proposals
>
>
> Carlos Pita wrote:
> >
> > 5) The errors tag should be more capable of controlling the
presentation
> > of its output. I think it's a very dirty solution to write html in the
> > application resources file. The examples someway hide this, showing
property
> > values like: "<li>Invalid format for From Address</li>", but real
> > applications would have an important percentage of html (or some kind of
> > presentational information) embedded in the resources file. This is not
> > easily mantenible and internationalization support would be very
cumbersome
> > to achieve in this scenario (having to update several files and lot of
items
> > in these files with duplicated information about presentation). I
suggest
> > that the errors tag should let the programmer to specify some kind of
> > formatting content, preferently as the content of the tag and inside
> > sections like
> > <start-of-item>,<end-of-item>,<start-of-list>,<end-of-list>,<no-errors>,
> > etc. (by the way, this would be very useful with any iterator tag;
perhaps
> > we should have to subclass from some basic iterator tag class, or to
have
> > some kind of hierarchy here, but I've not seen the current code so I
could
> > not say any more about this).
>
> You can do this:
> (Please correct me if there is a better way)
>
> <logic:present parameter="org.apache.struts.action.ERROR"> (parameter,
> even though "org.apache.struts.action.ERROR" is an attribute?)
> ... all the html you want here
> <html:errors/>
> ... and here
> </logic:present>
>
> <logic:notPresent parameter="org.apache.struts.action.ERROR">
> Display this otherwise.
> </logic:notPresent>
>
>
>
> I would like to a write two tags however, that look like the following:
>
> <html:inError>
> <html:errors/>
> </html:inError>
>
> <html:notInError>
>
> Display this otherwise
>
> </html:notInError>
>
> Any objections to the above suggestion?
>
>
> Cheers,
> Nick
>
>
> > Well, I think this is all for now. I've thought some solutions for
each
> > of the enumerated problems, but I would like to hear your oppinion about
> > these being real problems before explaining or discussing them.
> >
> > See you,
> > Carlos
> >
> > Ah... sorry if my English is not the best
>
Re: Some proposals
Posted by Wong Kok Wai <wo...@pacific.net.sg>.
Send a message to struts-dev-unsubscribe@jakarta.apache.org (no subject or
message body needed). Wait for a acknowledgement and reply to that
acknowledgement.
Martin Quinn wrote:
> Sorry folks - i don't know how i got on the list - but i need to get off it.
> I did reply to the remove list but to not avail.
>
Re: Some proposals
Posted by Ana Narvaez Vila <an...@sema.es>.
There are two lists, users and dev and you were include in both of them.
Yesterday you remove from user's list and now, you must remove from
dev's list.
<st...@jakarta.apache.org>
Bye
Martin Quinn wrote:
>
> Sorry folks - i don't know how i got on the list - but i need to get off it.
> I did reply to the remove list but to not avail.
>
> Daniel Ostermeier wrote:
>
> > >
> > > I would like to a write two tags however, that look like the following:
> > >
> > > <html:inError>
> > > <html:errors/>
> > > </html:inError>
> > >
> > > <html:notInError>
> > >
> > > Display this otherwise
> > >
> > > </html:notInError>
> > >
> > > Any objections to the above suggestion?
> >
> > Just one suggestion/objection.
> >
> > Im not that farmiliar with struts, so i may be out in left field here.
> > When i see <html:...> i expect to tags that are supported by the html
> > specification - or struts modified versions at least. However, there is
> > no real concept of "error" in html. For this reason, i would prefer
> > these sort of tags called <processing:error> for example.
> >
> > That is, i would prefer error moved away from the other html tags.
> >
> > Daniel
------------------------------------------------------------------
This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of Sema Group.
If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing, or copying of this email is strictly prohibited.
------------------------------------------------------------------
Re: Some proposals
Posted by Martin Quinn <ma...@irista.com>.
Sorry folks - i don't know how i got on the list - but i need to get off it.
I did reply to the remove list but to not avail.
Daniel Ostermeier wrote:
> >
> > I would like to a write two tags however, that look like the following:
> >
> > <html:inError>
> > <html:errors/>
> > </html:inError>
> >
> > <html:notInError>
> >
> > Display this otherwise
> >
> > </html:notInError>
> >
> > Any objections to the above suggestion?
>
> Just one suggestion/objection.
>
> Im not that farmiliar with struts, so i may be out in left field here.
> When i see <html:...> i expect to tags that are supported by the html
> specification - or struts modified versions at least. However, there is
> no real concept of "error" in html. For this reason, i would prefer
> these sort of tags called <processing:error> for example.
>
> That is, i would prefer error moved away from the other html tags.
>
> Daniel
RE: Some proposals
Posted by Daniel Ostermeier <da...@cortexebusiness.com.au>.
>
> I would like to a write two tags however, that look like the following:
>
> <html:inError>
> <html:errors/>
> </html:inError>
>
> <html:notInError>
>
> Display this otherwise
>
> </html:notInError>
>
> Any objections to the above suggestion?
Just one suggestion/objection.
Im not that farmiliar with struts, so i may be out in left field here.
When i see <html:...> i expect to tags that are supported by the html
specification - or struts modified versions at least. However, there is
no real concept of "error" in html. For this reason, i would prefer
these sort of tags called <processing:error> for example.
That is, i would prefer error moved away from the other html tags.
Daniel
Re: Some proposals
Posted by Nick Pellow <ni...@cortexebusiness.com.au>.
Carlos Pita wrote:
>
> 5) The errors tag should be more capable of controlling the presentation
> of its output. I think it's a very dirty solution to write html in the
> application resources file. The examples someway hide this, showing property
> values like: "<li>Invalid format for From Address</li>", but real
> applications would have an important percentage of html (or some kind of
> presentational information) embedded in the resources file. This is not
> easily mantenible and internationalization support would be very cumbersome
> to achieve in this scenario (having to update several files and lot of items
> in these files with duplicated information about presentation). I suggest
> that the errors tag should let the programmer to specify some kind of
> formatting content, preferently as the content of the tag and inside
> sections like
> <start-of-item>,<end-of-item>,<start-of-list>,<end-of-list>,<no-errors>,
> etc. (by the way, this would be very useful with any iterator tag; perhaps
> we should have to subclass from some basic iterator tag class, or to have
> some kind of hierarchy here, but I've not seen the current code so I could
> not say any more about this).
You can do this:
(Please correct me if there is a better way)
<logic:present parameter="org.apache.struts.action.ERROR"> (parameter,
even though "org.apache.struts.action.ERROR" is an attribute?)
... all the html you want here
<html:errors/>
... and here
</logic:present>
<logic:notPresent parameter="org.apache.struts.action.ERROR">
Display this otherwise.
</logic:notPresent>
I would like to a write two tags however, that look like the following:
<html:inError>
<html:errors/>
</html:inError>
<html:notInError>
Display this otherwise
</html:notInError>
Any objections to the above suggestion?
Cheers,
Nick
> Well, I think this is all for now. I've thought some solutions for each
> of the enumerated problems, but I would like to hear your oppinion about
> these being real problems before explaining or discussing them.
>
> See you,
> Carlos
>
> Ah... sorry if my English is not the best