You could try using a Filter. I'm sure there are many tutorials and examples
out there. Here is an example:
Web.xml
<filter>
<filter-name>MyFilter</filter-name>
<filter-class>com.wss.util.MyFilter</filter-class>
<description>Some description.
</description>
</filter>
<filter-mapping>
<filter-name>MyFilter</filter-name>
<url-pattern>/do/*</url-pattern>
</filter-mapping>
MyFilter.java
public class MyFilter implements Filter {
private ServletContext context;
private String filterName;
public void init(FilterConfig config) throws ServletException {
this.context = config.getServletContext();
this.filterName = config.getFilterName();
}
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
// Add preprocessing code here. Maybe you could do a
request.setAttribute() and then
// use the value in your Action. You have full access to
everything in the request,
// so you could iterate through the request params and do
your checking.
chain.doFilter(request, response);
// Add code here if we want to do something after the
request has been
// processed in chain.doFilter().
}
public void destroy() {
// TODO Auto-generated method stub
}
}
-----Original Message-----
From: Lim Hock-Chai [mailto:[EMAIL PROTECTED]
Sent: Friday, September 23, 2005 12:00 PM
To: [email protected]
Subject: Change the query parm before forward
is there a way to change the query parm in the request before forward it?
In my struts config file, I've a initialization action. If say the order
item sequence# is missing in the query parm, I need to change it to default
to the next item sequence # before it forward to the actual form.
thanks.
****************************************************************************
This email may contain confidential material.
If you were not an intended recipient,
Please notify the sender and delete all copies.
We may monitor email to and from our network.
****************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]