Jfinal Common methods

Source: Internet
Author: User
Tags foreach trim
-------value-------
Take the page Input_kh parameter value, and go to the leading and trailing spaces
String Ls_kh=getpara ("Input_kh"). Trim ()

Take page date and convert to unsigned format
String Ls_a17s=base.fn_dataformat (Getpara ("sdate"). Trim ());

Fetch the SQL return value and return to the list
list<record> retlist = Db.find (Ls_sql);

Take list Row Records
Record map = (record) retlist.get (i);

Data conversion characters
Record map = (record) retlist.get (i);
Object ob = Map.get ("A25");//first turn data into
Str_a25=ob.tostring ();

Loop through the row record and add a list detail
for (int i=0;i<retlist.size (); i++) {
Record map = (record) retlist.get (i);
Object ob = Map.get ("A25");//first turn data into
Str_a25=ob.tostring ();
String ls_sql2= "Select A27,a28,sum (A13) A13 from GKKC where a13>0 and a25=" +str_a25+ "Group by A27,a28";
list<record> retlist2 = Db.find (LS_SQL2);
Add a list detail
Map.set ("Listmx", retlist2);
}

-------return-------
return string
SetAttr ("Retlist", "OK");

Return to list and return to page
SetAttr ("Retlist", retlist);
Render ("/wxbb/r1.jsp");

Return JSON format
Renderjson ();

-------Page Receive--------
jfinal Example
<ul class= "Mui-table-view mui-table-view-striped mui-table-view-condensed" >
<li class= "Mui-table-view-cell" >
<c:choose>
<c:when test= "${retlist== null | | fn:length (retlist) = = 0}" >
Countless data
</c:when>
<c:otherwise>
<c:foreach items= "${retlist}" var= "Retlist" >
<div class= "Mui-table" >
<div class= "Mui-table-cell mui-col-xs-10" >

<p class= "Mui-h6 mui-ellipsis" > Quantity:${retlist.a5}&nbsp;&nbsp;
Price: <fmt:formatnumber type= "number" value= "${retlist.a6}" pattern= "0.00" maxfractiondigits= "2"/>&nbsp; &nbsp;
Amount: <fmt:formatnumber type= "number" value= "${retlist.a7}" pattern= "0.00" maxfractiondigits= "2"/>
</p>
<p class= "Mui-h6 mui-ellipsis" > Lot number:${retlist.a27}&nbsp;&nbsp; validity period:${retlist.a28}</p>
<p class= "Mui-h6 mui-ellipsis" > Customer name:${retlist.kh_name}</p>
</div>
<div class= "Mui-table-cell mui-col-xs-2 mui-text-right" >
<span class= "Mui-h5" ></span>
</div>
</div>
</c:forEach>
</c:otherwise>
</c:choose>
</li>
</ul>
<div style= ' Text-align:center ' >
<br/> No data
</div>


Ajax Receive Example
$.ajax ({
URL:LS_FNSTR,--Address format ls_apppath+ method + '? ' + Parameters
Type: ' Post ',
Success:function (data)
{
document.getElementById (' data3 '). Innerhtml=data.retlist;
}
});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.