[英]Best way to call one custom JSP tag from inside another custom JSP tag?
我們正在嘗試使用OWASP Java Encoder Project的自定義標簽庫在我們的應用程序中實現其他跨站點腳本保護。 在我正在研究的概念驗證頁面上,我遇到了如何在現有標簽(本例中為Spring form:input
標簽)內使用e:forHtml
標簽的問題:
<form:input id="Quantity_${status.index}" path="<e:forHtml value=${myData.items[status.index].quantity} />" size="4" maxlength="4"/>
有人告訴我這應該沒問題,但是當我嘗試這樣做時,出現以下運行時錯誤:
org.springframework.beans.NotReadablePropertyException:
Invalid property '<e:forHtml value=1 />' of bean class [com.mystuff.MyData]:
Bean property '<e:forHtml value=1 />' is not readable or has an invalid getter method:
Does the return type of the getter match the parameter type of the setter?
是否可以這樣做,還是應該以其他方式重新實現?
我相信您可以使用變量來使用它:
<c:set var="myPath"><e:forHtml value="${myData.items[status.index].quantity}" /></c:set>
<form:input id="Quantity_${status.index}" path="${myPath}" size="4"
maxlength="4"/>
但這基本上使問題成為從JSTL標記調用自定義JSP標記的重復
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.