File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Servlet with Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet with Javascript" Watch "Servlet with Javascript" New topic

Servlet with Javascript

mehta soham

Joined: May 27, 2009
Posts: 8
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?

Dare Devil
D. Ogranos
Ranch Hand

Joined: Feb 02, 2009
Posts: 214

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

They simply don't mix.
Shailesh Narkhede
Ranch Hand

Joined: Jul 10, 2008
Posts: 365
Hi Soham,
Welcome to javaranch,

can you post your requirement in breif?

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12674
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.


Java Resources at
David Newton

Joined: Sep 29, 2008
Posts: 12617

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.
jQuery in Action, 2nd edition
subject: Servlet with Javascript
Similar Threads
Filtering the file names
Server Side JavaScript Question
calling a servlet from javascript function??
JOptionPane No X11 DISPLAY error
can i use javascript inside the servlet