Login checking before processing any action/class 2007-11-05 - By Emi Lu
Back Hello ,
For struts1, we use "doFilter"
public void doFilter( ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req; HttpServletResponse response = (HttpServletResponse) res; HttpSession session = request.getSession();
If not login successfully:
ActionConfig action = ... this.sendRedirect(request, response, action.getPath());
else { chain.doFilter(req,res); }
}
in web.xml, all classes/actions need be filtered by this actionClass.
For struts2, do you have a good example for login checking? Moreover, before each action/class is called, a login checking will be done automatically. If user logins successfully, allow user action to be processed; otherwise, return error msg to default login page.
Thank you!
-e
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------ To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|