【问题标题】:Why jsf:binding attribute creates jsessionid cookie when used on input field?为什么 jsf:binding 属性在输入字段上使用时会创建 jsessionid cookie?
【发布时间】:2013-09-04 19:21:53
【问题描述】:

当我访问具有jsf:binding 属性的页面时,为什么会创建 jsessionid cookie?如果我删除 jsf:binding 则不会创建任何 cookie。我想让我的页面没有 cookie。支持 bean 使用以下两个 Spring 注释进行注释:@Controller@Scope("request")

<div class="form-group #{!username.valid ? 'has-error' : ''}">
    <label for="username" class="col-md-2 control-label">
        #{i18n['signup.username.text']}
    </label>
    <div class="col-md-4">
        <input type="text"
            class="form-control"
            jsf:id="username"
            jsf:binding="#{username}"
            jsf:value="#{signUpBean.username}"
            jsf:maxlength="#{signUpBean.USERNAME_MAXLENGTH}"
            placeholder="#{i18n['signup.username.placeholder.text']}">
            <f:ajax event="change" render="username-message" />
        </input>
    </div>
    <h:message for="username" id="username-message" styleClass="col-md-6 help-block" />
</div>

【问题讨论】:

    标签: jsf-2 jsf-2.2


    【解决方案1】:

    我将UIComponent usernameInput 添加到支持bean,将jsf:binding="#{username}" 更改为jsf:binding="#{signUpBean.usernameInput}" 并将#{!username.valid ? 'has-error' : ''} 更改为#{!signUpBean.usernameInput.valid ? 'has-error' : ''},并且不再创建任何cookie。

    【讨论】:

      猜你喜欢
      • 2014-03-02
      • 2011-10-12
      • 1970-01-01
      • 2016-06-04
      • 2018-05-25
      • 1970-01-01
      • 2019-05-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多