jsp页面无法正常显示数据库内容的时候 连代码也一起显示出来了,还有不能显示图片,只显示的是链接地址 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 把jsp代码贴上来,一般是你jsp里面代码的引号写得有问题。 这个是我的页面代码<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %><%@include file="/common/common.jsp"%><%@include file="/common/skins/skin0/component.jsp" %><%String webContextRoot = request.getContextPath();%><link href="<%=webContextRoot%>/common/css/style.css" rel="stylesheet" type="text/css" /><html> <head> <title><b:write property="article/title"/></title> </head> <body> <e:datasource name="article" type="entity" path="com.primeton.cms.dataset.article.Article" /> <h:form> <dataform id="preview"> <table width="960" height="30" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="682" valign="top"> <table width="98%" border="0" cellspacing="0" cellpadding="0"> </table> </td> </tr> </table> <table width="960" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#C5D1E5"> <tr> <td width="100%" valign="top" bgcolor="#FFFFFF" class="list_top_b"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="96%" height="60" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="40" align="center" class="article_title"> <b:write property="article/title" /> </td> </tr> <tr> <td height="30" align="center" class="time"> <l:notEqual property="author" targetValue="empty"> 作者:<b:write property="article/author"/> </l:notEqual> <l:notEqual property="source" targetValue="empty"> 文章来源:<d:write dictTypeId="CMS_ARTICLE_SOURCE" property="article/source"/> </l:notEqual> 更新时间:<b:write property="article/saveDate" formatPattern="yyyy-MM-dd"/> </td> </tr> </table> </td> </tr> <tr> <td height="1" colspan="3" bgcolor="#D1DDED"></td> </tr> </table> <table width="100%" border="0" align="center" cellpadding="20" cellspacing="0"> <tr> <td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"> </td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="10"> <tr> <td class="article_content"> <b:write property="article/content" filter="false"/> </td> </tr> <tr> <td align="center" bgcolor="#F7F7F7"></td> </tr> <tr> <td align="center" class="list"> <style type="text/css"> .form-buttun { BORDER-RIGHT: #002D96 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #002D96 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF, EndColorStr=#9DBCEA); BORDER-LEFT: #002D96 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #002D96 1px solid}</style> </td> </tr> <tr> <td align="right" class="list_14"><font color="#999999">[编辑:<b:write property="article/addUser" /> ]</font></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td height="10" background="images/xian.gif"></td> </tr> </table></td> </tr> </table></td> </tr> </table> <!--添加附件区--> <table id="filetable" width="100%" border="0" cellpadding="1" cellspacing="1" align="center" class="form_table"> <l:iterate id="myid" property="article/atFileuploads"> <tr> <td width="10%"> 附件 </td> <td width="90%"> <b:set name="tmpfileName" iterateId='myid' property='fileName'/> <l:in iterateId="myid" property="fileType" targetValue="application/x-jpg,application/x-img,application/x-bmp,application/x-png"> <!--<h:img iterateId="myid" property="fullnampath" height="50" width="50"/>--> <a href="#" onclick="viewPic('<b:write iterateId="myid" property="fullnampath" />')"><img src='/default/<b:write iterateId="myid" property="fullnampath" />' height="50" width="50" /></a> </l:in> <l:notIn iterateId="myid" property="fileType" targetValue="application/x-jpg,application/x-img,application/x-bmp,application/x-png"> <%try{%> <h:download iterateId="myid" property="filePath" outputFileName="@tmpfileName"><b:write iterateId="myid" property="fileName" /></h:download> <%}catch(Exception e){%><span style="color:red">附件不存在</span><%}%> </l:notIn> </tr> </l:iterate> </table> </td> <tr class="form_bottom"> <td colspan="4"> <input type="button" value="关闭" onclick="javascript:window.close();" class="button"> </td> </tr> </dataform></h:form></body> </html> <script> function viewPic(filePath) { var path="/default"+filePath; var sUrl="com.oloa.portal.showPic.flow?_eosFlowAction=action0&picpath="+filePath; sUrl +='&_ts='+(new Date()).getTime(); //防止IE缓存,在每次打开时加个时间差的参数,并且作为判断是否弹出窗口的标志 //window.open(sUrl); showModalCenter(sUrl,null,null,600,500,"图片显示"); //window.showModalDialog(sUrl,,"dialogWidth=500px,dialogHeight=400px"); }</script> 你是不是用了什么标签库没在页面上引用?比如你的标签:e:datasourceh:formb:writel:notEqual等等。 是这么个问题,<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"><span style="font-size: small">公司有资源都可以推荐。</span></p><p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"><span style="font-size: small">文件详情及图纸相关见附件。</span></p>在是在数据库中的content内容,而我在页面修改,点击保存后,数据库的content的内容就变成了这样<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"> <span style="font-size: small">公司有资源都可以推荐。</span></p><p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"> <span style="font-size: small">文件详情及图纸相关见附件。</span></p>然后在页面上点击查看的时候显示内容是这样<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"> <span style="font-size: small">公司有资源都可以推荐。</span></p> <p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"> <span style="font-size: small">文件详情及图纸相关见附件。</span></p> 原来数据库的内容可以正常显示,但是我只要在页面上点击修改,保存后,再浏览页面,页面上显示的就是这样的<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"><span style="font-size: small">公司有资源都可以推荐。</span></p><p style="font-family: 宋体; word…… 哦,你意思是它以文本方式显示出来了,你想以html方式显示? 就是我说的那个意思嘛。你的内容在这里显示的吧<b:write property="article/content" filter="false"/>你页面也没引入标签库,我也不知道你用的什么标签库,反正你看看b:write有没有一个可以把内容转换成HTML格式的属性,如果有就直接引用。给你看另一个连接:http://topic.csdn.net/u/20120321/09/1cc37205-5f1b-473c-810d-9721f7317df5.html filter="false" 这个属性就是去除的,如果是<p>这样子的就没问题,,但是<:P>这样子的就不行。 整好了,,多谢你了 这一下午是我的文本编辑框里 config.js 开了html输出。。到数据库里 就变了 jsp如何获取计算机的串口 java struts1.3 tomcat 异常 struts1.x下载成功后跳转成功画面不可? 诚心请教问题 请大家留下QQ或MSN等信息,以便大家互相讨论和交流 web集群遇到的问题 谁有jsp实现的权限控制系统啊! 关于struts的问题! 已经转换成了DOUBLE型数值,可还是不能相加?? 将数据库中的空格,在jsp页面中如何显示出来!,马上给分!!! 如何将表单提交的信息加入数据库中? 学习服务器开发应该看些什么书呢?求指点啊。
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8" %>
<%@include file="/common/common.jsp"%>
<%@include file="/common/skins/skin0/component.jsp" %><%
String webContextRoot = request.getContextPath();
%>
<link href="<%=webContextRoot%>/common/css/style.css" rel="stylesheet" type="text/css" />
<html>
<head>
<title><b:write property="article/title"/></title> </head> <body>
<e:datasource name="article" type="entity" path="com.primeton.cms.dataset.article.Article" />
<h:form>
<dataform id="preview">
<table width="960" height="30" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="682" valign="top">
<table width="98%" border="0" cellspacing="0" cellpadding="0">
</table>
</td>
</tr>
</table> <table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#C5D1E5">
<tr>
<td width="100%" valign="top" bgcolor="#FFFFFF" class="list_top_b"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="96%" height="60" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" align="center" class="article_title">
<b:write property="article/title" />
</td>
</tr>
<tr>
<td height="30" align="center" class="time">
<l:notEqual property="author" targetValue="empty">
作者:<b:write property="article/author"/>
</l:notEqual>
<l:notEqual property="source" targetValue="empty">
文章来源:<d:write dictTypeId="CMS_ARTICLE_SOURCE" property="article/source"/>
</l:notEqual>
更新时间:<b:write property="article/saveDate" formatPattern="yyyy-MM-dd"/>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="1" colspan="3" bgcolor="#D1DDED"></td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="20" cellspacing="0">
<tr>
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center">
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td class="article_content">
<b:write property="article/content" filter="false"/>
</td>
</tr>
<tr>
<td align="center" bgcolor="#F7F7F7"></td>
</tr>
<tr>
<td align="center" class="list"> <style type="text/css">
.form-buttun {
BORDER-RIGHT: #002D96 1px solid; PADDING-RIGHT: 2px; BORDER-TOP: #002D96 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 12px; FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF, EndColorStr=#9DBCEA); BORDER-LEFT: #002D96 1px solid; CURSOR: hand; COLOR: black; PADDING-TOP: 2px; BORDER-BOTTOM: #002D96 1px solid
}
</style>
</td>
</tr>
<tr>
<td align="right" class="list_14"><font color="#999999">[编辑:<b:write property="article/addUser" /> ]</font></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="10" background="images/xian.gif"></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<!--添加附件区-->
<table id="filetable" width="100%" border="0" cellpadding="1" cellspacing="1" align="center" class="form_table">
<l:iterate id="myid" property="article/atFileuploads">
<tr>
<td width="10%">
附件
</td>
<td width="90%">
<b:set name="tmpfileName" iterateId='myid' property='fileName'/>
<l:in iterateId="myid" property="fileType" targetValue="application/x-jpg,application/x-img,application/x-bmp,application/x-png">
<!--<h:img iterateId="myid" property="fullnampath" height="50" width="50"/>-->
<a href="#" onclick="viewPic('<b:write iterateId="myid" property="fullnampath" />')"><img src='/default/<b:write iterateId="myid" property="fullnampath" />' height="50" width="50" /></a>
</l:in>
<l:notIn iterateId="myid" property="fileType" targetValue="application/x-jpg,application/x-img,application/x-bmp,application/x-png">
<%try{%>
<h:download iterateId="myid" property="filePath" outputFileName="@tmpfileName"><b:write iterateId="myid" property="fileName" /></h:download>
<%}catch(Exception e){%><span style="color:red">附件不存在</span><%}%>
</l:notIn>
</tr>
</l:iterate>
</table>
</td>
<tr class="form_bottom">
<td colspan="4">
<input type="button" value="关闭" onclick="javascript:window.close();" class="button">
</td>
</tr>
</dataform>
</h:form>
</body>
</html>
<script>
function viewPic(filePath) {
var path="/default"+filePath;
var sUrl="com.oloa.portal.showPic.flow?_eosFlowAction=action0&picpath="+filePath;
sUrl +='&_ts='+(new Date()).getTime(); //防止IE缓存,在每次打开时加个时间差的参数,并且作为判断是否弹出窗口的标志
//window.open(sUrl);
showModalCenter(sUrl,null,null,600,500,"图片显示");
//window.showModalDialog(sUrl,,"dialogWidth=500px,dialogHeight=400px");
}
</script>
比如你的标签:
e:datasource
h:form
b:write
l:notEqual
等等。
<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"><span style="font-size: small">公司有资源都可以推荐。</span></p>
<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"><span style="font-size: small">文件详情及图纸相关见附件。</span></p>
在是在数据库中的content内容,
而我在页面修改,点击保存后,数据库的content的内容就变成了这样<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal">
<span style="font-size: small">公司有资源都可以推荐。</span></p>
<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal">
<span style="font-size: small">文件详情及图纸相关见附件。</span></p>
然后在页面上点击查看的时候显示内容是这样<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"> <span style="font-size: small">公司有资源都可以推荐。</span></p> <p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"> <span style="font-size: small">文件详情及图纸相关见附件。</span></p>
<p style="font-family: 宋体; word-wrap: break-word; color: #000000; font-size: 13px; font-weight: normal"><span style="font-size: small">公司有资源都可以推荐。</span></p>
<p style="font-family: 宋体; word……
你的内容在这里显示的吧<b:write property="article/content" filter="false"/>你页面也没引入标签库,我也不知道你用的什么标签库,反正你看看b:write有没有一个可以把内容转换成HTML格式的属性,如果有就直接引用。
给你看另一个连接:
http://topic.csdn.net/u/20120321/09/1cc37205-5f1b-473c-810d-9721f7317df5.html
是我的文本编辑框里 config.js 开了html输出。。到数据库里 就变了