用户选择语言后,我想将他重定向到上一页。但是当我尝试在代码下运行时,它继续调用请求。有没有办法做到这一点?
我的语言选择;
<s:url id="indexEN" namespace="/" action="locale" >
<s:param name="request_locale" >en_US</s:param>
</s:url>
<s:url id="indexBR" namespace="/" action="locale" >
<s:param name="request_locale" ></s:param>
</s:url>
<s:a href="%{indexEN}" >English</s:a>
<s:a href="%{indexBR}" >Brs</s:a>
这是我的struts.xml
<package name="default" namespace="/" extends="struts-default">
<action name="locale" class="myutils.LocaleAction">
<result name="input">${Url}</result>
</action>
</package>
我的LocaleAction.java
public class LocaleAction extends ActionSupport {
private String Url;
//business logic
public String execute() {
return INPUT;
}
public String getUrl() {
HttpServletRequest request = ServletActionContext.getRequest();
Url = request.getRequestURI();
return Url;
}
}