Redirect pages jsf with parameters

0

I appreciate your collaboration, I'm doing a page jsf that performs a basic authentication with username and password, if the authentication is correct redirects to another page, however I need to send two String

this is my form authentication

<?xml version='1.0' encoding='UTF-8' ?>
<!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">
    <h:head>
        <title>Facelet Title</title>
    </h:head>
    <h:body>
        <h:form>
            <div>
                <p>
                    Usuario: <h:inputText value="#{loginController.username}"/>
                </p>
            </div>
            <div>
                <p>
                    Password: <h:inputText value="#{loginController.password}"/>
                </p>
            </div>
            <div>
                <p>
                   <h:commandButton action="#{loginController.autenticar()}" value="Login"/>
                </p>
            </div>
        </h:form>
    </h:body>
</html>

and this is the autenticar method of the ManageBean

public String autenticar(){
        this.session = null;
        if(this.session.trim().equals("") || this.session == null){
            return null;
        }else{
            return "albumes";
        }
    }

The albumes page should receive two parameters because they are the ones used to send a header in a ResFul Service .

How do I send these two parameters to the page albumes ??

    
asked by isaac 26.02.2018 в 03:25
source

1 answer

0

You have to concatenate "?faces-redirect=true" to the String with the redirection string, and add your parameters. For example:

return "albumes?faces-redirect=true&usuario="+username+"&password="+password;
    
answered by 26.02.2018 в 08:50