兄弟问错地方了吧???
这个是你的java代码错误,和struts有冲突或者不符合吧?而不是js代码错误
这个是你的java代码错误,和struts有冲突或者不符合吧?而不是js代码错误
解决方案 »
- 求助:import导入错误
- 关于用httpclient抓取文字和图片?
- 求救:tomcat 报错 提示mysql 连接已经关闭,com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure,这个问题已经缠绕我多天了
- hibernate group by 查询
- 谁有strut的学习的电子书啊?(有分相赠 ^_^ )
- Cookie与Session有什么区别?有什么地方相同?
- [200分]用什么开发工具开发hibernate最好、最快,最具有开发前景!(在线等待)
- JAVA录音程序调用
- 十分困惑,当我从数据库中取数据时,老是出现科学记数法!在线等到
- 求解决
- 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的事.
这个写了没有.
没遇到过帮不了你.