Other programmer's idea
http://www.junlu.com/msg/322793.htmlJSON ORG
JSON-lib
- Download JSON-lib and install it into Web project
- There is nothing special required to do to pass the parameter to Actions.
Just follow JQuery's function:
$.post("/TSMWeb/cardImportAction.do", {actionType: "initAjax", comAccount: issuerSelectValue}, issuerSelectCallBack, "json"); - In Struts 2.x, the only thing you need to do is set up the struts.xml to notify the framework packing the response in JSON format.
- In Struts 1.x, you should create a JSONObject to transfer your java object into JSON format and use an "almost empty" JSP to send JSON messages:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
${tsmJSON} - Save your JSON Object with a key name "tsmJSON" by calling request.setAttribute().
- That's it! Now you can catch the response in JSON format in your client JSP!
No comments:
Post a Comment