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
}