Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: can we use javascript inside a java servlet


Message #1 by "shraddha" <skagalwa@n...> on Wed, 26 Jun 2002 14:06:17 -0400
Hi, it is perfectly legal writting javascript in servlet.
But you have to becareful when writting your html using out.println.
why dont use jsp for your front end??
BTW here is a simple code demostate the javascript function in servlet.

out.write ("<html><head></head><script language=\"javascript\">function 
validateUpdate(){alert(\"Hi\")};</script><H1> Hi have a nice day. </H1>");
out.write ("<input type=\"button\" name=\"confirm\" value=\"confirm\" 
onclick =\"validateUpdate()\">");
out.flush();
out.close();


>From: "shraddha" <skagalwa@n...>
>Reply-To: "javascript" <javascript@p...>
>To: "javascript" <javascript@p...>
>Subject: [javascript] can we use javascript inside a java servlet
>Date: Wed, 26 Jun 2002 14:06:17 -0400
>
>can anyone help me with this. actually i using html thing inside my servlet
>and this html contains form so in order to have validation that all the 
>data
>r entered by the user i need to use javascript for the same but as i 
>include
>it in the servlet it give me error
>so i just wanted to know whether can i use javascript with servlets or not
>thanks
>shraddha
>
>
>
>---
>
>Improve your web design skills with these new books from Glasshaus.
>
>Usable Web Menus
>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>r-20
>Constructing Accessible Web Sites
>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>r-20
>Practical JavaScript for the Usable Web
>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>r-20


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com


  Return to Index