开发者

How to get the base url in jsp?

开发者 https://www.devze.com 2023-02-25 10:38 出处:网络
Im creating a simple project by using jsp and servlet. I want to link the css in my jsp file. So any one can tell me the 开发者_如何学运维way to do this??You just need to do:

Im creating a simple project by using jsp and servlet. I want to link the css in my jsp file. So any one can tell me the 开发者_如何学运维way to do this??


You just need to do:

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

provided that you have style.css file in folder "css" near your .jsp file. You don't need to know the base URL for that, this will work with any base URL that leads to your .jsp file.


Try:

<c:url var="baseUri" value="/" />

Note that this will give you a relative url to the context.

0

精彩评论

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