开发者

How to include css in mulitple jsps?

开发者 https://www.devze.com 2023-03-13 01:18 出处:网络
i have several CSS styles i would need to include in the JSP page, however, i have multiple JSP where i include in a main JSP. I can\'t modify the main JSP, but only be able to put them into the inclu

i have several CSS styles i would need to include in the JSP page, however, i have multiple JSP where i include in a main JSP. I can't modify the main JSP, but only be able to put them into the included JSPs.

May i know if i may have a tag in each JSP so that i may put my page level CSS?

<head>
    <style type="text/css">
        .oneOffcosts_totalDescription{
            color: #006685;
            margin-left:35px;
            border:1px solid #dedede;
            width:300px;
            float:left;
            display:inline;
        }

        .oneOffcosts_totalCost{
            font-weight:bold;
            border:1px solid #dedede;
            width:100px;
            float:left;
            displ开发者_如何学Goay:inline;
        }
    </style>
</head>

Thanks!


Add a include-prelude in the jsp-property-group in web.xml for the jsps which you want the content to be added.

<jsp-config>
<jsp-property-group>
  <url-pattern>/included/a.jsp</url-pattern>
  <url-pattern>/included/b.jsp</url-pattern>
  <url-pattern>/included/*.jsp</url-pattern>
  <include-prelude>
    /WEB-INF/somecss.css
  </include-prelude>
  <include-coda>

  </include-coda>
</jsp-property-group>


Make a new file , say mainWithCss.jsp which includes your main.jsp along with style-info or links to your CSS-files. Include this instead of for main.jsp.

If you can't access the HEAD element (if it in your un-editable main.jsp) I would suggest linking to external CSS files instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消