您的位置:程序门 -> java -> web 开发



求助~~看下代码


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


求助~~看下代码
发表于:2007-10-18 15:50:38 楼主
结构是jsp   sevlert   bean

下面的代码是jsp中的~
<tr   >
<td   width="35"   align="center"   >   <font   size=3   > 序号   </font   >   </td   >
<td   width="150"   align="center"   >   <font   size=3   > 会议名称   </font   >   </td   >
<td   align="center"   width="120"   >   <font   size=3   > 会议时间   </font   >   </td   >
<td   align="center"   width="200"   >   <font   size=3   > 人员   </font   >   </td   >
<td   align="center"   width="93"   >   <font   size=3   > 提示时间   </font   >   </td   >
</tr   >

<%   if   (result!=null){   length   =   result.size();   for   (int   i=length-1;i> =0;i--){   hashtable   record   =   (hashtable)result.get(i);   %>
       
<tr   >

                <%
    string   color   =   "   <font   size=2   > ";
if   (record.get("warningstate").equals("warning")){
        color   =   "   <font   size=2   color=#0000ff   > ";
}

  %   >
                                      <td   width="35"   >   <%=color%   >   <%=record.get("id")%   >   </td   >
                      <td   width="150"   >   <%=color%   >   <font   size=2   >   <%=record.get("conference_name")%   >   </font   > &nbsp;   </td   >
      <td   width="120"   >   <%=color%   > 从   <%=record.get("conference_begindate")%   >   <%=color%   > 到   <%=record.get("conference_enddate")%   > &nbsp;   </td   >
      <td   width="200"   >   <%=color%   >   <font   size=2   >   <%=record.get("conference_lead")%   >   </font   >   <br   >   <font   size=2   >   <%=record.get("conference_person")%                                       >   </font   > &nbsp;   </td   >
                      <td   width="93"   align="center"   >   <%=color%   >   <font   size=2   >   <%=record.get("lefttime")   %   > &nbsp;天   </font   >   </td   >


<%     }
}   %   >
</tr   >

我现在想做的就是,在蓝色的部分的判断处if   (result!=null)中获取lefttime的值并做判断。
想法如下:
<%    
if   (result!=null   &&     <%=record.get("lefttime")   %   >     > 1){
length   =   result.size();
        for   (int   i=length-1;i   > =0;i--){  
          hashtable   <string,   string   >   record   =   (hashtable   <string,   string   > )result.get(i);
       
        %   >
但是不行,总是有小红叉叉,我的想法就是获取lefttime的值,并且把lefttime强制转化为整形,并做判断让它大约1
bean都有对应的存入的数据~  
发表于:2007-10-18 16:41:181楼 得分:0
<%      
if   (result!=null   &&       <%=record.get("lefttime")   %     >  

可以嵌套的么?

你的代码没有贴完整,record是什么?result是什么?
发表于:2007-10-18 16:55:572楼 得分:0
不可以嵌套, <%=record.get("lefttime")   %> 最终解析成record.get("lefttime").tostring()
, <%=record.get("lefttime")   %>   > 1肯定出错啊
发表于:2007-10-18 17:58:043楼 得分:0
<%   if   (result!=null){   length   =   result.size();   for   (int   i=length-1;i   > =0;i--){   hashtable   record   =   (hashtable)result.get(i);  
if(integer.parseint(record.get("lefttime"))> 1){
%   >
       
<tr     >

                  <%
    string   color   =   "     <font   size=2     > ";
if   (record.get("warningstate").equals("warning")){
        color   =   "     <font   size=2   color=#0000ff     > ";
}

  %     >
                                        <td   width="35"     >     <%=color%     >     <%=record.get("id")%     >     </td     >
                        <td   width="150"     >     <%=color%     >     <font   size=2     >     <%=record.get("conference_name")%     >     </font     > &nbsp;     </td     >
        <td   width="120"     >     <%=color%     > 从     <%=record.get("conference_begindate")%     >     <%=color%     > 到     <%=record.get("conference_enddate")%     > &nbsp;     </td     >
        <td   width="200"     >     <%=color%     >     <font   size=2     >     <%=record.get("conference_lead")%     >     </font     >     <br     >     <font   size=2     >     <%=record.get("conference_person")%                                         >     </font     > &nbsp;     </td     >
                        <td   width="93"   align="center"     >     <%=color%     >     <font   size=2     >     <%=record.get("lefttime")   %     > &nbsp;天     </font     >     </td     >


<%}    
}
}   %     >  


快速检索

最新资讯
热门点击