Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2494

Re: LINTing Javascript in a Java WebApp

X-Received by 10.224.33.196 with SMTP id i4mr1156218qad.8.1360691145935; Tue, 12 Feb 2013 09:45:45 -0800 (PST)
X-Received by 10.49.116.139 with SMTP id jw11mr1321118qeb.12.1360691145912; Tue, 12 Feb 2013 09:45:45 -0800 (PST)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!p13no12133367qai.0!news-out.google.com!k2ni24985qap.0!nntp.google.com!p13no12133365qai.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.java.help
Date Tue, 12 Feb 2013 09:45:45 -0800 (PST)
In-Reply-To <kfdgms$4f4$1@dont-email.me>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=173.164.137.214; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T
NNTP-Posting-Host 173.164.137.214
References <kfb9jr$69d$1@dont-email.me> <3b447074-316f-4e1a-bb0f-0b54b4a547b6@googlegroups.com> <kfdgms$4f4$1@dont-email.me>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <c7e5d4de-59ea-4309-acc4-e83bb698cfd6@googlegroups.com> (permalink)
Subject Re: LINTing Javascript in a Java WebApp
From Lew <lewbloch@gmail.com>
Injection-Date Tue, 12 Feb 2013 17:45:45 +0000
Content-Type text/plain; charset=ISO-8859-1
Xref csiph.com comp.lang.java.help:2494

Show key headers only | View raw


Steve wrote:
> Lew wrote:
>> Steve wrote:
>>> I have a number a Java webapp with a number of embedded ( in JSPs )
>>> Javascripts and straight *.js files.
>
>> Hmm. Not a good clean separation there.
>
>>> More than few times I've built the webapp and deployed it only to find
>>> I've made a trivial error, like forgetting a semicolon in the Javascript.
>>
>> Why do you need so much Javascript?
>
> Some of it client side data validation that was done a long time ago 
> before frameworks made server side data validation less of a PITA. 
> Some of it is to enforce rules the users asked for ( example, if check 
> box A is selected client side, disable textfield B, etc, etc ).  Some of 
> it is AJAX used to decrease the number of screens the user has to 
> submit.  Some of is gluing in various JQuery features, like a pop-up 
> calendar for picking dates ( not something I asked for, the users love it ).

I've worked on projects like this. Never mind the JSP, all these Javascript 
frameworks tend to interfere with each other and cause more bugs than they 
help with.

Are you familiar with "technical debt"? It sounds like you're paying a lot just 
in interest.

I recommend that you gradually (since management won't buy in or give you time)
refactor the JS to make sense. Dump old, unsupported versions of any frameworks
you're using, and clean up the separation just between the JS parts.

Consider using Facelets/XHTML with new stuff. Make sure your changes remain 
compatible with existing code and you won't need to make sweeping, all-at-once
revolutionary upheavals.

But if you do nothing, this system will creak until it cracks. 

... [snip] ...

>> It seems wrong to put a lot of JS into a JSP. Or any, really.
> 
> I've been hearing that since the year 2,000.  I would still love for it 
> to be true :)

Congratulations. It is true. Sort of.

Hand-coded Javascript is what I was talking about. Even auto-generated 
Javascript can be dangerous, but not all APIs are equally guilty.

>> But you might try using static pages
>> with the same Javascript and debug the JS that way.
>> Freeze one possible output that the JSP
>> might generate and try to use its Javascript.
> 
> That is pretty much what I have been doing.  I was hoping for the 
> convenience of type as you go error highlighting like I can get with Java.

Hope away.

-- 
Lew

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

LINTing Javascript in a Java WebApp Steve <tinker123@gmail.com> - 2013-02-11 12:26 -0500
  Re: LINTing Javascript in a Java WebApp Roedy Green <see_website@mindprod.com.invalid> - 2013-02-11 11:42 -0800
    Re: LINTing Javascript in a Java WebApp Steve <tinker123@gmail.com> - 2013-02-12 08:40 -0500
  Re: LINTing Javascript in a Java WebApp Lew <lewbloch@gmail.com> - 2013-02-11 12:45 -0800
    Re: LINTing Javascript in a Java WebApp Steve <tinker123@gmail.com> - 2013-02-12 08:40 -0500
      Re: LINTing Javascript in a Java WebApp Lew <lewbloch@gmail.com> - 2013-02-12 09:45 -0800
        Re: LINTing Javascript in a Java WebApp Steve <tinker123@gmail.com> - 2013-02-13 14:26 -0500
          Re: LINTing Javascript in a Java WebApp Lew <lewbloch@gmail.com> - 2013-02-13 14:56 -0800
    Re: LINTing Javascript in a Java WebApp Roedy Green <see_website@mindprod.com.invalid> - 2013-02-13 18:43 -0800

csiph-web