我有一个使用速度的 java we 应用程序。我通过使用 ureq.getParameter() 方法提取的 url 在第一页中获得了两个变量。具有速度容器的其他类之一,我需要将其中一个变量从 url 发送到此速度容器。我尝试在第二个类中创建第一个类的实例并使用 getVariable name 方法来做到这一点,但它不起作用。有人能告诉我我该怎么做吗?
第一类:
package org.olat.dispatcher;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.olat.core.gui.UserRequest;
public class RemoteLoginformDispatcher implements Dispatcher {
private static final String PARAM_newUrl = "ret";
private static String newURL;
@Override
public void execute(
final HttpServletRequest request,
final HttpServletResponse response,
final String uriPrefix) {
UserRequest ureq = null;
try {
ureq = new UserRequest(uriPrefix, request, response);
newURL = ureq.getParameter(PARAM_newUrl);
} catch () {
}
}
public String getURL(){
return newURL;
}
}
第 2 类:
public class BaseChiefController extends DefaultChiefController implements ContentableChiefController {
//Velocity container mainvc created here. It interacts with a html file. Removed the code that would not really matter
//mainvc.contextPut("newURL", "something");
//The below statement works. When I try with something, the something appears in the html file.
mainvc.contextPut("newURL", myLogin.getURL());
}