小编Gil*_*t V的帖子

有条件地渲染<ui:include>

我正在尝试切换显示一个页面的页面<rich:dataTable>.在我刚刚包含<ui:include>模板之前,它只会显示整个表格.

<ui:include src="../log/viewDlg.xhtml"/>
Run Code Online (Sandbox Code Playgroud)

现在我希望能够在网页上打开/关闭它.在页面上显示可能有一个按钮或链接.我怎样才能实现它?


更新1:由于一些奇怪的原因,我无法让它出现,这是我到目前为止基于反馈写的内容

视图:

<a4j:commandLink value="View"
    action="#{bean.showview}" render="viewPanel"/>

<h:panelGroup id="viewPanel">
    <h:panelGroup id="tableRenderPanel" rendered="#{bean.showPolicyView}">    
        <ui:include src="../log/viewDlg.xhtml"/>
    </h:panelGroup>                         
</h:panelGroup>
Run Code Online (Sandbox Code Playgroud)

支持豆:

private boolean showPolicyView = false;

public void showView() {
    showPolicyView = !showPolicyView;
}

public boolean isShowPolicyView(){
    return showPolicyView;
}
Run Code Online (Sandbox Code Playgroud)

jsf richfaces facelets jsf-1.2 uiinclude

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

Python,XML AttributeError:“ NodeList”对象没有属性“ firstChild”

您好,我使用的xml文件有问题。现在发生的事情是,每当我尝试获取msg标记时,都会收到一个错误,阻止我访问数据。这是到目前为止我正在编写的代码。

from xml.dom import minidom
import smtplib
from email.mime.text import MIMEText
from datetime import datetime

def xml_data ():

  f = open('C:\opidea_2.xml', 'r')

  data = f.read()

  f.close()

  dom = minidom.parseString(data)

  ic = (dom.getElementsByTagName('logentry'))

  dom = None      
  content = ''  
  for num in ic:

    xmlDate = num.getElementsByTagName('date')[0].firstChild.nodeValue

    content += xmlDate + '\n '

    xmlMsg = num.getElementsByTagName('msg')


    if xmlMsg !='' and len(xmlMsg) > 0:
        xmlMsgc = xmlMsg[0].firstChild.nodeValue
        content += "   Comments: \n        " + str(xmlMsg) + '\n\n'

    else:
        xmlMsgc = "No comment made." …
Run Code Online (Sandbox Code Playgroud)

python xml xml-parsing

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

警告:JSF1091:找不到文件QcFormDean.jsp的mime类型,但是等待它的jsf文件

我刚刚将jstl-1.2.jar,JSF api和impl jar添加到我的库中,这样我的jsf xhtml文件就可以了.

<h:selectOneMenu value="#{qcFormBean.dliStickerValue}">
<f:selectItem itemValue="P" itemLabel="Pass or Not applicable" />
<f:selectItem itemValue="M" itemLabel="FAIL-Mechanical" />
<f:selectItem itemValue="E" itemLabel="FAIL-Electrical" />
<f:selectItem itemValue="C" itemLabel="FAIL-Cosmetic" />
<f:selectItem itemValue="S" itemLabel="FAIL-Software" />
<f:ajax event="change" execute="@this" render="perfbyDliSticker" />
</h:selectOneMenu>

<h:panelGroup id="perfbyDliSticker">
<h:selectOneMenu value="#{qcFormBean.performedByRoleID}"
             rendered="#{!qcFormBean.dliStickerValue eq  'P'}">
<f:selectItem itemValue="A" itemLabel="Always" />                
<f:selectItem itemValue="O" itemLabel="Often" />
<f:selectItem itemValue="S" itemLabel="Seldom" />                
</h:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)

现在,当我尝试访问我的IE上的页面时,我得到404丢失的错误,我在Tomcat上得到以下错误,我不知道该怎么做,此错误提到它作为一个jsp文件,我知道我正在制作这是一个jsf文件,所以我不知道该怎么做.

2014年2月5日下午3时05分50秒com.sun.faces.application.resource.ResourceHandlerImpl logMissingResource警告:JSF1064:无法找到或服务资源,/preQcFormDean.xhtml.

2014年2月5日下午3时05分50秒com.sun.faces.application.resource.ResourceHandlerImpl logMissingResource警告:JSF1064:无法找到或服务资源,/preQcFormDean.view.xml.

2014年2月5日下午3时05分50秒com.sun.faces.context.ExternalContextImpl getMimeType警告:JSF1091:没有MIME类型可用于文件/preQcFormDean.jsp找到.要解决此问题,请将mime类型映射添加到应用程序web.xml.

这是我的web.xml文件.

        <?xml version="1.0" encoding="UTF-8"?>
   <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee"                       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee                                                  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
   version="3.0">
  <servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name> …
Run Code Online (Sandbox Code Playgroud)

jsf web.xml jsf-2 mime-types

4
推荐指数
2
解决办法
3万
查看次数

Python if语句,不能连接'str'和'instance'对象

我的问题是我想检查一个被调用的xml变量中的变量xmlauthor,我想检查是否基本上写了一些东西.我该怎么办?这是我到目前为止所写的:

for num in ic : 
    xmlauthor = dom.getElementsByTagName("author")[0]

    if not xmlauthor: 
        content += "***Changes by:"  + xmlauthor + "*** \n \n"
    else:
        content += "***Changes are made Anonumously** \n \n" 
Run Code Online (Sandbox Code Playgroud)

这是我在控制台上遇到的错误

content += "***Changes by:"  + xmlauthor + "*** \n\n" 
TypeError: cannot concatenate 'str' and 'instance' objects
Run Code Online (Sandbox Code Playgroud)

python if-statement xml-parsing

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

Python Dict:在已经创建的键中添加值而不会丢失原始值

我想在dict中添加一个xml文件.现在我想要做的是将值更新到dict而不会丢失值.原因是我想将xml文件分组以显示标记作者所做的所有更改.

以下是xml文件的示例.

<log> 
<logentry 
revision="33185"> 
<author>glv</author> 
<date>2012-08-06T21:01:52.494219Z</date> 
<paths> 

<path 
kind="file" 
action="M">/branches/Patch_4_2_0_Branch/text.xml</path>    

<path 
kind="dir" 
action="M">/branches/Patch_4_2_0_Branch</path> 

</paths> 
<msg>PATCH_BRANCH:N/A 
BUG_NUMBER:N/A 
FEATURE_AFFECTED:N/A 
OVERVIEW:N/A 
Adding the SVN log size requirement to the branch  
</msg> 
</logentry> 
 .... 
</log> 
Run Code Online (Sandbox Code Playgroud)

这是我用Python编写的代码.

from xml.dom import minidom 
import smtplib 
from email.mime.text import MIMEText 
from datetime import datetime 

def xml_data (): 

f = open('C:\opidea_2.xml', 'r') 

data = f.read() 

f.close() 

dom = minidom.parseString(data) 

ic = (dom.getElementsByTagName('logentry')) 

dom = None       
content = '' 
author = {}   
for num in ic: 

authors = num.getElementsByTagName('author') …
Run Code Online (Sandbox Code Playgroud)

python xml dictionary

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

让 onBeforeUnload 使用 setTimeout

我试图让 onbeforeunload 使用各种设置的计时器,但是当返回到位时,我似乎无法启动它。我希望它可以与计时器一起使用,但由于某种原因计时器无法正常工作。这是我正在工作的代码,感谢您帮助查看它,非常感谢。

var validNavigation = false;

function wireUpEvents() {
    var leave_message = 'Leaving the page';

    jQuery(
        function goodbye() {
            jQuery(window).bind('onbeforeunload', function() {
                setTimeout(function() {
                    setTimeout(function() {
                        jQuery(document.body).css('background-color', 'red');
                    }, 10000);
                },1);

            return leave_message;
        });
    }); 

    function leave() {
        if(!validNavigation) {
            killSession();
        }
    }

    //set event handlers for the onbeforeunload and onunloan events
    window.onbeforeunload = goodbye;

    window.onunload=leave;
}

// Wire up the events as soon as the DOM tree is ready
jQuery(document).ready(function () {
    wireUpEvents();
});
Run Code Online (Sandbox Code Playgroud)

javascript onbeforeunload settimeout

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

java-获取数字数据库值

你好我正在研究一个java代码,它假设得到我正在处理的用户配置文件表中的用户总数.现在我确信我的sql语句是正确的但由于某种原因我不知道如何从中获取数值.任何帮助都非常感谢和欢迎.我相信我试图获得价值的方式不起作用,但我不知道如何获得价值,这是下面的代码,谢谢你:

     public int getUserCount() throws SQLException {    

    Connection conn = null;
    Statement stmt = null;
    ResultSet rs = null;
    double encinfo;
    conn = DAOFactory.getDatabaseDAO().getConnection();
        StringBuffer query = new StringBuffer();
        query.append( "Select COUNT (DISTINCT record_id)");
        query.append( "From USER_PROFILE");
        stmt = conn.createStatement();
        rs = stmt.executeQuery( query.toString());
        if (!rs.next())
           throw new SQLException( SQLException.User_NOT_FOUND,"No User Count found.");

        // Should be able to get the user amount or value or total users in DB.
        userInfo = rs.getDouble( "USER_VALUE");

        m_userCount = (int) userInfo;
   }
Run Code Online (Sandbox Code Playgroud)

java sql database

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

jsf 不显示字段,只显示文本

我在 IE 上的 jsf 页面不会在 firefox 上显示任何内容,我至少可以获取文本。奇怪的是,没有错误,所以我不确定出了什么问题。我环顾四周寻找信息,甚至为页面添加了 af:view 但仍然没有。感谢您的时间。

            <!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:h="http://xmlns.jcp.org/jsf/html"
                  xmlns:f="http://java.sun.com/jsf/core" 
                  xmlns:a4j="http://richfaces.org/a4j" >
            <f:view contentType="text/html">

            <h:head>
            <title>QC-Form</title>
            <link href="./css/styles.css" 
                  rel="stylesheet" type="text/css"/>
            </h:head>



            <h:body>
            <h1 class="title">QC Form</h1>
            <br/> <br/>

              <font face="comic sans MS" size="2" color="#33CCFF">
              <p><b>Enter the information below: </b> </p>
              </font>

            <h:form>

             <font face="comic sans MS" size="2"> 

             <h:panelGroup id="initialInfo">

                <b>Your initials: </b>  
                    <h:inputText value="#{qcFormBean.techNameValue}"/><br/>
                <br/>

                <b>Model #: </b>  
                <h:selectOneMenu value="#{qcFormBean.modelValue}">
                  <f:selectItem itemValue="3600" itemLabel="3600" />
                  <f:selectItem itemValue="7200" itemLabel="7200" />
                  <f:selectItem itemValue="8300" …
Run Code Online (Sandbox Code Playgroud)

jsf servlets facelets jsf-2

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

Python,更改字符串变量的字体大小

我有一个变量可以作为文本发送到电子邮件,但文本几乎都是标准尺寸,一切都相同.我想对它加以强调,并使其更大,并尽可能使其变得大胆.这是我想要编辑的代码.

  final_name = "Changes by" + str(name)+" ***"
Run Code Online (Sandbox Code Playgroud)

我知道它并不多,但我想知道是否可以使变量字符串变粗并且字体大小稍大.

python fonts font-size

-3
推荐指数
1
解决办法
6914
查看次数