Am passing some parameters through in Struts2, and am getting below error when there is a HTML special Character in parameter value how can i over come this…?
A herf tage used:
<a href="ManufacturerProducts.action?manufId=<s:property value="manufId"/>&mName=<s:property value="manufName"/>"><img src="<s:property value="manufLogo"/>" alt="<s:property value="manufName"/>" /></a>
Error:
12:21:46,034 WARN [OgnlValueStack] Error setting expression ' A Manufacturing Co' with value '[Ljava.lang.String;@4acc69'
ognl.ExpressionSyntaxException: Malformed OGNL expression: A Manufacturing Co [ognl.ParseException: Encountered " <IDENT> "Manufacturing "" at line 1, column 4.
Was expecting one of:
<EOF>
"," ...
"=" ...
"?" ...
"||" ...
"or" ...
"&&" ...
"and" ...
"|" ...
"bor" ...
"^" ...
"xor" ...
"&" ...
"band" ...
"==" ...
"eq" ...
"!=" ...
"neq" ...
"<" ...
"lt" ...
">" ...
"gt" ...
"<=" ...
"lte" ...
">=" ...
"gte" ...
"in" ...
"not" ...
"<<" ...
"shl" ...
">>" ...
"shr" ...
">>>" ...
"ushr" ...
"+" ...
"-" ...
"*" ...
"/" ...
"%" ...
"instanceof" ...
"." ...
"(" ...
"[" ...
<DYNAMIC_SUBSCRIPT> ...
"(" ...
]
at ognl.Ognl.parseExpression(Ognl.java:112)
at com.opensymphony.xwork2.ognl.OgnlUtil.compile(OgnlUtil.java:225)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:209)
at com.opensymphony.xwork2.ognl.OgnlValueStack.trySetValue(OgnlValueStack.java:173)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:160)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:151)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:288)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:199)
Thank you.
Try
or
or
or (better)
or (better)