| Author |
javascript when used inside servlet is not working
|
puja shaw
Ranch Hand
Joined: Nov 06, 2012
Posts: 32
|
|
|
solved
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
|
Secondly, why are you emitting HTML markup from a servlet? That's a poor practice -- you should be using a JSP for the markup.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
puja shaw
Ranch Hand
Joined: Nov 06, 2012
Posts: 32
|
|
Bear Bibeault wrote:Secondly, why are you emitting HTML markup from a servlet? That's a poor practice -- you should be using a JSP for the markup.
i know that we can use jsp's.But my current requirement is using html in servlets.
|
 |
kumar naresh
Ranch Hand
Joined: Mar 12, 2011
Posts: 108
|
|
|
Try by placing complete thing in out.println("<script language=\"javascript\"/>). Also try by getting an instance of JSPWriter in the class and use it for writing the script code.
|
OCMJEA 5 |
http://sceacertification.blogspot.in/2011_12_01_archive.html
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
puja shaw wrote:But my current requirement is using html in servlets.
Why? Is this a school assignment?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
kumar naresh wrote:Also try by getting an instance of JSPWriter in the class and use it for writing the script code.
Not possible from a servlet.
|
 |
puja shaw
Ranch Hand
Joined: Nov 06, 2012
Posts: 32
|
|
Bear Bibeault wrote:
puja shaw wrote:But my current requirement is using html in servlets.
Why? Is this a school assignment?
unfortunately yes.So please help me to make it work.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
<mild-rant>Why schools insist on teaching stupid things like this is beyond me. When I was teaching, I always made sure that good industry practices were emphasized.</mild-rant>
Step 1: Look at what's delivered to the browser by doing a View Source. Is it correct? Is it well-formed? Are there syntax errors?
Step 2: If so, use the browser's JavaScript debugger to see if the script is running or throwing errors.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56180
|
|
|
In the future please let us know when a question is a school assignment that has strict requirements. Otherwise, time is wasted trying to find out why you are trying to do things the wrong way.
|
 |
puja shaw
Ranch Hand
Joined: Nov 06, 2012
Posts: 32
|
|
Bear Bibeault wrote:In the future please let us know when a question is a school assignment that has strict requirements. Otherwise, time is wasted trying to find out why you are trying to do things the wrong way.
oops..ok.
|
 |
 |
|
|
subject: javascript when used inside servlet is not working
|
|
|