When selecting a unit, the system dynamically associates the personnel information (menu interaction display information) and personnel Interaction

Source: Internet
Author: User

When selecting a unit, the system dynamically associates the personnel information (menu interaction display information) and personnel Interaction

Use the onchange attribute on the jsp page to call the following method:

Write in script:

FunctionFromid (){

VarFrom_id = $ ("# from_id"). val ();

VarAddurl = "& from_id =" + from_id;

$. Ajax ({

Url: <select: link page = "/YYrequireplan. do? Method = fromid "/> + addurl,

Type: "get ",

DataType: "json ",

Success:Function(Html ){

Document. getElementById ("link_man"). value = html [0]. linkman;

Document. getElementById ("link_tel"). value = html [0]. tel;

Document. getElementById ("fax"). value = html [0]. fax;

}

});

}

// Backend call Method

Public VoidFromid (ActionMapping mapping, ActionForm form,

HttpServletRequest request, HttpServletResponse response)ThrowsException {

String from_id = request. getParameter ("from_id ");

SqlRuturn ret;

List list =Null;

Try{

Ret = Executer.GetInstance(). ExecSeletSQL ("select trim (linkman) as linkman, trim (tel) as tel, trim (fax1) as fax from LO_SUPPLIERFACTORY where factoryid =" + from_id );

List = ret. getResultSet ();

}Catch(DbException e ){

E. printStackTrace ();

}

JSONArray jsonarray = JSONArray.FromObject(List );

PrintWriter out = response. getWriter ();

Out. print (jsonarray. toString ());

Out. close ();

}

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.