利用js来实现页面跳转。
- 一种是从其他网站爬过来的文章,将内容(建议存html,当然如果想要统一样式的话就存纯文本,分隔符等也存进去)存入数据库中。查看文件时,将存入的内容之间贴到html相应的位置。
- 还有一种是文件:doc,xlsx,pdf此类。
function showZXWJ(data1){
//点击时刷新最新表格的访问量数据
initTable(1,5);
$.ajax({
url: data1,
success:function(data){
if(data){
var dataValue = data.items;
var str = dataValue[0].content;
var title = dataValue[0].lawsName;
//将转移字符,替换为html
str = str.replace(/\n /g,"<br/> ");
str = str.replace(/\r/g,"");
str = str.replace(/\n/g,"<br/>");
str = str.replace(/(^\s*)|(\s*$)/g,'');
str = " " + str;
var url = <%=basePath%>+'shouyeShowFile.do';
//建立一个临时表,用于装载ajax请求得到的数据,数据可能很大,所以肯定选的是post
var form = $("<form></form>").attr("action", url).attr("method", "post");
form.append($("<input></input>").attr("type", "hidden").attr("name","fileName" ).attr("value", title));
form.append($("<input></input>").attr("type", "hidden").attr("name","content" ).attr("value", str));
form.appendTo('body').submit().remove();
} else {
window.open(data1);
}
}
});
}
@RequestMapping(value="shouyeShowFile.do")
public String findOne(FileBean fileBean,Model model){
model.addAttribute("vo", fileBean);
return "shouyeFileShow";
}
<body>
<div class="contentxw" id="viewData" style="">
<div class="padd">
<div class="BreadcrumbNav">
<span
style="float: right; cursor: pointer; color: #1a72a5; font-size: 30x;"
onclick="back()"><img src="images/icofh.png" alt=""
align="center"></span>
</div>
<div class="article oneColumn pub_border" id="scrollDiv"
style="overflow-y: auto; height: 450px;">
<h1>
<span id="title" style="font-weight: bold;font-size: 28px;">${vo.fileName}</span>
</h1>
<div class="pages-date">
<span class="fontsj" id="wenHao"></span>
</div>
${vo.content}
</div>
</div>
</div>
</body>
<wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style="display: none;">
375



被折叠的 条评论
为什么被折叠?



