關於hibernate中的查詢得到一個集合,集合裡面又是數組 – JAVA編程語言程序開發技術文章

[html] 
public List getProcessByTaskName(String taskName) throws  Exception{ 
    String hql = "select t, p.qType,p.ruleCount from QueueTaskProcess t , QueueProcess p " + 
            "where t.processName = p.processName and t.taskName=? order by t.processIndex"; 
    List list=this.getEntityManager().find(hql,new Object[]{taskName}); 
    return list;         

在控制層:
[html] 
@RequestMapping(value = "searchTProcess", method = RequestMethod.POST) 
public ModelAndView searchTaskProcess(HttpServletRequest request) throws Exception { 
    ModelAndView mav1 = new ModelAndView("queue/task/queueTaskProcessList"); 
    String taskName = Escape.unescape(request.getParameter("taskName").trim());      
    List taskProcessList = qTaskProcessService.getTaskProcess(taskName);             
    mav1.addObject("taskProcessList",taskProcessList ); 
    mav1.addObject("taskName", taskName); 
    return mav1; 

頁面:
[html]
<c:forEach items="${taskProcessList}" var="queueTaskProcess" varStatus=""> 
    <tr class="tr_bg" id="<c:out value="${queueTaskProcess[0].id}"/>" > 
        <td> 
        <input type="checkbox" name="processItem"  value="<c:out value="${queueTaskProcess[0].id}"/>" /></td> 
        <td> 
        <p class="taskProcessTip" tip="${queueTaskProcess[0].taskName}"> 
            <span> 
                <c:out value="${fn:substring(queueTaskProcess[0].taskName, 0, 20)}" /> 
                    <c:if test="${fn:length(queueTaskProcess[0].taskName) > 20}"> 
                            … 
                    </c:if> 
            </span>    
        </p>                 
        </span></td> 
        <td><span><c:out value="${queueTaskProcess[0].processIndex}"/></span></td> 
        <td> 
        <p class="processListTip" tip="${queueTaskProcess[0].processName}"> 
                <span> 
                <c:out value="${fn:substring(queueTaskProcess[0].processName, 0, 20)}" /> 
                        <c:if test="${fn:length(queueTaskProcess[0].processName) > 20}"> 
                            … 
                        </c:if> 
                </span>    
        </p>                     
        </td>                                      
        <td><span><c:out value="${queueTaskProcess[1]}" /><span></td> 
        <td><span><c:out value="${queueTaskProcess[0].office}"/></span></td> 
        <td><span><c:out value="${queueTaskProcess[2]}" /></span></td>                                                 
        <td style="cursor: pointer;" onclick="showRule('${queueTaskProcess[0].processName}','${queueTaskProcess[1]}')"><span ><font style="color:#1C86EE ;">點擊查看</font></span></td> 
        <td id="taskStatus_${queueTaskProcess[0].id}" style="cursor: pointer;" onclick="modifyProcessStatus('${queueTaskProcess[0].id}')"> 
        <c:if test="${queueTaskProcess[0].status == 0}"><font style="color: red ;"><c:out value="禁用"/></font></c:if> 
        <c:if test="${queueTaskProcess[0].status == 1}"><font style="color: #228B22;"><c:out value="啟用"/></font></c:if> 
        </td> 
        <td>   
        <p class="q_up" onclick="modifyProcessIndex(${queueTaskProcess[0].processIndex},'up')"></p> 
                 <p class="q_down" onclick="modifyProcessIndex(${queueTaskProcess[0].processIndex},'down')"></p>     
                 </td>                                                             
    </tr> 
</c:forEach> 

 

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。