Ajax obtains the name through the ID and the class to obtain the data JSP

Source: Internet
Author: User

<% @ Page contenttype = "text/html; charset = gb2312" %>

<% @ Page import = "Java. util. List" %>
<% @ Page import = "Java. util. Map" %>
<% @ Page import = "com. YC. ycportal. blockimp. Service. commonservice" %>

<%

Response. setcontenttype ("text/XML ");

String userid = request. getparameter ("userid ");
// Create the response XML
If (userid! = NULL &&! "". Equals (userid. Trim ())){
List gylist = commonservice. getinstance (). getdynamictable ("select * From dic_counter where counter_id = '" + userid + "'");

If (gylist! = NULL & gylist. Size () = 1 ){
Map gymap = (MAP) gylist. Get (0 );
String gyname = (string) gymap. Get ("counter_name"); // clerk name
String organid = (string) gymap. Get ("organ_id"); // the clerk's row number

List organlist = commonservice. getinstance (). getdynamictable ("select * From dic_organ where organ_id = '31" + organid + "'");
If (organlist! = NULL & organlist. Size () = 1 ){
Map organmap = (MAP) organlist. Get (0 );
String organname = (string) organmap. Get ("organ_name"); // obtain the row name of the clerk

// XML to be returned by the Organization

Stringbuffer xml = new stringbuffer ("<? XML version =/"1.0/" encoding =/"gb2312/"?> <Result> <queryresult> success </queryresult> <Name> "). append (gyname ). append ("</Name> <bank_id> "). append (organid ). append ("</bank_id> <bank_name> "). append (organname ). append ("</bank_name> </result> ");

// Send the response back to the browser
Response. getwriter (). Write (XML. tostring ());
} Else {
Response. getwriter (). Write ("<result> <queryresult> failed </queryresult> </result> ");
}
} Else {
Response. getwriter (). Write ("<result> <queryresult> failed </queryresult> </result> ");
}
} Else {
Response. getwriter (). Write ("<result> <queryresult> failed </queryresult> </result> ");
}

%>

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.