struts2使用jsp和<s:property>标签获取json格式的返回数据

struts2使用jsp和<s:property>标签获取json格式的返回数据

1、struts2的action中

return "success";

2、指向的返回页面success.jsp中的内容为:

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><%@ taglib prefix="s" uri="/struts-tags"%><s:property
value="jsonString" escape="false" />

3、前端jquery的请求方式如下:
$.ajax({
url: _url,
type: 'post',
dataType: 'json',
success: function(data){

此处返回的data即为json格式的数据





原文地址:https://www.cnblogs.com/YuyuanNo1/p/9203793.html