You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Heidy Gutiérrez Guzmán <he...@gmail.com> on 2007/01/24 22:13:35 UTC
how to go back to input page?
Hi
I need to know how to go back to input page in struts.
Thanks
Re: how to go back to input page?
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Heidy,
Heidy Gutiérrez Guzmán wrote:
> In the application, i have the option of change language from any page.
What about using the "referer" header (yes, it is misspelled)?
- -chris
Here is the code for my entire SwitchLocaleAction.java:
import java.util.Locale;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class SwitchLocaleAction
extends BaseAction
{
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
{
String language = request.getParameter("lang");
String country = request.getParameter("country");
Locale locale;
if(null == language)
throw new ServletException("No language specified.");
if(null == country)
{
locale = new Locale(language);
}
else
{
locale = new Locale(language, country);
}
super.setLocale(request, locale);
String redirect = request.getParameter("next");
if(null == redirect)
redirect = request.getHeader("referer");
if(null != redirect)
{
if(0 > redirect.indexOf(";jsessionid="))
redirect = response.encodeRedirectURL(redirect);
response.sendRedirect(redirect);
}
else
response.getWriter().write("Cannot determine next page.
Please go back manually.");
return null;
}
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFt+gu9CaO5/Lv0PARAsQ3AKCxLXVLRev3ugNkvUPfNShdPgdpswCfS/MM
ckUc1hmZ9CGDK6yY4ZVat4M=
=dKxM
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to go back to input page?
Posted by Heidy Gutiérrez Guzmán <he...@gmail.com>.
In the application, i have the option of change languaje from any page.
When that option is selected, go to an Action where i do the necesary for
that, after that i need to go back to the input page where the user was.
I would like the solution don't carry on changes on each action on the
struts-config because the application is almost at end and is very
extensive.
Thank you very much
Re: how to go back to input page?
Posted by Dave Newton <ne...@yahoo.com>.
--- Heidy Gutiérrez Guzmán <he...@gmail.com>
wrote:
> I need to know how to go back to input page in
> struts.
Under what circumstances?
mapping.getInputForward()?
Dave
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org