简体   繁体   English

h:inputText-字段可见吗?

[英]h:inputText -Field is visible?

i am developing a jsf web application with netbeans. 我正在使用netbeans开发jsf Web应用程序。

    <fieldset>
        <div>
           <h:inputText id="firstname" value="#{loginCtrl.customer.name}" label="Name">
                  <f:validateLength minimum="3" maximum="8"/>
           </h:inputText>
        <div>
...

I wrote that code but when I deploy it to the apache tomcat server, there is no field shown? 我写了这段代码,但是当我将其部署到apache tomcat服务器时,没有显示字段吗? Why? 为什么? h:input has no visibility element? h:input没有可见性元素?

greetings and thx in advance 提前问候和感谢

PS.: my web.xml file: PS .:我的web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>faces/register.jsf</welcome-file>
    </welcome-file-list>
</web-app>

Make sure that the request URL as you see in browser's address bar matches the URL pattern of the FacesServlet as specified in web.xml . 确保在浏览器地址栏中看到的请求URL与web.xml指定的FacesServlet的URL模式匹配。 You can verify this by rightclicking the page in browser and viewing the generated HTML source. 您可以通过右键单击浏览器中的页面并查看生成的HTML源来验证这一点。 If the <h:inputText> is still there, then it means that the FacesServlet isn't been invoked at all. 如果<h:inputText>仍然存在,则意味着根本没有调用FacesServlet

If you open the page by /page.xhtml , then the FacesServlet is apparently not mapped on *.xhtml , but on *.jsf or something else. 如果通过/page.xhtml打开页面,则FacesServlet显然不是映射在*.xhtml ,而是映射在*.jsf或其他上。 You'd need to change the URL in browser's address bar accordingly to match exactly the specified URL pattern, or to fix the mapping accordingly. 您需要相应地更改浏览器地址栏中的URL,以完全匹配指定的URL模式,或相应地修复映射。

h:input has no visibility element?

Yes, the h:inputText element have rendered attribute: 是的, h:inputText元素具有rendered属性:

<h:inputText id="firstname" rendered="true" value="#{loginCtrl.customer.name}" 
    label="Name">
      <f:validateLength minimum="3" maximum="8"/>
</h:inputText>

But the defalut is true so the preblem is not with that... 但是defalut是真的,所以问题就不在于此...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM