标签: jsf

jsf primefaces - 两个p:dataTable分页问题

我正在使用ap:dataTable和分页一样:

<p:dataTable var="user" value="#{userBean.users}" 
   paginator="true" rows="20"  
   paginatorTemplate="{PageLinks}" >
Run Code Online (Sandbox Code Playgroud)

两个问题:

1)当只有一页时,有没有办法告诉它不显示页码?

2)当我从第1页到第2页点击时,整个网页刷新.在PrimeFaces演示中,分页翻转了一个AJAX风格的更新页面.网页令人耳目一新,我做错了什么?

非常感谢任何帮助,谢谢!

jsf primefaces

0
推荐指数
1
解决办法
4414
查看次数

CSS不适用于浏览器,但它适用于Eclipse

我用styesheets构建JSF页面.当我在Eclipse中使用预览功能时,它似乎有效,但是当我在IE8上测试它们时,它们似乎没有任何效果.

我使用复合视图来指定页面的一般布局,如下所示.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <head>
        <link rel="stylesheet" type="text/css" href="/css/masterTemplateCSS/masterTemplateCSS.css" />


        <title><ui:insert name="title"></ui:insert></title>
    </head>

    <body>

        <div class="left_Sidebar">
            <ui:insert name="leftSidebar">

            </ui:insert>
        </div>  

        <div class="bulk_text">
            <ui:insert name="content">

            </ui:insert>
        </div>

        <div class="foot">
            <ui:insert name="footer">

            </ui:insert>
        </div>      

    </body>
</html>
Run Code Online (Sandbox Code Playgroud)

然后我尝试测试它们.

<ui:composition template="/templates/masterTemplate.xhtml">

    <ui:define name="title">Create Screen</ui:define>

    <ui:define name="leftSidebar">
        Left sidebar
    </ui:define>
    <ui:define name="content">
Run Code Online (Sandbox Code Playgroud)

模板有效,我相信css路径是正确的.我还用验证器测试了css文件,他们都检查了.但它仍然似乎在实际的浏览器中工作:S

css jsf facelets

0
推荐指数
1
解决办法
871
查看次数

JSF:动态更改表单

我想构建一个表单,根据其他组件的状态动态更改可见的组件.

例如......有一些文本框和一些复选框,如果用户激活某个复选框,则应显示一堆其他输入元素.

我可以使用JSF 2.0 + Tomahawk执行此操作,还是必须使用另一个库来执行此操作?我怎么能这样做?没有AJAX,这将无法工作,是吗?

提前致谢!

forms ajax jsf tomahawk jsf-2

0
推荐指数
1
解决办法
9738
查看次数

使用jquery更改h:outputtext的值

我有一个组件OutputText,我想使用jquery更改其值,

我的组件是,

<h:outputText id="txt_pay_days"  value="0" 
    binding="#{Attendance_Calculation.txt_pay_days}"/>
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助...

html javascript jquery jsf

0
推荐指数
1
解决办法
9937
查看次数

登录时显示用户的电子邮件(JSF 2.0)

我的网络应用程序有一个在所有页面中使用的模板.我想在该模板中创建一个小标签(因此它随处可见),以显示用户当前登录的电子邮件.

我认为最好的方法是直接查看它是否存在于会话中,所以这就是我创建标签的方式:

<h:outputLabel id="usernameLabel"
               value="#{FacesContext.getCurrentInstance().getExternalContext()
                      .getSessionMap().get("userRole")}" />
Run Code Online (Sandbox Code Playgroud)

代码在语法上不正确.如何以适当的方式编写它以实现我的目标?你认为这种方法是否正确?

java jsf java-ee java-ee-6 jsf-2

0
推荐指数
1
解决办法
405
查看次数

t:selectOneMenu如何使用Java脚本获取选定的值?

我想使用Java脚本获取“选择一个”菜单,如何获取selecteditem 值?

<h:outputLabel value="#{l.description1}" styleClass="dataValue" />
<t:selectOneMenu id="chooseLevelTypeId"
    value="#{AssetWizardComptTypeTile.levelTypeId}">
    <f:selectItem itemLabel="" itemValue="0" />
    <f:selectItems value="#{GeneralTables.levelTypesList}" />
    <a4j:support event="onchange" action="#{WizardMainControl.action}"
        ??oncomplete="if (document.getElementById('wizardForm:chooseLevelTypeId').selecteditem == 'somthing') 
        document.getElementById('wizardForm:a1').style.display = 'block';"
        reRender="chooseLevelTypeDesc" />
</t:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)

javascript jsf

0
推荐指数
1
解决办法
8654
查看次数

logout commandLink将用户注销,但不更新页面

我的JSF应用程序中有一个注销链接,使会话无效以将用户注销.它可以工作,但它不会将用户重定向到登录页面.它保持在同一页面上.如果我再次尝试访问同一页面,它会直接返回登录.我想要立即发生这种情况.

注销链接:

<h:form>
    <h:panelGroup id="loginout">
        <h:outputText value="#{todoController.loggedInUser}" />
        <h:commandLink value="logout" action="#{todoController.logout}" />
    </h:panelGroup>         
</h:form>
Run Code Online (Sandbox Code Playgroud)

注销码:

public String logout()
{
    System.out.println("testing logout");
    FacesContext fc = FacesContext.getCurrentInstance();
    ExternalContext ec = fc.getExternalContext();

    final HttpServletRequest r = (HttpServletRequest)ec.getRequest();
    r.getSession( false ).invalidate();

    return "../login.html?faces-redirect=true";
}
Run Code Online (Sandbox Code Playgroud)

jsf java-ee jboss6.x

0
推荐指数
1
解决办法
5021
查看次数

JSF:没有表单提交的按钮/链接

在早期的项目中,我常常使用s:button或s:来自Seam 2的链接,因为它不会提交表单,因此不会发生模型更新.

现在我切换到WELD + Seam 3,再也找不到它了 - 我只是失明还是我必须使用别的东西?

Geziefer

jsf seam java-ee-6 jboss-weld

0
推荐指数
1
解决办法
6930
查看次数

如何在<h:inputText>上应用CSS?

我正在尝试将CS​​S应用于我,<h:inputText>但到目前为止还没有成功:

<h:form id="contactform">
    <h:panelGrid columns="3">
        <h:outputLabel for="name">Name</h:outputLabel>
        <h:inputText id="name" value="#{contact.client.name}" >
            <f:ajax event="blur" render="nameMessage"></f:ajax>
        </h:inputText>
        <h:message id="nameMessage" for="name" />

    <h:commandButton value="Send" action="#{contact.sendMessage}">
        <f:ajax execute="@form" render="@form" />
    </h:commandButton>
    <h:messages globalOnly="true" layout="table" />
</h:form>
Run Code Online (Sandbox Code Playgroud)

我的CSS:

#contactform .text-input{
    background-color:#fbfbfb;
    border:solid 10px #000000;
    margin-bottom:8px;
    width:178px;
    padding:8px 5px;
    color:#797979;
}
Run Code Online (Sandbox Code Playgroud)

如果我尝试在某些HTML输入字段中应用此CSS样式,它可以工作,但不适用于JSF 2.0.

编辑:

在JSF中更新我的代码的这部分:

<h:inputText id="name" styleClass="text-input" value="#{contact.client.name}"  >
Run Code Online (Sandbox Code Playgroud)

将此代码插入我的CSS文件中:

text-input{
    border:solid 1px #e0e0e0;
}
Run Code Online (Sandbox Code Playgroud)

但似乎同样的事情,没有任何改变.

输出:

<form id="j_idt35" name="j_idt35" method="post" action="/brainset/contact.xhtml" enctype="application/x-www-form-urlencoded"> 
<input type="hidden" name="j_idt35" value="j_idt35" /> 
<table class="contactform"> 
    <tbody> 
        <tr> 
            <td><label …
Run Code Online (Sandbox Code Playgroud)

css java jsf jsf-2

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

h:selectBooleanCheckbox valueChangeListener不起作用

我现在面临的麻烦与valueChangeListenerh:selectBooleanCheckbox.我有以下代码块:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
    <link href="../css/profile.css" rel="stylesheet" type="text/css" />
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../css/twt.css" rel="stylesheet" type="text/css" /> 
    <script language="JavaScript" src="../js/custom-form-elements.js"></script>
    <a4j:form id="userList">
        <a4j:outputPanel id="userListPanel" rendered="#{popupController.iIndex >= 0}">          
            <div id="listPopup_#{popupController.iIndex}" 
                style="width: 202px; height: 235px; position: absolute; right: 0%; display: none; z-index: 10000; 
                background-image: url('../images/Alert/createNewListBack.gif'); background-repeat: no-repeat;">
                <table width="180" cellpadding="0" cellspacing="0" height="100%" style="margin-top: 6px; margin-left: 10px;">
                    <a4j:repeat id="userListRepeat" value="#{popupController.userList}" rowKeyVar="i" var="listByUser">
                        <tr>
                            <td valign="middle" align="center" width="35" style="padding-left: 8px;">                               
                                <h:selectBooleanCheckbox id="listCheckbox_#{i}" name="listCheckbox_#{i}"                                                                        
                                valueChangeListener="#{popupController.addUserListMember}" …
Run Code Online (Sandbox Code Playgroud)

jsf ajax4jsf

0
推荐指数
1
解决办法
2万
查看次数