1
我想創建一個屬性「稱號」,可以有表達的自定義組件,但問題我得到這個錯誤:JSF - 自定義組件,以表達對屬性
無法轉換字符串「#{} myBean.text」上課「javax.el.ValueExpression」爲屬性的「標題」:屬性編輯器無法與PropertyEditorManager
所致註冊: org.apache.jasper.JasperException - 無法轉換字符串「#{} myBean.text」屬性「title」的類「javax.el.ValueExpression」:屬性編輯器未向PropertyEditorManager註冊
我的課程:
<d:ticker title="#{myBean.text}">
<f:verbatim>Hello JSF Custom Component</f:verbatim>
</d:ticker>
MyBean.java
public class MyBean {
private String text = "TITLE!!!!";
public String getText() {
return text;
}
}
TickerTag.java
private ValueExpression title = null;
public void setTitle(ValueExpression title)
{
this.title = title;
}
protected void setProperties(UIComponent component) {
super.setProperties(component);
if (title != null) {
if (!title.isLiteralText()) {
component.setValueExpression("title", title);
} else {
component.getAttributes().put("title",title.getExpressionString());
}
}
taglib.tld
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee web-jsptaglibrary_2_1.xsd">
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>d</short-name>
<uri>http://jsftutorials.com/</uri>
<tag>
<name>ticker</name>
<tag-class>ticker.TickerTag</tag-class>
<body-content>JSP</body-content>
<attribute>
<name>title</name>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>
有人看到問題嗎?
它示出了用於'<延遲值>'錯誤。我使用的* doctype *是<!DOCTYPE taglib PUBLIC「 - // Sun Microsystems,Inc. //DTD JSP Tag Library 1.2 // EN」「http://java.sun.com/dtd/web-jsptaglibrary_1_2。 DTD「>' – 2016-06-06 06:19:31