Code example for Element

Methods: getAttribute, getLocalName

0
        } 
    } 
 
    private URLRewrite parseAction(FilterConfig config, String pattern, Element action) throws ServletException {
        URLRewrite rewrite = null;
        if ("forward".equals(action.getLocalName())) {
            rewrite = new PathForward(config, action, pattern);
        } else if ("redirect".equals(action.getLocalName())) {
            rewrite = new Redirect(action, pattern);
        } else if ("root".equals(action.getLocalName())) {
        	ControllerForward cf = new ControllerForward(action, pattern);
        	 
        	/* 
        	 * If there is a server-name attribute on the root tag, then add that 
        	 * as an attribute on the ControllerForward object. 
        	 */ 
        	String serverName = action.getAttribute(SERVER_NAME_ATTRIBUTE);
        	if (serverName != null && serverName.length() > 0) {
        		cf.setServerName(serverName);
        	} 
            rewrite = cf;
        }