小编Mik*_*keR的帖子

使用基于ui:repeat var的EL设置验证器属性

我正在寻找一些关于我遇到的问题的指导.

我想要完成的是通过验证和所有内容动态构建页面.最终结果是允许用户通过管理功能配置页面上的字段.下面是我用作测试页面的代码的副本,我在其中循环"已配置"字段并使用定义的标准写出字段.

<ui:repeat var="field" value="#{eventMgmt.eventFields}" varStatus="status">
  <div class="formLabel">
    <h:outputLabel value="#{field.customName}:"></h:outputLabel>
  </div>
  <div class="formInput">
    <h:inputText id="inputField" style="width:# {field.fieldSize gt 0 ? field.fieldSize : 140}px;">
      <f:validateRegex  disabled="#{empty field.validationPattern}" pattern="#{field.validationPattern}"></f:validateRegex>
    </h:inputText>
    <h:message for="inputField" showDetail="true" errorClass="errorText"></h:message>
  </div>
</ui:repeat>
Run Code Online (Sandbox Code Playgroud)

在页面呈现并且我尝试提交字段的任何值之后,我收到以下消息"正则表达式模式必须设置为非空值".这显然意味着表达式没有填充.让我感兴趣的是,在评估EL时,将禁用没有表达式的字段.我也可以使用相同的代码#{field.validationPattern}并将其放在页面中,并在页面上写入正确的值.

所以,我的问题是:1.这可能吗?2. JSF容器在什么时候看看绑定Pattern for validate regex?3.我做错了什么或者这样做的正确方法是什么?

我正在运行Tomcat 7.0.22,Mojarra 2.1.5和Eclipse作为我的IDE.

validation el jsf-2 uirepeat

6
推荐指数
1
解决办法
4408
查看次数

JSF2.0复合组件actionListener

我需要一些帮助才能让我的复合组件表现得更好.我仍然在学习JSF中的绳索,所以请原谅这篇文章中可能显示的任何无知.

所以,我正在使用JSF 2.0并决定构建一个复合组件,以使这个特定的代码片段可重用.该组件完美地显示所有内容,但在尝试添加actionListener时根本不会表现.

这是我的组件的代码

<ui:composition
    xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:h="http://java.sun.com/jsf/html"  
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:composite="http://java.sun.com/jsf/composite">

    <composite:interface displayName="columnUpdate">
        <composite:attribute name="id" 
            required="true" 
            displayName="id"
            shortDescription="Id to apply to this control and its child components">
        </composite:attribute>
        <composite:attribute 
            name="value" 
            displayName="value"
            required="true" 
            shortDescription="Field that will hold the new updated value.">
        </composite:attribute>

        <composite:attribute 
            name="columnName" 
            displayName="columnName"
            required="true" 
            shortDescription="Value that will be applied as the column header">
        </composite:attribute>
        <composite:attribute 
            name="text"
            displayName="text"
            shortDescription="Text to be displayed above the field">
        </composite:attribute>

        <composite:actionSource name="actionEvent" targets="saveEvent"></composite:actionSource>
    </composite:interface>

    <composite:implementation>
        <h:outputLabel value="#{cc.attrs.columnName}" onclick="showWindow('#{cc.attrs.id}')"></h:outputLabel>

        <div id="#{cc.attrs.id}" class="ccColumnUpdate">
        <div id="windowClose" onclick="closeWindow('#{cc.attrs.id}');" style="top: …
Run Code Online (Sandbox Code Playgroud)

actionlistener composite-component jsf-2

5
推荐指数
1
解决办法
9313
查看次数

试图在JSF应用程序中从JSTL库中找到c:out标记

我正在使用JSTL构建一个动态表,并希望使用c:out标记来帮助构建一些表达式,但是我无法在其他JSTL核心标记中找到该标记.

我使用了以下命名空间:

xmlns:c="http://java.sun.com/jsp/jstl/core" 
Run Code Online (Sandbox Code Playgroud)

并确保我的web.xml文件设置为使用此处的2.5规范 https://stackoverflow.com/tags/jstl/info

但仍然只能找到catch,choose,forEach,if,otherwise,set,when.

此外,我尝试导入JSTL 1.2.1.jar库也没有成功.

那么,c:out标签是否可供我在JSF2中使用?如果是这样,我错过了哪些步骤?

问候,

麦克风

jstl el jsf-2

4
推荐指数
1
解决办法
6393
查看次数