如何把jsp页面头部中那些加载css、js的命令提取出来放在一个jsp页面里

如何把jsp页面头部中那些加载css、js的命令提取出来放在一个jsp页面里

问题描述:

是这样的我要做好几个jsp页面,都使用bootstrap作为前端框架

于是在每个jsp页面的 head>中都有这么一大段加载命令:

     <link href="css/charisma-app.css" rel="stylesheet">
    <link href='bower_components/fullcalendar/dist/fullcalendar.css' rel='stylesheet'>
    <link href='bower_components/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print'>
    <link href='resources/bower_components/chosen/chosen.min.css' rel='stylesheet'>
    <link href='bower_components/colorbox/example3/colorbox.css' rel='stylesheet'>
    <link href='bower_components/responsive-tables/responsive-tables.css' rel='stylesheet'>
    <link href='bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css' rel='stylesheet'>
    <link href='css/jquery.noty.css' rel='stylesheet'>
    <link href='css/noty_theme_default.css' rel='stylesheet'>
    <link href='css/elfinder.min.css' rel='stylesheet'>
    <link href='css/elfinder.theme.css' rel='stylesheet'>
    <link href='jquery.iphone.toggle.css' rel='stylesheet'>
    <link href='uploadify.css' rel='stylesheet'>
    <link href='css/animate.min.css' rel='stylesheet'>

这样修改起来不方便,如果把这些相同的标签都单独列出来放在一个jsp页面中就会好很多。

我应该怎样做,新建的这个jsp页面要声明什么吗,其他引用该页面的jsp要声明什么,就是如何把它们联系起来

把公共的提取出来,放到common.jsp中,通过@include的方式引入其他页面
 <%@include file="common.jsp" %>

通过include来引用即可

讲这些js引用都放到一个js文件里a.js中,在需要的地方引用a.js即可