Re: FormatNumberTag

2009-07-11 Thread Rusty Wright

Here's a quote from the Spring docs about the open/closed principal that I 
think Henri is alluding to:

“Open for extension...”
One of the overarching design principles in Spring Web MVC (and in Spring in 
general) is the “Open for extension, closed for modification” principle.

The reason that this principle is being mentioned here is because a number of 
methods in the core classes in Spring Web MVC are marked final. This means of 
course that you as a developer cannot override these methods to supply your own 
behavior... this is by design and has not been done arbitrarily to annoy.

The book 'Expert Spring Web MVC and Web Flow' by Seth Ladd and others explains 
this principle and the reasons for adhering to it in some depth on page 117 
(first edition) in the section entitled 'A Look At Design'.

If you don't have access to the aforementioned book, then the following article 
may be of interest the next time you find yourself going “Gah! Why can't I 
override this method?” (if indeed you ever do).

1. Bob Martin, The Open-Closed Principle (PDF)

Note that you cannot add advice to final methods using Spring MVC. This means 
it won't be possible to add advice to for example the 
AbstractController.handleRequest() method. Refer to Section 6.6.1, 
“Understanding AOP proxies” for more information on AOP proxies and why you 
cannot add advice to final methods.

(The link to the pdf no longer works; it was going to www.objectmentor.com; I 
think you can still find it if you hunt around on that site.  The name of the 
file is ocp.pdf.)


Henri Yandell wrote:

Generally agreed. With public APIs I've learnt to be stronger on
making things private as it tends to only come back to bite you if you
try to over think it; and when it's public you have no ability to
identify all the use cases so you end up in legacy hell.

I just fix the bugs though - I wasn't an original developer :) I
suspect their focus was strongly on implementing the spec and less on
the implementation classes themselves.

Hen

On Sat, Jul 11, 2009 at 1:32 AM, Stuart Thielstuart.th...@gmail.com wrote:

Hello Henri,

Yes, that would solve my immediate problem. It is a bit of a one-off hack,
though. The follow-through would be to take a look at all the classes and
identify areas where hooks like that would be desirable.

It is perhaps a difference in philosophies of programming, but my preference
is generally to use protected methods instead of private methods (and avoid
final methods at all costs), and that would be my preferred approach here (I
don't know your direct involvement thusfar into how things are). However,
consistency is also good to see in a project, and it's not my show, so I'm
less inclined to prosthelytize on how to do it right. I'd be glad to go on
at length as to why I think the protected methods approach would be best,
but will only do so upon request.

Stuart

Henri Yandell wrote:

I didn't explain myself well.

Basically I would insert reconfigureFormatter(NumberFormat/DateFormat)
inside doEndTag. By default it would nothing.

On Fri, Jul 10, 2009 at 5:03 AM, Stuart Thielstuart.th...@gmail.com
wrote:



-
To unsubscribe, e-mail: taglibs-user-unsubscr...@jakarta.apache.org
For additional commands, e-mail: taglibs-user-h...@jakarta.apache.org




-
To unsubscribe, e-mail: taglibs-user-unsubscr...@jakarta.apache.org
For additional commands, e-mail: taglibs-user-h...@jakarta.apache.org



-
To unsubscribe, e-mail: taglibs-user-unsubscr...@jakarta.apache.org
For additional commands, e-mail: taglibs-user-h...@jakarta.apache.org



namespace and taglibs?

2009-01-07 Thread Rusty Wright

I don't understand why I didn't get any errors from tomcat when I was missing 
the standard taglibs and using the jstl core in my jsp.  Once I added the 
dependency for standard taglibs to my maven pom.xml then c:forEach started 
working; without the dependency it was silently ignored.  Is there something I 
can tweak so that in the future any namespace that I declare in my jsp will 
generate an error if the jar file it needs is missing?

My jsp started as follows:

?xml version=1.0 encoding=ISO-8859-1 ?

jsp:root xmlns:jsp=http://java.sun.com/JSP/Page; version=2.1
   jsp:directive.page
   language=java
   contentType=text/html; charset=ISO-8859-1
   pageEncoding=ISO-8859-1
   /

   jsp:output
   omit-xml-declaration=false
   doctype-root-element=html
   doctype-public=-//W3C//DTD XHTML 1.0 Transitional//EN
   doctype-system=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
   /

   html
   xmlns:c=http://java.sun.com/jsp/jstl/core;
   xmlns=http://www.w3.org/1999/xhtml;
   head
   meta
   http-equiv=Content-Type
   content=text/html; charset=ISO-8859-1
   /

-
To unsubscribe, e-mail: taglibs-user-unsubscr...@jakarta.apache.org
For additional commands, e-mail: taglibs-user-h...@jakarta.apache.org