FileDocCategorySizeDatePackage
ContextRefreshAction.javaAPI DocExample1761Wed Aug 25 19:55:36 BST 2004com.oreilly.strutsckbk.ch10

ContextRefreshAction

public class ContextRefreshAction extends org.apache.struts.action.Action
author
Bill Siggelkow TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Fields Summary
Constructors Summary
Methods Summary
public org.apache.struts.action.ActionForwardexecute(org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm form, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        String name = request.getParameter("name");
        ServletContext ctx = servlet.getServletContext();
        if (name != null && !"".equals(name)) {
            refreshObject(name, ctx);
        }
        else {
            Enumeration names = ctx.getAttributeNames();
            while (names.hasMoreElements()) {
                name = (String) names.nextElement();
                refreshObject(name, ctx);
            }
        }
        return mapping.findForward("success");
    
private voidrefreshObject(java.lang.String name, javax.servlet.ServletContext ctx)

        Object obj = ctx.getAttribute(name);
        if (obj != null && obj instanceof Refreshable) {
            ((Refreshable) obj).refresh();            
        }