JSP through S:iterator implementation of a one-to-many display __js

Source: Internet
Author: User

<tr>
<th width= "8%" >
Serial number
</th>
<th width= "20%" >
Venue name
</th>
<th width= "26%" >
Start time
</th>
<th width= "26%" >
End time
</th>
<th width= "20%" >
Application Status
</th>
</tr>
<%int index = 1;%>
<s:iterator var= "s" value= "#request. Usagelist" >
<tr>
&LT;TD style= "Text-align:center" >
<%=index++%>
</td>
<s:if test= "#strid!= #s. room_id" >
<s:set id= "Strid" value= "%{#s. room_id}"/>
&LT;TD rowspan= "<s:property value= total_rows"/> "id=" <s:property "value=" room_id "/>" style=: Center ">
<a href= "javascript:window.location.href= ' <%=path%>/conference_room_view.action?room_id=<s:property Value= "room_id"/>&optype=2 '; " >
<s:property value= "Room_name"/>&nbsp;
</a>
</td>
</s:if>
&LT;TD style= "Text-align:center" >
<s:date name= "start_date" format= "Yyyy-mm-dd HH:mm:ss"/>&nbsp;
</td>
<td>
<s:date name= "end_date" format= "Yyyy-mm-dd HH:mm:ss"/>&nbsp;
</td>
&LT;TD style= "Text-align:center" >
<%=commonmethod.getconferencestatus ((String) Request.getattribute ("STATUS")%>&nbsp;
</td>
</tr>
</s:iterator>

Explain it, the future of the province will not remember when you see it.

The key is the Red section, which displays all the requests for each conference room, so a one-to-many relationship is between the conference room and the application record.

Each cycle is judged once, to see if the current record of the room_id is the same as the last, if the same as the conference room name TD is not constructed. If not the same, the description is the new conference room, then claims TD.

rowspan= "<s:property value=" Total_rows "/>"

This is the soul.

When the first generation of TD to set up TD's account for the number of lines, so you can achieve a one-to-many display. But how this total_rows is going to depend on the SQL Analytics function:

COUNT (ROWID) over (PARTITION by room_id) total_rows

Add the above item in the query item, OK. What do you mean, take a look at the SQL explanation yourself (ORACLE).

The drawback is that if the page is displayed, the effect is not ideal.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.