【发布时间】:2025-11-30 01:45:01
【问题描述】:
我不明白如何将参数从我的自定义标签传递到支持 bean 并读取它。
我想在我的自定义标签中设置一个属性,并在后台 bean 中读取这个值,如下所示:
标签库:lstOperatorDomain.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jstl/core">
<body>
<ui:composition>
<h:form>
<h:inputHidden value="#{textParameter}"/>
<h:commandButton value="Prueba" action="#{lstOperatorDomainController.prueba}"/>
</h:form>
</ui:composition>
</body>
</html>
taglib 的客户端:console.xhtml
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:cs="http://www.sdd.com.ar/cuentasimple/facelets">
<body>
<ui:composition template="/template.xhtml">
<ui:define name="title">Console</ui:define>
<ui:define name="body">
<cs:lstOperatorDomain textParameter="Testing123" />
...other things...
</ui:define>
</ui:composition>
</body>
</html>
重要的部分是,如何从我的后台 bean lstOperatorDomainController 中的 textParameter ("Testing123") 中读取值?
我尝试了很多方法,其中大多数我得到了“集合操作的非法语法”
感谢
【问题讨论】:
标签: jsf