How to make a redirection on page load in JSF 1.x

后端 未结 5 1666
谎友^
谎友^ 2020-12-02 08:18

I have a web-application where the users can be sent directly to some specific pages (such as a page where he can view or edit an item). To achieve that, we provide a specif

5条回答
  •  我在风中等你
    2020-12-02 09:12

    Assume that foo.jsp is your jsp file. and following code is the button that you want do redirect.

      
    

    And now we'll check the method for directing in your java (service) class

     public String enter() {
                if (userName.equals("xyz") && password.equals("123")) {
                    return "enter";
                } else {
                    return null;
                }
            } 
    

    and now this is a part of faces-config.xml file

    
            'class_name'
            'package_name'
            request
        
    
    
        
                    enter
                    /foo.jsp
                    
                
    

提交回复
热议问题