iframe替代方案

时间:2023-09-14 09:37:32

自己写一个pagelet框架。封装成JSP的Taglib。

<tms:view header="common-header" footer="common-footer">

        <tms:pagelet
html="/pagelet1/template.html"
js="/pagelet1/js/p1.js,/pagelet1/js/p2.js"
css="/pagelet1/p1/css/css.js" >
</tms:pagelet> <tms:pagelet
html="/pagelet2/template.html"
js="/pagelet2/js/p1.js,/pagelet2/js/p2.js"
css="/pagelet2/p1/css/css.js" >
</tms:pagelet> <!--jsp页面-->
<tms:pagelet
jsp="/pagelet3/template.jsp"
controller="com.luan.cc.Pagelet3Controller"
js="/pagelet3/js/p1.js,/pagelet3/js/p2.js"
css="/pagelet3/p1/css/css.js" >
</tms:pagelet> </tms:view>

最终会生成这样的HTML代码:

<html id='html-loginPageView'>
<head>
<meta http-equiv='X-UA-Compatible' content='IE=EDGE'>
<title>DEMO</title>
<link rel="stylesheet" type="text/css" href='common/css/common_da8e974dc.min.css' />
<link rel="stylesheet" type="text/css" href='dd/dd/dd1_0ac99c7b1f1504f.min.css' />
<link rel="stylesheet" type="text/css" href='dd/dd/dd2_099c7b1f150614f.min.css' />
<link rel="stylesheet" type="text/css" href='dd/dd/dd3_059b1f70ac99c7b.min.css' />
</head> <body> <div id="tms-pagelet-1">
<div>
<!--pagel-->
</div>
</div> <div id="tms-pagelet-2">
<div>
......
</div>
</div> <div id="tms-pagelet-3">
<div>
......
</div>
</div> <script type='text/javascript' src='common/js/common_da8e974dc.min.js' ></script>
<script type='text/javascript' src='dd/dd/dd1_ac99c7b1f150614f.min.js' ></script>
<script type='text/javascript' src='dd/dd/dd2_059b17b1f150614f.min.js' ></script>
<script type='text/javascript' src='dd/dd/dd3_ac99c7b1f150614f.min.js' ></script> </body>