英文:
.jsp if else with <%@include file = .html> interaction
问题
- 更新后尝试的代码_02
<%@page contentType="text/html;charset=UTF-8" %>
<%@include file="/include/gds_include.jsp" %>
<jsp:useBean class="com.gds.DBconnect" id="dbHelper" scope="page" />
<%@include file="01_product_categories_detail.html"%>
<%
String id = request.getParameter("pid");
try {
dbHelper.setConnection(77);
dbHelper.setStatementIndex(0);
dbHelper.setPreparedStatement("select * from webpage where p_id = '"+id+"'");
dbHelper.exePreparedStatement();
resultSet = dbHelper.getSqlResultArray();
if(resultSet != null) {
for(int i=0; i<resultSet.length; i++) {
out.print("<tr><td>" );
out.print("<h1>" + resultSet[i][2] + "</h1>");
out.print(resultSet[i][6]);
}
}
}
catch(Exception ex) {
out.print("錯誤訊息:" + ex);
}
finally {
dbHelper.doFinalize();
}
%>
<%
String id = request.getParameter("pid");
if(!id.equals("en_1-01")) {
%>
<%@include file="02_product_categories_detail.html"%>
<%
} else if (id.equals("en_1-02")) {
%>
<%@include file="microchip_product_categories_detail.html"%>
<%
}
%>
评论