struts2
来源:互联网 发布:手机时间软件 编辑:程序博客网 时间:2024/05/16 10:33
dom4j解析XML
//获取src文件夹中的xml文件路径
URL url = getClass().getResource("/");
String path = url.getFile() + "config.xml";
//创建SAXReader对象
SAXReader sax = new SAXReader();
try {
//创建Document对象
Document doc = sax.read(new File(path));
//获取根节点
Element root = doc.getRootElement();
//获取指定节点结合
List list = root.elements("action");
for(Element element : list){
//获取属性值
String name = element.attributeValue("name");
for(Element result : resultList){
//获取文件节点值
String page = result.getText(); } }
//反射
String className = "com.kaishengit.vo.Car";
//根据类名创建类的对象
Object obj = Class.forName(className).newInstance();
//获取对象的Class对象
Class clazz = obj.getClass();
//获取所有的方法
Method[] methods = clazz.getMethods();
//获取指定方法
Method method = clazz.getMethod("start");
//执行方法
method.invoke(obj);
- Struts2
- struts2
- struts2
- Struts2
- struts2
- struts2
- Struts2
- struts2
- struts2
- struts2
- Struts2
- Struts2
- Struts2
- struts2
- struts2
- STRUTS2
- Struts2
- Struts2
- 人本界面:交互式系统设计
- linux下C语言编程4-使用共享内存实现进程间通信2
- 用类继承的方式来屏蔽智能提示中 Object 类成员
- linux下完全删除Oracle
- c3p0 配置详解
- struts2
- 如何配置FD
- red5,或者说是开源软件之痛。
- 网页设计-篮球时刻
- SQL Server 2008 获取表结构信息
- Dojo的parse时机的选择
- linux ftp服务器的设置:vsftpd
- 查
- js之美