JSTL 比教时间

How to deal with break in jsp
Sometimes, we have to deal with the break in a for iteration.
In jstl, there's no break logic. But we can achieve that by composing the jstl tags.
The following is an example:
Code:

for (int i=pageVariable; i<= showThisMuch;i++) {
if (j==10){
break;
}
}

Code:

<c:forEach varStatus="status" begin="${pageVariable}" end="${showThisMuch}">
     <c:if test="${j<10}">

     </c:if>
</c:forEach>

Thanks for Bruce's advice
Last edited by Ben; 2009-01-21 at 01:22 AM.
Reply With Quote Multi-Quote This Message Quick reply to this message
Ben
View Public Profile
Send a private message to Ben
Send email to Ben
Find all posts by Ben
Add Ben to Your Contacts
  #9   Report Post 
Old 2009-01-21, 11:45 AM
osagie osagie is offline
Member
 
Join Date: Jan 2009
Posts: 80
Default
To compare dates, try this

Code:

Date: <fmt:formatDate value="${now}" dateStyle="full" />
Number: <fmt:formatNumber value="${now.time}" />
StartDate:<fmt:formatDate value="${startDate}" dateStyle="full" />
Start Number:<fmt:formatNumber value="${startDate.time}" />
<c:set var="checkTime1"><fmt:formatNumber value="${startDate.time}" /></c:set>
<c:set var="checkTime2"><fmt:formatNumber value="${now.time}" /></c:set>
<c:if test="${checkTime1 < checkTime2}"> Start Date is Less than today's date </c:if>
<c:if test="${checkTime1 == checkTime1}"> Same dates </c:if>

Reply With Quote Multi-Quote This Message Quick reply to this message
osagie
View Public Profile
Send a private message to osagie
Send email to osagie
Find all posts by osagie
Add osagie to Your Contacts
  #10   Report Post 
Old 2009-01-21, 09:06 PM
Ben Ben is offline
Member
 
Join Date: Jan 2009
Posts: 78
Default
In some aspects, EL expressions are different form java expressions
in java
Code:

1/3=0

in el
Code:

1/3=0.333333...

In the jsp pages we need to do the paging, somethime we need the type of int number, not the fload or double.
How to do the rounding operation?
Code:

<fmt:formatNumber value="${showThisMuch-(showThisMuch%20)}" pattern="00000.#" />

你可能感兴趣的:(jsp,J#)