2017-05-24 72 views
-1

由於某些原因,jstl等於方法對我不起作用。該代碼是Jstl等於不起作用

<span>${fromerror}</span> 
<span>${fromerror eq 'mandatoryCriteria.criteria.from'}</span> 

但結果就是這樣

mandatoryCriteria.criteria.from  
false 

我使用JSTL 1.2

更具體地說我需要它,如果語句,但結果是一樣的

<c:if test="${not empty fromerror and fromerror eq 'mandatoryCriteria.criteria.from'}"> 
+0

fromerror可能具有前導或尾隨空白。 –

+0

我可以知道downvote的原因嗎? – Miroslav

回答

0

我解決了它。問題是,fromerror變量實際上包含這樣的

<span id="from.errors">mandatoryCriteria.criteria.from</span> 

爲「mandatoryCriteria.criteria.from」哪個瀏覽器進行評估。這就是爲什麼eq沒有工作