struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pasi Salminen <pasi.salmi...@profithome.com>
Subject Re: What are the goals of struts and a few ideas?
Date Thu, 17 Aug 2000 05:34:13 GMT
Hans Gerwitz wrote:

> Eventually, I'd like to
> extend the form tag to test for the errors collection and use JavaScript to
> place focus on the first invalid field.  It'd also be nice to add an
> "errorClass" attribute to message (or create a prompt tag) so that invalid
> fields can have their prompts bolded, etc.

I done this by introducing a new tag for labels <prefix:label for="property"/>. So
instead of returning just error messages from the action or from the bean, I'm
putting the Errors collection into request attribute. Error objects contain
property-errorCode pairs. The label asks it's parent FormTag to return the
errorCollection and if its not null it knows it's dealing with error condition. In
that case the label renders itself with with a coloured font if, and only if, the
error collection contains an Error object for this attribute (asked with
errors.findError( getProperty( ) ) ). Also, the label then renders itself as an
URL containing the servlet which returns the error text, error code and current
locale. So if the user REQUESTs for more information, he/she can click the label
which opens a new window with JavaScript showing the contents of the URL (which is
output by the ErrorTextServlet). By using CSS I could easily change the way the
label is rendered, but I haven't had enough time/interest to do that.

Greetings,

Paci

Hans Gerwitz wrote:

> > * Is it possible (I mean, what is the impact on existing code) to have the
> > validate() functions to return a Hashtable (or a ErrorsCollection structure)
> > instead of a String[]? With the extension of the <struts:errors /> tag to
> > have a "property" attribute, one would be able to retrieve a specific field
> > error instead of the list of all form errors.
> > And presently, only storing the key of the error message to display doesn't
> > permit to have parameters {0} in the message.
>
> I've been meaning to request this for some time.  Eventually, I'd like to
> extend the form tag to test for the errors collection and use JavaScript to
> place focus on the first invalid field.  It'd also be nice to add an
> "errorClass" attribute to message (or create a prompt tag) so that invalid
> fields can have their prompts bolded, etc.
>
> > * I missed a <struts:getForward forward="..." /> to be able to obtain the
> > name of a logical forward in a page, without performing a redirect or
> > forward action. This can be used in JavaScript to obtain the name of a page.
>
> This is a nice idea, and simply done.  I'm sure someone will have that
> implemented soon.
>
> > * I would love a more general <if> tag, supporting a <else> subtag,
in place
> > of the specific <ifParameterX> variants:
> > <if>
> > <condition>...</condition>
> > <then>...</then>
> > <else>...</else>
> > </if>
> > Yes, I can already do it with <% ... %>, but...
>
> This probably belongs in jakarta-taglibs.  As a lowly user who hasn't
> contributed to the codebase :-), I see struts as a "product" that provides
> us a framework for implementing the "controller" and "view" portions of an
> MVC application.  [btw, we use MVC incorrectly in the web world... IMHO,
> this is a Presentation-Abstraction-Control pattern... but the masses have
> spoken, so MVC it is to be known]
>
> > * Have the option in the <struts:message /> to filter the message string
> > against HTML sensible characters (for instance replace é by &eacute;).
>
> Another great suggestion.  I'd like to see this for every tag appropriate,
> as well (an htmlEscape attribute?)
>
> > * Find a client locale detector.
>
> I haven't had to i8n an app yet, so I can't comment on locale management.
>
> > * And last, JDBC connectivity. But for the moment, this is better managed by
> > my application proprietary tags.
>
> No!  No JDBC connectivity in struts!  That would make it far too easy for
> the Model logic and data tiers to creep into the view.
>
> BTW, I have a few developers implementing struts in their projects, and
> beyond the initial training in MVC, it has been an amazingly smooth ride!
> I'm going to go light a few more candles in my Craig McClanahan shrine, now
> ;-)
>
> Hans Gerwitz
> hava@phobia.com


Mime
View raw message