Results 1 to 6 of 6
  1. #1
    Smriti is offline Member
    Join Date
    Feb 2017
    Posts
    3
    Rep Power
    0

    Default Not able to apply css in servlet

    I am using below code to add css to my servlet but it doesn't work

    out.println("<link rel='stylesheet' type='text/css' href='" + request.getContextPath() + "/design.css' />");
    Design.css is kept in WebContent .
    Please help

  2. #2
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,983
    Rep Power
    8

    Default Re: Not able to apply css in servlet

    Define "doesn't work".
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  3. #3
    Smriti is offline Member
    Join Date
    Feb 2017
    Posts
    3
    Rep Power
    0

    Default Re: Not able to apply css in servlet

    doesn't work as in CSS styles are not visible .Your solution to this issue would be a great help.

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

    Default Re: Not able to apply css in servlet

    And if you look at the HTML on the browser, what has that output?

    Assuming the HTML turns out to look OK, then the next step is to look at the browser developer tools (usually F12) and see whether the css file is downloaded successfully (that'll be the network tab).
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Smriti is offline Member
    Join Date
    Feb 2017
    Posts
    3
    Rep Power
    0

    Default Re: Not able to apply css in servlet

    Yes it work fine with HTML but if I want to add it to servlet ,its not visible.

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

    Default Re: Not able to apply css in servlet

    What do you mean by "add it to servlet"?

    Servlets don't normally produce HTML.

    In any case, my question was whether that HTML appeared as you expected on the browser. It sounds like it hasn't appeared at all?

    You might need to show us more of the code, as well as what is produced on the browser when a request is made to the servlet.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Apply a perspective transform
    By JdeSyph in forum New To Java
    Replies: 3
    Last Post: 03-07-2011, 08:39 AM
  2. How to apply PMD for JSP,HTML
    By Devarajan in forum Advanced Java
    Replies: 8
    Last Post: 01-28-2011, 09:48 AM
  3. How to apply system cls in java...
    By cyzash in forum New To Java
    Replies: 1
    Last Post: 02-20-2010, 11:50 AM

Posting Permissions

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