我现在使用JSF想使用redirect重定向到别的网站,请教XML如何配置。JSF

解决方案 »

  1.   

    我用JSF没用到过XML,如果是在页面跳的话直接放个链接[code=java<a href="www.baidu.com">百度</a>][/code]如果在后台的话 直接在Action中返回一个页面  public String login(){
    ........  return "www.baidu.com";} 或者 ((HttpServletResponse) FacesContext.getCurrentInstance()
    .getExternalContext().getResponse()).sendRedirect("www.baidu.com")
      

  2.   

    谢谢,但好像不行也。话说JSF可以不用faces-config.xml来配置吗?
      

  3.   

    我以为更Struts2一样,但是不行:结果成这样:
      

  4.   

    我这边ation都是直接用注解的...用Name注解,你说的那个文件和这个跳转的没任何关系吧!...你是要在什么地方跳转?登录成功后还是?
      

  5.   

    我用的JBOSS 5的,你用可能是支持JSF2.0的应用服务器吧。
      

  6.   

    public String login() {

    loginService
    .login(null, tempUserName, getPassword(), getLdapName());
    AppUserContext.getUserInfo().setLanguage(getLanguage());

    AppUserContext.getUserInfo().setPassword(getPassword()); String result = identity.login();
    if (result == null) {
    return "/pages/login/Login.jsf?login_error=1&lan="+getLanguage();
    }
    if (loginService.isPwdExpire(tempUserName)) {
    return "/pages/login/ChangePwd2.jsf?cpwChange=loginChage"; }
    } catch (BadCredentialsException e) {
    return "/pages/login/Login.jsf?login_error=1&lan="+getLanguage();
    } catch (Exception ex) {
    SystemUtils.throwException("user_pass_error");
    }

    return "/index.jsf";
    }