Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java script in jsp  RSS feed

 
Jyoti Vaskar
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is using JavaScript in jsp a good practice??

A web-designer needs to know about java script??

Or it is outdated??
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is *JavaScript* outdated?! Short answer: no way, not even close. Did something give you that impression?

Is using JS in a JSP a good idea? IMO, not really--JavaScript code should live in JavaScript files. There are some reasons why *completely* eliminating embedded JS isn't always practical, but it's generally considered a good practice to keep as much JavaScript as possible external.

Does a web *designer* need to know about JavaScript? Not really, but knowing it can help keep their expectations under control--sometimes designers have a tendency to think web developers can do *anything* with no effort, which isn't true.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
149
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jyoti Vaskar wrote:Or it is outdated??

Are you joking? Have you not been using the Internet?

JavaScript is more important than ever. DOM-scripted applications (formerly known as Rich Internet Applications, formerly known as Web 2.0 -- my how catch-phrases come in and out of popularity quickly!) are everywhere!

Is using JavaScript in jsp a good practice??

As a JSP is merely a means to create an HTML page, that's not really a meaningful question. What's considered best practice these days is the use of "Unobtrusive JavaScript", in which no JavaScript is embedded in the HTML constructs that create the structure of the page. Rather, the script is sequestered to the header, or to externals script files. I'll differ slightly with David on that: I think it's fine to place page-specfic script in a page, as long as it's in the head and not embedded in the structure elements.

A web-designer needs to know about java script??

Only if you want a job. As a practical consideration, no one wants pure designers anymore. I have a friend who was forced out of the industry, because although he was a top-notch designer, he knows no coding (and has no interest in it). Companies have no interest in anyone who cannot also code. He showed up at one interview, where the job description described a pure design job, and started getting asked question on Hibernate. It's a ridiculous situation.

 
Jyoti Vaskar
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks David & Bear for replying.

I was actually confused about weather to embeed the javascript code in jsp & heard not to do so.......
so was under wrong impression that is outdated?

Now I am clear with it .

thanks a lot.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
149
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jyoti Vaskar wrote:I was actually confused about weather to embeed the javascript code in jsp & heard not to do so.......

Again, the use of "JSP" here can be confusing. To the JSP engine, JavaScript is just so much template text, so it's really imprecised to talk about JSP and JavaScript. Rather, embedding JavaScript within the HTML elements that form the structure of the document is what should be avoided.

In particular, the use of onclick, and the other onxyz event handler attributes should be avoided.
 
Jyoti Vaskar
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Jyoti Vaskar wrote:I was actually confused about weather to embeed the javascript code in jsp & heard not to do so.......

Again, the use of "JSP" here can be confusing. To the JSP engine, JavaScript is just so much template text, so it's really imprecised to talk about JSP and JavaScript. Rather, embedding JavaScript within the HTML elements that form the structure of the document is what should be avoided.

In particular, the use of onclick, and the other onxyz event handler attributes should be avoided.


Thanku Bear.

I think this is a perfect & a very useful information .
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(I'll disagree with Bear about pure designers no longer being used--they're all over the place, at least in NYC :)
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
149
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:(I'll disagree with Bear about pure designers no longer being used--they're all over the place, at least in NYC :)

I wish I could disagree with me too. Maybe it's just an Austin thing...
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37222
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:(I'll disagree with Bear about pure designers no longer being used--they're all over the place, at least in NYC :)

Same here. Of course we are talking about the same city. Some designers are pure designers. Others are expected to know JavaScript to show what some basic interactions would look like.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66187
149
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently, my friend needs to move to the Big Apple.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!