Spring client JSP and server-side interaction method

Source: Internet
Author: User

Client-side reference to server

var url= "<m:url value= '/countsendlog/toshow.do '/>?unitid=" + Unitid + "&begintime=" + $ ("#begintime"). Val () + "&endtime=" + $ ("#endtime"). Val ();

Parent.addtab (' detail interface ', url, ' ', true, ');

1 , service-pass parameters to the client

@RequestMapping ("/toshow")

Public Modelandview toshow (string Unitid, String begintime,
String endtime) {

Modelandview m = new Modelandview ("Jsp/yun/yun"); Default omitted. jsp

Define HASHMAP Key-value pairs

map<string,string> map = new hashmap<string,string> ();

Map.put ("Unitid", Unitid);

Map.put ("BeginTime", begintime);

Map.put ("Endtime", Endtime);

M.addobject ("map", map);

return m;

}

2 , client hidden domain receive:

${map.unitid} form, direct receive using service-side parameters

<input type= "text" name= "Unitid" id= "Unitid" Value=${map.unitid}/>

<input type= "text" name= "BeginTime" id= "BeginTime" Value=${map.begintime}/>

<input type= "text" name= "Endtime" id= "Endtime" value=${map.endtime} />

3 , the client jquery method is passed to the server:

Serialization of

Serializegriddata:function (postdata) {//Add query condition value

var obj = {};

obj["Unitid"] = $ ("#unitId"). Val ();

obj["BeginTime"] = $ ("#begintime"). Val ();

obj["Endtime"] = $ ("#endtime"). Val ();

$. Extend (True,obj,postdata);

return obj;

}

4 , the service side receives:

Client pass-through, automatically mapped to the corresponding field of the entity class:

public void Getsendcountdetails (countsendlog countsendlog, httpservletrequest request,

HttpServletResponse Response, page page) {

Countsendlog entity class receive, field corresponding parameter name Unitid,begintime,endtime

String Unitid = Countsendlog.getunitid ();//Acquired

Finish

Spring client JSP and server-side interaction method

Related Article

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.