java - CSS and JS are not rendered when index.jsp is set as welcome file -
i facing problem in jsp-servlet, when setting index.jsp welcome-file (default page run first project gets run) @ time css , js files not rendered. project hierarchy this
-projectname
-user
-css
-js
-index.jsp
and when run project url in browser localhost:8080/projectname
here index.jsp called without css , js files.
edit: finally, had solved issue copying css , js root directory also. i.e. have css , js @ "user" "projectname".
try context path,
<link href="${pagecontext.request.contextpath}/css/style.css" rel="stylesheet" type="text/css">
will path of css file in css
folder. or scriptlet
,
<link rel="stylesheet" type="text/css" href="<%=request.getcontextpath() %>/css/style.css">
however, not recommended use scriptlets
in jsp.
Comments
Post a Comment