سؤال

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 ?

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

you can include your css file like this.

<head>
    <link rel="stylesheet" type="text/css" href="/Webcontent/css/abc.css">
</head>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top