Search code examples
javacssjspstruts2struts

Include css in struts2 jsp page


My struts2 project structure as follows

Webcontent
  css
    abc.css
  jsp
    login.jsp
  META-INF
  WEB-INF

indeed to include the functions of abc.css in login page.How can i do that ? How can i give the path of css file in jsp page ?


Solution

  • Include your css with the following statement.

    <head>
    <link rel="stylesheet" type="text/css" href="../css/abc.css">
    </head>
    

    "../css/abc.css" is a relative path.

    "../" represents one directory up. i.e., Login.jsp is in "jsp" directory "../" will make the directory as "Webcontent"

    "../css" will traverse you upto "css" directory in the "Webcontent".

    "../css/abc.css" will give the abc.css file.