[問題] 關於JSON的問題~~消失

看板java作者時間5年前 (2018/11/19 23:38), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
新手提問~麻煩前輩們了~~~~ 使用Maven~ Spring 3.0.0.RELEASE <<------- 掛 json pom ------->> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.3</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> <version>2.4.0</version> </dependency> <<------- 在spring xml 設定 -------->> <mvc:annotation-driven /> <<------- java 程式 -------->> @Controller @RequestMapping("/omgd") public class OmGDController { @Autowired private QS qS; @RequestMapping(value = "/testJsonGoGo.do", method = RequestMethod.POST) public @ResponseBody QS testJson(HttpServletRequest req) { System.out.println("========testJson=========="); System.out.println(request.getParameter("name")); qS.setCNQry("1101"); qS.setCNeQry(1234); qS.setLQ("setLevelQry"); qS.setNPQry(111111); qS.setNSQry(222222); qS.setPQry(2.5); qS.setTQry(new Date()); return qS; } <<------- jsp 程式 使用jquery ------->> <script type="text/javascript"> $(function() { $("#btn1").click(function() { $.post('<c:url value="/omgd/testJsonGoGo.do" />', { name : "John", time : "2pm" }, function(data) { alert("ihihihihihihihihhi"+data) }); }); }); </script> 在jsp頁面 alert出不來json~~取不到值 不知道哪裡的問題Orz,,,,謝謝 -- ˊ──ˋ ▅▆▅▄ ▂▃▂ ▂▃▂ (( )) \ /◣ ◤◤◤ ◥◤ |● ●◤● ●● ● __ __ __  ̄▼ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.231.67.242 ※ 文章網址: https://www.ptt.cc/bbs/java/M.1542641918.A.5E9.html
文章代碼(AID): #1RyjZ-Nf (java)