我试图将图像放在表格的列中。 我的每个表行的代码是:
<tr bgcolor="#5D7B9D" color="#FFFFFF" onmouseover="ChangeColor(this, true,true);" onmouseout="ChangeColor(this, false,true);" onclick="DoNav('showdrivefile.jsp?shid=<%=sharingid%>&fileid=<%=fileid%>&sendername=<%=filesendername%>&senderid=<%=filesender%>');">
<td><input type="checkbox" onclick="DoRemove(event);" width="20" class="select_all_mail" value=<%=sharingid%>></td>
//The problem is here,When i insert the image the jsp page starts giving an error.I have two images and each image is put if condition is satisfied.
<%if(filesendername.compareTo(userrname)==0){%>
<td><img src="images/mail-outbox.png" width="30"></td>
<%}%>
<%else if(filesendername.compareTo(userrname)!=0){%>
<td><img src="images/mail_inbox.png" width="30"></td>
<%}%>
<td callspan="3" width="1000px"><%=filesendername%> : <%=sharingsubject%> <%=sharingtime%></td>
</tr>
可能是什么问题?如果我没有插入图像,代码运行正常。请帮忙
我的错误的一小部分:
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:374)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:339)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:594)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:344)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
答案 0 :(得分:0)
这可能是问题,也可能不是,但您没有正确关闭<img>
标记。而不是:
<td><img src="images/mail-outbox.png" width="30"></td>
应该是
<td><img src="images/mail-outbox.png" width="30"/></td>
答案 1 :(得分:0)
尝试
<%if(filesendername.equalsIgnoreCase(userrname)){%>
<td><img src="images/mail-outbox.png" width="30" /></td>
<%}
else
{
%>
<td><img src="images/mail_inbox.png" width="30"></td>
<%}%>