页面自动跳转与读取xml文件

来源:互联网 发布:单片机仿真软件有哪些 编辑:程序博客网 时间:2024/05/16 07:22

1、显示模态窗口 showModelessDialog("/maddressbook/notify.do?method=queryNotifyBySortAsPage&currentPage="+Page+"&notifySort="+sort,"","dialogWidth:500px; dialogHeight:300px; edge: Sunken; center: Yes; help: No; resizable: yes; status: No;scroll:NO;unadorned:NO;");

2、自动跳转代码<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>正在进入</title></head><body><form name=loading>  <p align=center> <font color="#0066ff" size="2"><span style="color: red" id="s">${addmodulesuccess}</span>正在进入,请稍等</font><font color="#0066ff" size="2" face="Arial">...</font>  <input type=text name=chart size=46 style="font-family:Arial; font-weight:bolder; color:#0066ff; background-color:#fef4d9; padding:0px; border-style:none;">     <input type=text name=percent size=47 style="color:#0066ff; text-align:center; border-width:medium; border-style:none;">   <script>  var bar=0  var line="||"  var amount="||"  count()  function count(){  bar=bar+2  amount =amount + line  document.loading.chart.value=amount  document.loading.percent.value=bar+"%"  if (bar<99)  {setTimeout("count()",100);}  else  {window.location = "/maddressbook/module.do?method=toadd";}  }</script>  </p> </form> <p align="center"> 如果您的浏览器不支持跳转,<a style="text-decoration: none" href="/maddressbook/module.do?method=toadd"><font color="#FF0000">请点这里</font></a>.</p></body></html>

3、如果想跳转到另外一个action的某个页面,可以这样:ActionForward actionForward = new ActionForward();actionForward.setPath("/customer/creditApprManage.do?method=searchCreditLevel&levelName=");return actionForward;

4、读取XML文件 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder db = factory.newDocumentBuilder(); Document doc = db.parse(new File("d://struts-config.xml")); Element elmtInfo = doc.getDocumentElement();//获得根节点 NodeList nodes = elmtInfo.getChildNodes();//获得根节点的子节点 System.out.println("/******"+nodes.getLength()+"******/"); int m = 1; for (int i = 0; i < nodes.getLength(); i++) { Node result = nodes.item(i); if (result.getNodeType() == Node.ELEMENT_NODE && result.getNodeName().equals("action-mappings")) { NodeList ns = result.getChildNodes(); for (int j = 0; j < ns.getLength(); j++) { Node record = ns.item(j); if (record.getNodeType() == Node.ELEMENT_NODE && record.getNodeName().equals("action")) { System.out.println(m + ": " + record.getAttributes().getNamedItem("path").getNodeValue()); m++; } } } }

5、mysql连接串<property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/><property name="JDBC.ConnectionURL" value="jdbc:mysql://192.168.88.216:3306/gw"/><property name="JDBC.Username" value="root"/><property name="JDBC.Password" value="root"/>

原创粉丝点击