user-uc.1250646216.gailghbjfpefofegeakd-xnpeng=163....@struts.apache.orguser-uc.1250646216.gailghbjfpefofegeakd-xnpeng=163.com@struts.apache.orguser-uc.1250646216.gailghbjfpefofegeakd-xnpeng=163....@struts.apache.orguser-uc.1250646216.gailghbjfpefofegeakd-xnpeng=163.com@struts.apache.orguser-uc.1250646216.gailghbjfpefofegeakd-xnpeng=163....@struts.apache.orguser-uc.1250646216.gailghbjfpefofegeakd-xnpeng=163.com@struts.apache.orguser-uc.1250646216.gailghbjfpefofegeakd-xnpeng=163....@struts.apache.org
在2009-08-19,"Paweł Wielgus" <poulw...@gmail.com> 写道: >Hi Rafael, >inside intecept method of your security interceptor You can do >something like this: > >ActionMapping actionMapping = ServletActionContext.getActionMapping(); >Map<String, String[]> parameters = >ServletActionContext.getRequest().getParameterMap(); >String redirectLink = namespace+"/"+actionMapping.getName(); >if (parameters.size() > 0) { > redirectLink += "?"; > for (Entry<String, String[]> entry : parameters.entrySet()) { > for (String value : entry.getValue()) { > redirectLink += entry.getKey()+"="+value+"&"; > } > } > redirectLink = redirectLink.substring(0, redirectLink.length()-1); >} >ServletActionContext.getRequest().getSession().setAttribute(REDIRECT_AFTER_LOGIN, >redirectLink); >return "login-input"; > >and inside login action check for REDIRECT_AFTER_LOGIN. >It's not anything proof, so understand that for example it will not >work for too many params. > >Hope that helps, >Paweł Wielgus. > > > >2009/8/18 Rafael Taboada <kaliman.fore...@gmail.com>: >> Hi folks. >> >> In my app, users can access to some actions, just typing them in the >> browser. But I need to implement a way to login first and then redirect them >> to the URL they wrote. Is there any way to do this? >> >> I was thinking to use an interceptor to see if there is an open session and >> redirect to login in case there is no open session. But how can capture and >> save the URL they wrote and after a successful login, redirect to that URL? >> >> Thanks in advance for your help >> >> Rafael Taboada >> Software Engineer >> >> Cell : +511-992741026 >> >> "No creo en el destino pues no me gusta tener la idea de controlar mi vida" >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >For additional commands, e-mail: user-h...@struts.apache.org >