如果我有現有的JSP標記庫。在JSP中,我可以添加:如何將JSP標記庫添加到JSF2 Faclet頁面?
<%@taglib uri="http://www.owasp.org/index.php/Category:OWASP_CSRFGuard_Project/Owasp.CsrfGuard.tld" prefix="csrf" %>
<form>
...
<input type="hidden" name="<csrf:token-name/>" value="<csrf:token-value/>"/>
</form>
這是我嘗試添加到JSF2 faclet頁面的內容。它不喜歡這個。
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:csrf="http://www.owasp.org/index.php/Category:OWASP_CSRFGuard_Project/Owasp.CsrfGuard.tld">
...
<h:form ...>
....
<input type="hidden" name="#{csrf:token-name}" value="#{csrf:token-value}"/>
</h:form>
甚至有可能做我認爲我能做的事情嗎?
現在我收到此錯誤:
javax.servlet.ServletException: Encountered ":" at line 1, column 7.
Was expecting one of:
"}" ...
"." ...
"[" ...
">" ...
"gt" ...
"<" ...
"lt" ...
">=" ...
"ge" ...
"<=" ...
"le" ...
"==" ...
"eq" ...
"!=" ...
"ne" ...
"&&" ...
"and" ...
"||" ...
"or" ...
"*" ...
"+" ...
"-" ...
"/" ...
"div" ...
"%" ...
"mod" ...
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
...
由於小面,你可以」不要在頁面中使用scriptlet,也不要在頁面中直接使用任何Java代碼,這是一件好事所有服務器端處理**必須**在您的控制器類中。在這種情況下,在你的託管bean,驗證器,轉換器等等中 –