Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf UIComponent类的ClientId_Jsf - Fatal编程技术网

Jsf UIComponent类的ClientId

Jsf UIComponent类的ClientId,jsf,Jsf,GetClientIfacesContext上下文和getClientIdof UIComponent类方法之间有什么区别。为什么在编写encode方法时调用getClientIdFacesContext上下文而不是getClientId? core JavaServer Faces第三版示例: public void encodeBegin(FacesContext context) throws IOException { ResponseWriter writer = contex

GetClientIfacesContext上下文和getClientIdof UIComponent类方法之间有什么区别。为什么在编写encode方法时调用getClientIdFacesContext上下文而不是getClientId? core JavaServer Faces第三版示例:

public void encodeBegin(FacesContext context) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = getClientId(context);
    // Encode input field
    writer.startElement("input", this);
    writer.writeAttribute("name", clientId, null);
    Object v = getValue();
    if (v != null) writer.writeAttribute("value", v, "value");
    Object size = getAttributes().get("size");
    if (size != null) writer.writeAttribute("size", size, "size");
    writer.endElement("input");
}

究竟是什么阻止了您阅读?@BalusC文档中没有使用getClientId的示例。没有例子是很难理解的。你为什么不在问题中陈述呢?唉,你到底不明白哪一部分?EL?@BalusC此方法将返回什么特定字符串?或者只允许EL访问组件的clientId。那么为什么返回类型是String而不是void呢?呃,你到底在说什么void方法?为什么getter/accessor应该返回void?为什么getter返回的内容不应该在方法名本身中声明?