Results 1 to 4 of 4
  1. #1
    vknehra10 is offline Member
    Join Date
    Dec 2016
    Posts
    99
    Rep Power
    0

    Default How to set class/id name of an html tag in servlet?

    hi,

    whenever i am going to set an class/id of a html tag it showing error

    Java Code:
    pw.println("<h1 class="blah">Header</h1>");
    then it showing error , please help !!

    Thanks

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    25

    Default Re: How to set class/id name of an html tag in servlet?

    Either escape the double quote:
    Java Code:
    "<h1 class=\"blah\">Header</h1>"
    or use single quotes:
    Java Code:
    "<h1 class='blah'>Header</h1>"
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    vknehra10 is offline Member
    Join Date
    Dec 2016
    Posts
    99
    Rep Power
    0

    Default Re: How to set class/id name of an html tag in servlet?

    one more question please

    how to add external css file in servlet

    Thanks

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    25

    Default Re: How to set class/id name of an html tag in servlet?

    The short answer is "I wouldn't".
    The HTML generation side of things ought to be done in a JSP.

    However, since you seem to be starting with servlets (which is a good thing, in my opinion), you can just add another println in the right place with the css reference.
    It's just normal HTML you are sending.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. calling up servlet from Html
    By mosto in forum Java Servlet
    Replies: 7
    Last Post: 10-18-2009, 03:38 PM
  2. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  3. Linking a servlet from HTMl
    By mallyjay in forum Java Servlet
    Replies: 4
    Last Post: 02-26-2009, 10:31 AM
  4. get data from html to servlet
    By lema in forum Java Servlet
    Replies: 66
    Last Post: 04-09-2008, 02:43 PM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •