j_security_check with Primefaces

后端 未结 2 566
再見小時候
再見小時候 2021-02-10 23:25

How to implement j_security_check with Primefaces? Normally in JSP if you want to use JAAS for login, the log

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-10 23:59

    The solution is pretty straightforward.

    • You need to define the h:form with prependId="false", so that it will not generate id or name of the component as formId:componentId.
    • You need to defined the action="j_security_check" in the h:form as onsubmit="document.getElementById('login').action='j_security_check';"
    • Set the ajax attribute of the p:commandButton to false, so that the form doesn't get submitted in ajax way.

    That's it. Here is the complete code of the login form which can be replaced by the aforesaid form:

    
        
            
                        
            
            
            
        
    
    

    Thanks.

提交回复
热议问题