That's cool. In my case, I can't change to a different template engine. I'm a bit surprised that JSP doesn't have more cool tools, especially since one of the advantages is that it has been around a long time. It is also frustrating that (as mentioned) you will see a compile error when using scriptlets (ugly old scriptlets) but don't have a warning when writing bad EL code.
Thanks,
Ross
To: seajug-***@public.gmane.org
From: kgignatyev-***@public.gmane.org
Date: Tue, 14 Jan 2014 09:45:37 -0800
Subject: Re: [seajug] Validating JSP EL
Any other tips are appreciated (please don't tell me to use anything besides JSP).
Anyway, thanks kingn for the useful tip. It looks like there may not be anything that does the static analysis I want (or it may be too hard to find). It doesn't sound too hard to build, either. A static analysis would only get me so far, of course, so a more robust solution is probably in order anyway (I just wanted to do something quick to find the obvious mistakes).
Thanks,
Ross
To: seajug-***@public.gmane.org
From: kgignatyev-***@public.gmane.org
Date: Tue, 14 Jan 2014 07:56:02 -0800
Subject: Re: [seajug] Validating JSP EL
Why bother? JSP is far from being good as page templating solution, the only advantage/difference JSP had from PHP was its use of scriptlets <%= c.someMethodOrField %> to allow static analysis of correctness.
Wicket allows for way more effective page composition from components if you want to compose page on server. It has Models which can be implemented with using compiled code rather than dotted strings, and those ensure that all properties do indeed exist.
for example widely used property model use in Wicket looks like thisnew Label("user-name-1", new PropertyModel[String](this, "session.user.fullName"))
and this has the same problem of checking if user has method or field fullName
but with language like Scala it looks
new Label("user-name-2", ROModel(() => { DemoSession().user.fullName }))
but one could write
class FullNameModel implements IModel<String> { ..... full Java ceremony code}
That would ensure correctness of whole system but slows down development quite a bit, if however used with JRebel on fast machine it feels almost like PHP in terms of development feedback speed.
BUT:I have been doing this for quite some time and liked it, but I mastered AngularJS a bit as of recently and there is no turning back. Yes, AngularJS is dynamic, no static checks, etc. but overall it is way more productive and convenient way of creating pages with dynamic behavior. Since there are no (almost) global things in AngularJS it all feels quite controllable.
On Tue, Jan 14, 2014 at 3:20 AM, <***@u.washington.edu> wrote:
It would be nice to have static analysis of the useBean JavaBeans available as a plugin
in the IDEs that validates the properties of the bean using reflection.
It would be nice if that were available in the org/apache/jasper/compiler/ package too.
I've not seen it if someone has written one for jsp.
For testing of jsp pages (runtime checking before your production deployment), I tend to inject QUnit with tests into the jsp file using a template framework and
then I deploy that to run the tests in the browser.
--
Konstantin Ignatyev
PS: If this is a typical day on planet Earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000
Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206)
--
Konstantin Ignatyev
PS: If this is a typical day on planet Earth, humans will add fifteen million tons of carbon to the atmosphere, destroy 115 square miles of tropical rainforest, create seventy-two miles of desert, eliminate between forty to one hundred species, erode seventy-one million tons of topsoil, add 2,700 tons of CFCs to the stratosphere, and increase their population by 263,000
Bowers, C.A. The Culture of Denial: Why the Environmental Movement Needs a Strategy for Reforming Universities and Public Schools. New York: State University of New York Press, 1997: (4) (5) (p.206)