Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet with Javascript

 
mehta soham
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we able to write javascript function in Servlet? if yes then please tell and if not then can v bind javascript code with servlet?
 
D. Ogranos
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No.

Servlet -> server side code
Javascript -> client side code

They simply don't mix.
 
Shailesh Narkhede
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Soham,
Welcome to javaranch,

can you post your requirement in breif?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Most people think browser side only when the term JavaScript is mentioned, but JavaScript as a language can be executed on the server side.

Naturally it can only affect server side entities, NOT the client browser API.

A variety of scripting languages are supported by Java as explained in this article.

Bill
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DWR goes a long way towards bridging the Java/JavaScript gap, but you might want to hold off on that until you're more familiar with the underlying technologies.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic