兄弟问错地方了吧???
这个是你的java代码错误,和struts有冲突或者不符合吧?而不是js代码错误
这个是你的java代码错误,和struts有冲突或者不符合吧?而不是js代码错误
解决方案 »
- 百分求助,在线等,关于JasperReport中String类型输出总是为null
- 求数组最大和最小值
- 求推荐一本SSH的书,谢谢了!
- 做一个上报的接口,采用Webservice合适吗?
- 【】WSAD环境下struts_config.xml文件应该如何配,和Eclipse中有何区别?>
- Hibernate入门级的问题
- WebService返回内容过长出错怎么处理(TOMCAT5.0+Axis1.1)
- 如何学好struts?
- 怎么编一个像csdn这样的论坛啊?
- 紧急求助: 字符转化成日期!!!! 100分
- Hibernate的Example queries运用疑问
- 总也编译不了jsp,好像是配置的问题,那位仁兄帮帮忙。
System.out.println("xml="+xml);
这里开始就错掉了,你这里应该还没有获得到xml,你没发现后面打出来的报错信息吗
xml=
[Fatal Error] :-1:-1: Premature end of file.
SAXException: org.xml.sax.SAXParseException: Premature end of file.
java.lang.NullPointerException
at dwr.struts.action.ProAction.send(ProAction.java:75) xml根本就没有取到值 ,所以根据xml生成的xmlDoc 也是null,然后就
catch(SAXException e) {
System.out.println("SAXException: " + e);
}
这个异常啦.
at dwr.struts.action.ProAction.send(ProAction.java:75)
这句主要是因为
NodeList selectedPetTypes = xmlDoc.getElementsByTagName("type");
xmlDoc是null的,所以这里才也会报个空指针异常
System.out.println("xml="+xml);
Document xmlDoc = null;
try {
xmlDoc =
DocumentBuilderFactory.newInstance().newDocumentBuilder()
.parse(xml);
}
catch(ParserConfigurationException e) {
System.out.println("ParserConfigurationException: " + e);
}
catch(SAXException e) {
System.out.println("SAXException: " + e);
}private String readXMLFromRequestBody(HttpServletRequest request){ //不要了
StringBuffer xml = new StringBuffer();
String line = null;
try {
BufferedReader reader = request.getReader();
while((line = reader.readLine()) != null) {
xml.append(line);
}
}
catch(Exception e) {
System.out.println("Error reading XML: " + e.toString());
}
System.out.println(xml.toString());
return xml.toString();
}
按照你的说法,还是不行,但是已经可以获取xml的值了
输出如下:
xml=org.apache.coyote.tomcat5.CoyoteInputStream@45484a
[Fatal Error] :-1:-1: Premature end of file.
SAXException: org.xml.sax.SAXParseException: Premature end of file.
把这个去掉看看.
createXML();
这个让我看看,是不是XML的事.
这个写了没有.
没遇到过帮不了你.