Example of IFRAME usage in JSP pages __jsp

Source: Internet
Author: User
Tags stmt

Example of an IFRAME usage in a JSP page:

First, add the following code where you want to include another page in the JSP page:

<tr widht= "100%" bgcolor= "#426199" class= "text-01" >
<TD bgcolor= "#FBFBEE" width= "100%" >
<iframe id= "showfrm" name= "showfrm" src= "width=" 100% "height=" "Border=0 Frameborder=auto scrolling= "Auto" ></iframe>
</td>
</tr>

Then add the function in JavaScript, such as:

function Shezhi (Detail_code,detail_name,detail_fenzhi) {
Showfrm.location.href = "<%=contextpath%>/servlet/khpjdetailsetservlet?flag=showfpl&detail_code=" + Detail_code+ "&detail_name=" +detail_name+ "&detail_fenzhi=" +detail_fenzhi;
}

Second, add the following code to the Khpjdetailsetservlet:

if (Flag.equals ("SHOWFPL"))
{
String Detail_code = Request.getparameter ("Detail_code");
String detail_name = Request.getparameter ("Detail_name");
String Detail_fenzhi = Request.getparameter ("Detail_fenzhi");
List List_shezhi = new ArrayList ();
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
String sql = "Select B.code_name,a.fz_type,a.zb_fz from T_c_m_zhzb_detail A left JOIN t_b_c_code_directory B on A.zb_code=b . Base_code WHERE a.zb_code= ' "+detail_code+" ";
try {
conn = Dbutil.getconnection ();
if (conn==null)
throw new SQLException ("Database busy, connection error, please reconnect!");
stmt = Conn.createstatement ();
Rs=stmt.executequery (SQL);
while (Rs.next ())
{
Detailshezhivo Dshezhi = new Detailshezhivo ();
Dshezhi.setdetail_name (rs.getstring (1));
Dshezhi.setfz_type (rs.getstring (2));
Dshezhi.setfz_shezhi (Rs.getstring (3));
List_shezhi.add (Dshezhi);
}

catch (SQLException e) {
TODO auto-generated Catch block
E.printstacktrace ();
}
Request.setattribute ("Detail_name", detail_name);
Request.setattribute ("Detail_fenzhi", Detail_fenzhi);
Request.setattribute ("List_shezhi", List_shezhi);
Dist= "/pptf/khpj/khpjdetailshezhi.jsp"; String Dist is a strings that control the page jump path
}


System.out.println ("--------1---------");
LIST_ZHZB = QUERY_ZHZB ();
System.out.println ("--------2---------");
Request.setattribute ("List_zhzb", LIST_ZHZB);
Request.setattribute ("Zhzb", ZHZB);
Request.setattribute ("List_detail", List_detail);
Forward (request, response, Dist); The way the jump is written in the company's internal package
}

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.