| Author |
embedding javascript into servlet
|
Santosh Tripathi
Greenhorn
Joined: Jul 27, 2001
Posts: 9
|
|
dear friends, i'm a fresher and doing aproject.iant to know how can i embed javscript into servlets.pls give a short example. thanks.
|
 |
Sam Dalton
Author
Ranch Hand
Joined: Jul 26, 2001
Posts: 170
|
|
You output JavaScript in exactly the same way as HTML from within your servlets. An example would be out.println("<script>alert('this is script')</script>"); If you are making heavy use of javascript, you should probably use JSP pages instead of servlets. Outputing lots of HTML/JavaScript is a very messy process that is prone to errors (quotes will cause you problems) and is very unmaintable. S
|
<a href="http://www.samjdalton.com" target="_blank" rel="nofollow">Sam Dalton</a>,<br />Co-author of [http://www.amazon.com/exec/obidos/tg/detail/-/1590592255/qid=1068633302//ref=sr_8_xs_ap_i0_xgl14/104-4904002-9274339?v=glance&s=books&n=507846]Professional JSP 2.0[/URL] (October 2003)<br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/1861007701/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional SCWCD Certification</a><br />Co-author of <a href="http://www.amazon.com/exec/obidos/ASIN/186100561X/ref=ase_electricporkchop" target="_blank" rel="nofollow">Professional Java Servlets 2.3</a>
|
 |
 |
|
|
subject: embedding javascript into servlet
|
|
|