我有在ATG上运行的应用程序。我也添加了过滤器servlet。登录时(使用ATGForm),我传递一个参数。我能够在DynamoHttpServletRequest中获得该参数。但是,在我转发或重定向到某个JSP页面后,我无法在Filter servlet中获得该参数。
按以下方式过滤Servlet:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
我无法在request
中获得相同的参数。我在这里缺少什么?
答案 0 :(得分:0)
您可以按照文档了解更多信息: https://docs.oracle.com/cd/E35319_01/Platform.10-2/ATGPlatformProgGuide/html/s0704filterexample01.html
import atg.servlet.ServletUtil;
import atg.servlet.DynamoHttpServletRequest;
import atg.servlet.DynamoHttpServletResponse;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyFilter
implements Filter {
public void doFilter(ServletRequest request,
ServletResponse response,
FilterChain chain)
throws IOException, ServletException
{
// Get the Dynamo Request/Response Pair
DynamoHttpServletRequest dRequest =
ServletUtil.getDynamoRequest(request);
// Get param value
String paramValue =
(String)dRequest.resolveName("paramName");
// Pass control on to the next filter
chain.doFilter(request,response);
return;
}
}