Jsf <;h:按钮>;不执行简单bean方法

Jsf <;h:按钮>;不执行简单bean方法,jsf,button,Jsf,Button,我正在尝试一个简单的bean方法,但它不起作用,不要在eclispe的控制台中显示syso,当我单击按钮时,它会将我的url更改为http://localhost:8080/Projeto01/index.jsf?jftfdi=&jffi=%2Findex.xhtml 为什么不工作,为什么它会更改这个奇怪的url的url mymsg.java(bean) myindex.xhtml <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitio

我正在尝试一个简单的bean方法,但它不起作用,不要在eclispe的控制台中显示syso,当我单击按钮时,它会将我的url更改为
http://localhost:8080/Projeto01/index.jsf?jftfdi=&jffi=%2Findex.xhtml

为什么不工作,为什么它会更改这个奇怪的url的url

mymsg.java(bean)

myindex.xhtml

<!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://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
        <ui:composition>

<h:head></h:head>

    <h:body>
    <h:form>

    <h:button value="Show" action="#{msg.show()}"></h:button>

    </h:form>
    </h:body>
    </ui:composition>
</html>

还有我的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_2_5.xsd" version="2.5">
  <display-name>do0</display-name>
  <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>*.jsf</url-pattern>
  </servlet-mapping>
</web-app>

do0
Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
*.jsf
是一个简单的逐页导航按钮。如中所示,它根本不支持
操作
属性。您很可能将
混淆,后者反过来又支持该属性

为了实现在按下按钮时调用JSF支持bean方法的功能需求,只需将
替换为


另见:

对于目标URL中的
jftfdi
jffi
查询字符串参数,这是Mojarra实现新JSF2.2流范围的一个缺陷。这在Mojarra 2.2.5中已修复。请注意,这与您的具体问题无关,因为您不应该首先使用

另见:
<?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_2_5.xsd" version="2.5">
  <display-name>do0</display-name>
  <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>*.jsf</url-pattern>
  </servlet-mapping>
</web-app>
<h:commandButton value="Show" action="#{msg.show()}" />