struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john lee <sh_thorn_b...@yahoo.com>
Subject sj:a json return result question
Date Tue, 06 Aug 2013 14:31:51 GMT
 
Question for Sjquery's   sj:a  tag as the following    
 
<s:url id="ajax" value="ReportAction"/>
        <sj:a id="ajaxlink" 
                href="%{ajax}" 
                targets="result" 
                > TOTAL # PARTS 
        </sj:a>
<div id="result"> <s:property value="sum"/></div>
 
public class ReportkeyAction extends extends ActionSupport {
  private int sum;
  public int getSum() { return sum; }
  public void setSum(int sum) { this.sum = sum; }
  public String execute() throws Exception {        sum=310;
        System.out.println("sum get fired for json, val="+sum);
        return "success";
}
public String getJSON()  throws Exception
  {
    System.out.println("json get triggered for json, val="+sum);
    return execute();
  }
}
 
the render return result/display is the following
 
   TOTAL # PARTS  
{"JSON":"success","sum":310}
 
 
I only expect result of 310 get returned, why heading info also get returned?
obvioulsy, <s:property value="sum"/> even did not working.
 
how can i just display 310 only?
 
thanks in advance
 
john
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message