1.某些端口被占用
2.tomcat运行需要的内存块被改写了
最好把关键代码贴出来看看
2.tomcat运行需要的内存块被改写了
最好把关键代码贴出来看看
解决方案 »
- jstl页面显示问题
- 关于Eclipse3.X + lomboz 配置SQLServer2000 连接池的问题。
- jsp分页按下指定的页码不能跳转到指定的页,而页面原封不动,请大家指教一下
- 这个异常如何处理啊,急等!
- 遇见麻烦了java.sql.SQLException: Communication failure during handshake.
- 帮忙看看这个连接池,是不是有问题,我log的时候说的物理连接数为什么会超出我配置文件里的最大连接数,欢迎讨论!
- 如何在点击链接的时候就刷新所链接的页面?
- JSP调用JAVABEAN时出错.
- JAVA 操作Excle的问题 (急,在线等).到 先谢谢大家的帮忙!
- 用jsp上传文件!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
- 关于excel的问题!当把一个excel文件当成数据源时,怎样知道其中的每个sheet各有多少列?谢谢
- struts是什么?
import java.util.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
public class News{ Vector news_Vector;
public News(){
news_Vector = new Vector();
}
public void readFile(String inFile) throws Exception{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = null;
try{
db = dbf.newDocumentBuilder();
}catch(ParserConfigurationException pce){
System.err.println(pce);
System.exit(1);
} Document doc = null;
try{
doc = db.parse(inFile);
}catch(DOMException dom){
System.err.println(dom.getMessage());
System.exit(1);
}catch (IOException ioe){
System.err.println(ioe);
System.exit(1);
}
Element root = doc.getDocumentElement();
NodeList newslist = root.getElementsByTagName("NEWS");
for (int i = 0; i < newslist.getLength(); i++) {
Element news = (Element) newslist.item(i);
NewsBean newsBean = new NewsBean();
NodeList ids = news.getElementsByTagName("Id");
if (ids.getLength() == 1) {
Element e = (Element)ids.item(0);
Text t = (Text) e.getFirstChild();
newsBean.setId(Integer.parseInt(t.getNodeValue()));
}
NodeList contents = news.getElementsByTagName("Content");
if (contents.getLength() == 1) {
Element e = (Element)contents.item(0);
Text t = (Text) e.getFirstChild();
newsBean.setContent(t.getNodeValue());
} news_Vector.add(newsBean);
}
} public String readContent(int num){
for(int i = 0;i < news_Vector.size();i++){
NewsBean newsBean = (NewsBean)news_Vector.get(i);
int id = newsBean.getId();
if(id == num){
return newsBean.getContent();
}
}
return null;
} public static void main(String[] args) throws Exception {
News test = new News();
System.out.println("开始读Input.xml文件");
test.readFile("news.xml");
int id = 2;
String content = test.readContent(id);
System.out.println(content);
}
}