0 Replies Latest reply on Nov 17, 2019 5:29 AM by doppi

    Problem with action attribute of commandButton in JSF 2.3

    doppi

      I cannot navigate on the page written inside the action attribute of command button.

       

      I've tried putting the base name of the page (the page name is conf.xhtml so i put conf in the action attribute) and i also tried with a named bean expression.

       

      this is my bean class:

       

      /////////////

      import javax.enterprise.context.RequestScoped;

      import javax.inject.Named;

       

      @Named

      @RequestScoped

      public class PersonaNamed {

       

           private String nome;

           public String getNome() {

                return nome;

           }

           public void setNome(String nome) {

                this.nome = nome;

           }

       

           public String inserisci() {

                return "conf";

           }

       

      }

      ///////////////

       

      this is my page:

       

      <!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"

            xmlns:f="http://java.sun.com/jsf/core"

            xmlns:h="http://java.sun.com/jsf/html">

       

       

      <h:form>

      nome:<h:inputText/>

      <br/>

      <h:commandButton action="#{personaNamed.inserisci}" value="inserisci"></h:commandButton>

      </h:form>

      </html>

      //////////////////

       

      and this is my web.xml:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">

        <display-name>boh</display-name>

       

        <context-param>

          <param-name>javax.faces.PROJECT_STAGE</param-name>

          <param-value>Development</param-value>

        </context-param>

       

       

        <welcome-file-list>

          <welcome-file>pagina.xhtml</welcome-file> 

        </welcome-file-list>

       

        <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>*.xhtml</url-pattern>

        </servlet-mapping>

       

      </web-app>

       

       

      why doesn't work?? This is getting me crazy