⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 actionparser.java

📁 稿件名称:基于JAVA的JNDI技术和反射机制 稿件作者:段谟意 源代码名称:WEB-INF 调试环境:Win XP;Tomcat, JVM:JDK 1.5.2
💻 JAVA
字号:
package ddd.com.parse;
import javax.servlet.*;
import java.util.*;
import org.w3c.dom.*;
import ddd.com.ConfigConstants;
import ddd.com.config.*;
public class ActionParser extends AbstractParser
{
	private HashMap actions;
	private HashMap formbeans;
	public void init(ServletContext sct,String xmlSource)
	{
		super.init(sct,xmlSource);
		actions=new HashMap();
		formbeans=new HashMap();
		handlerActions();
		handlerFormbeans();
		clearup();
	}
	private void handlerActions()
	{
		NodeList actionList=getElements(root,ConfigConstants.ACTION);
		for(int i=0;i<actionList.getLength();i++)
		{
			ActionConfig actionConfig=new ActionConfig();
			String path=this.getProperty(actionList.item(i),ConfigConstants.PATH);
			String type=this.getProperty(actionList.item(i),ConfigConstants.TYPE);
			String name=this.getProperty(actionList.item(i),ConfigConstants.NAME);
			String sValidate=this.getProperty(actionList.item(i),ConfigConstants.VALIDATE);
			String input=this.getProperty(actionList.item(i),ConfigConstants.INPUT);
			actionConfig.setPath(path);
			actionConfig.setType(type);			
			actionConfig.setName(name);			
			if(sValidate!=null && sValidate.equals("true"))
				actionConfig.setValidate(true);
			else
				actionConfig.setValidate(false);
			actionConfig.setInput(input);
			if(actionList.item(i).hasChildNodes())
			{
				NodeList forwardList=this.getElements(actionList.item(i),ConfigConstants.FORWARD);
				for(int j=0;j<forwardList.getLength();j++)
				{
					ForwardConfig fConfig=new ForwardConfig();
					String fname=this.getProperty(forwardList.item(j),ConfigConstants.NAME);
					String uri=this.getProperty(forwardList.item(j),ConfigConstants.URI);
					fConfig.setPath(path);
					fConfig.setName(fname);
					fConfig.setUri(uri);
					actionConfig.addForward(fConfig);
				}
			}
			actions.put(path,actionConfig);
		}
	}
	private void handlerFormbeans()
	{
		NodeList nodeList=this.getElements(root,ConfigConstants.FORM_BEAN);
		for(int i=0;i<nodeList.getLength();i++)
		{
			FormbeanConfig formConfig=new FormbeanConfig();
			String name=this.getProperty(nodeList.item(i),ConfigConstants.NAME);
			String type=this.getProperty(nodeList.item(i),ConfigConstants.TYPE);
			formConfig.setName(name);
			formConfig.setType(type);
			formbeans.put(name,formConfig);
		}
	}
	public HashMap getActions()
	{
		return actions;
	}
	public HashMap getFormbeans()
	{
		return formbeans;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -