rt
我是想在小脚本里判断表达式里的值,如果相等的话就让取出来title里的值变为红色,代码下,
<%
NewsTitleDao ntd=new NewsTitleDaoImpl();
List li=ntd.selectNewsAll(1);
for(int i=0;i<li.size();i++){
NewsTitle nt=(NewsTitle)li.get(i);
%>
<%if("title".equals(%><%=nt.getTitle() %><%)){%>
<font color="red">
<%=nt.getTitle() %>
</font>
<%}else{ %>
<%=nt.getTitle() %>
<%} %><br>
<%}%>但是会报错
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 22 in the jsp file: /test.jsp
The method equals(Object) in the type String is not applicable for the arguments (void)
19: NewsTitle nt=(NewsTitle)li.get(i);
20: %>
21:
22: <%if("title".equals(%><%=nt.getTitle() %><%)){%>
23: <font color="red">
24: <%=nt.getTitle() %>
25: </font>
求助啊~~
我是想在小脚本里判断表达式里的值,如果相等的话就让取出来title里的值变为红色,代码下,
<%
NewsTitleDao ntd=new NewsTitleDaoImpl();
List li=ntd.selectNewsAll(1);
for(int i=0;i<li.size();i++){
NewsTitle nt=(NewsTitle)li.get(i);
%>
<%if("title".equals(%><%=nt.getTitle() %><%)){%>
<font color="red">
<%=nt.getTitle() %>
</font>
<%}else{ %>
<%=nt.getTitle() %>
<%} %><br>
<%}%>但是会报错
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 22 in the jsp file: /test.jsp
The method equals(Object) in the type String is not applicable for the arguments (void)
19: NewsTitle nt=(NewsTitle)li.get(i);
20: %>
21:
22: <%if("title".equals(%><%=nt.getTitle() %><%)){%>
23: <font color="red">
24: <%=nt.getTitle() %>
25: </font>
求助啊~~
解决方案 »
- javamail解析纯文本邮件,如何分离出附件?
- 非常郁闷,验证我明明判断了如果不为空才判断 可是怎么总是认为不为空
- jsp页面刷新问题!!!
- 如何实现一次下载多个CSV文件
- 论坛设计中的一个小问题?
- SQL2000 Oracle数据库 相互转化
- 大侠们帮帮我吧,实在是没分了,每天只能问一个问题,而且还得是简单的.
- 怎么把一个文本文件(.txt)上传到SQl数据库,java或者jsp 代码都可以,100分封送
- 我怎么觉得Servlet没有JavaBean的优点突出,所以学得没什么劲!请指教
- 请问:<jsp:useBean>能否使用一个抽象类(还没有重载抽象方法的)?
- bean:write问题
- 怎样查看并修改SmartUpload源码
<font color="red">
<%=nt.getTitle() %>
</font>
<%}else{ %>
<%=nt.getTitle() %>
<%} %><br>
<%}%>你直接这样写不行吗???