开发者

how to redirect to j_security_check in the managed bean?

i've successfully run a based FORM authentication project and trying to do the same with an icefaces project. In other terms i want to use ice:form instead of form, so i was wondering if i could redirect the login request to j_security_check in the managed be开发者_JS百科an:

public void myMethod(ActionEvent e){
  //some code that redirects to j_security_check
}

and in my login page:

<ice:commandButton value="login" ActionListener="#{myBean.myMethod}"/>

But i don't really know how to do it, and i don't really find documentation about j_security_check and how it really works.


You can have a form with action="j_security_check", with text fields or hidden fields containing the username and password. You can bind these fields to variables in your managed bean. You can use a submit button in the form instead of <ice:commandButton>.

If you have to use the <ice:commandButton>, you can use Javascript to send a "myform.submit()" script:

public void myMethod(ActionEvent e)
{
      //Some other code...

      JavascriptContext.addJavascriptCall(
            FacesContext.getCurrentInstance(), "document,forms.myForm.submit()");    
}

You can also dynamically create a form element in Javascript, assign username/password values and submit it, using the JavascriptContext.addJavascriptCall() method

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜