• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

javascript when used inside servlet is not working

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
solved
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Secondly, why are you emitting HTML markup from a servlet? That's a poor practice -- you should be using a JSP for the markup.
 
puja shaw
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 125
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

puja shaw wrote:But my current requirement is using html in servlets.


Why? Is this a school assignment?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic