项目的框架是struts2,现在想request.getInputStream()读取xml形式的流,结果就如下的错误。这要怎么解决啊,各位帮忙看看
ognl.ExpressionSyntaxException: Malformed OGNL expression: <?xml version [ognl.ParseException: Encountered "<" at line 1, column 1.
Was expecting one of:
":" ...
"not" ...
"+" ...
"-" ...
"~" ...
"!" ...
"(" ...
"true" ...
"false" ...
"null" ...
"#this" ...
"#root" ...
"#" ...
"[" ...
"{" ...
"@" ...
"new" ...
<IDENT> ...
<DYNAMIC_SUBSCRIPT> ...
"\'" ...
"`" ...
"\"" ...
<INT_LITERAL> ...
<FLT_LITERAL> ...
]
at ognl.Ognl.parseExpression(Ognl.java:116)
ognl.ExpressionSyntaxException: Malformed OGNL expression: <?xml version [ognl.ParseException: Encountered "<" at line 1, column 1.
Was expecting one of:
":" ...
"not" ...
"+" ...
"-" ...
"~" ...
"!" ...
"(" ...
"true" ...
"false" ...
"null" ...
"#this" ...
"#root" ...
"#" ...
"[" ...
"{" ...
"@" ...
"new" ...
<IDENT> ...
<DYNAMIC_SUBSCRIPT> ...
"\'" ...
"`" ...
"\"" ...
<INT_LITERAL> ...
<FLT_LITERAL> ...
]
at ognl.Ognl.parseExpression(Ognl.java:116)
解决方案 »
- spring事物配置出错
- 麻烦各位写个正则表达式
- struts2 HELP ME
- hibernate中出现org.hibernate.exception.GenericJDBCException: could not execute query请问怎么解决?
- 请教一个Lucene问题
- Concurrent issue:about read write lock
- 问java操作远程文件?
- 各位大侠,有没有好的STRUTS入门的资料给小弟分享一下啊
- 请问怎么用JB7给放在客户端的home,remote接口打包?
- spring boot 中@Autowired不起作用
- 求解决方法!急
- hql语句模糊查询问题!
后来加了一句post.setRequestHeader("Content-type", "text/xml; charset=UTF-8");问题就解决了。
htttpclient里有PostMethod类,我的post就是PostMethod post=new PostMethod();如果你是页面请求的,html的head标签里加上Content-type的设置
如果通过action提交的话,可以在response里设置。