简体   繁体   中英

Ajax Response for a JSON Data

I am using AJAX to cal my struts action class and it's storing some data in session.

public String myMethod(){
     session.put("DATA", JSON_STRING); //JSON formatted string
     return "forward";
}

I am forwarding to a jsp page in which I am printing this data

<%@taglib prefix="s" uri="/struts-tags"%>
<s:property value="#session['DATA']" />

So in the end I am receiving the AJAX Call Response

[{&quot;title&quot;: &quot;OFP LALOUV0042/ODF96-02 PD/FP16 (L)&quot;, &quot;key&quot;: &quot;551&quot;}]

What I am expecting is

[{"title": "OFP LALOUV0042/ODF96-02 PD/FP16 (L)", "key": "551"}]

尝试这个:

<s:property value="#session['DATA']" escapeHtml="false" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM