2012-08-10 57 views
0

如何使用c:當條件輸入標籤內的值屬性?如何使用c:當條件輸入標籤內的值屬性?

<input id="textid" type="button" value=""> 

在'價值'。我要的是

<c:when test="${texttest == 'Y'}"> Add </c:when> 
<c:otherwise> Edit </c:otherwise> 

值應該爲 '添加',如果TEXTEST是 'Y',否則 '編輯'

回答

2
<input id="textid" type="button" value="${texttest == 'Y' ? 'Add' : 'Edit'}"> 
+0

謝謝!它確實工作順利。 – Jignesh 2012-08-17 09:07:05

0
<c:choose> 
<c:when test="${texttest == 'Y'}"> 
Add 
</c:when> 
<c:otherwise> 
Edit 
</c:otherwise> 
</c:choose> 
+0

謝謝您的回答。 Add編輯」>我可以'不要這樣做。任何其他方式來做到這一點? – Jignesh 2012-08-10 09:24:31

+1

@Jignesh,請不要在評論中張貼代碼。相反,留下你的問題的一個小的描述,並用相關的代碼更新你的答案。 – Dustin 2012-08-10 17:11:01

+0

感謝您的信息。我已經通過使用其他方式解決了這個問題,這在本文中並不相關。謝謝。 – Jignesh 2012-08-13 10:51:10

相關問題