我没有收到来自服务器的JSON类型数据的响应.
我正在使用JSON插件.
jQuery( "#dialog-form" ).dialog({
autoOpen: false,
height: 500,
width: 750,
modal: true,
buttons :{
"Search" : function(){
jQuery.ajax({type : 'POST',
dataType : 'json',
url : '<s:url action="part" method="finder" />',
success : handledata})
}
}
});
var handledata = function(data)
{
alert(data);
}
Run Code Online (Sandbox Code Playgroud)
如果dataType = 'json'我没有得到任何回复,但如果我没有提及任何回复,dataType我将获得该页面的HTML格式.
public String list(){
JSONObject jo = new JSONObject();
try {
Iterator it = findList.iterator();
while(it.hasNext()){
SearchResult part = (SearchResult) it.next();
jo.put("col1",part.getcol1());
jo.put("col2",part.getcol2());
}
log.debug("--------->:"+jo.toString());
} catch (Exception e) {
log.error(e); …Run Code Online (Sandbox Code Playgroud) 我尝试使用<s:url ..标记实现令牌拦截器,但在第一次单击时显示错误.即The form has already been processed or no token was supplied, please try again.
我想实现这个拦截器,因为如果用户已经删除了一行并再次刷新页面,那么同一个动作不应该再次执行.
<s:url id="linkdelete" action="DeleteLatestUpload.action" namespace="/admin/insecure/upload">
<s:param name="latestUploadId" value="latestUploadId"></s:param>
<s:token name="token"></s:token>
</s:url>
<a href='<s:property value="#linkdelete"/>' style="color: white;text-decoration: none;" class="delbuttonlink">Clear current Uploads</a>
Run Code Online (Sandbox Code Playgroud)
和我的struts.xml:
<action name="DeleteLatestUpload" class="v.esoft.actions.UploadExcel" method="deleteUploads">
<interceptor-ref name="token"></interceptor-ref>
<interceptor-ref name="basicStack"></interceptor-ref>
<result name="success" type="tiles"> uploadforward</result>
<result name="invalid.token" type="tiles">uploadforward </result>
</action>
Run Code Online (Sandbox Code Playgroud)