任何人有任何創造性的想法可以解決此警告?EL語法錯誤:表達式不能以二元運算符開頭
引起的下列代碼:
String.format("#{myController.deleteItemById(%d)}", getId())
我的代碼看起來像在此之前:
"#{myController.deleteItemById(" + getId() + ")}"
但這造成日食生成以下警告:
EL syntax error: String is not closed
更新:
@ManagedBean(name = "myController")
@ViewScoped
public class MyController implements Serializable {
private long id;
private HtmlPanelGroup panel;
public long getId() {return this.id; }
private void getPanel() {
/// bunch of code for programatically creating a form
HtmlCommandButton deleteButton = new HtmlCommandButton();
deleteButton.setId(id);
deleteButton.setValue(value);
deleteButton.setActionExpression(/* EL expression used here */);
}
}
<?xml version='1.0' encoding='UTF-8' ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
<!-- some other elements removed for the sake of clarity -->
<h:body>
<h:panelGroup binding="#{myController.panel}" />
</h:body>
</html>
您使用任何框架jsf或只有jstl \ –
如何/何時評估el表達式?你把它包含在一個jsp頁面或其他? – dcernahoschi
或者您只會得到一個eclipse警告,並且在運行時表達式正確計算? – dcernahoschi