עבר עריכה לאחרונה בתאריך 26.12.11 בשעה 11:43:02 על-ידי Ice Cold (מנהל הפורום)
טוב אז ככה השאלה שלי היא כזאת באקליפס רשמתי דף כזה עכשיו רציתי לשאול למה כאשר המשתמש מכניס תנתונים זה לא מגיע לדאתא בייס ? האם אני צריך לרשום את הקריאה להייפרסונים בעמוד JSP אחר? אשמח לעזרה
[code]
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@page import="javax.sql.DataSource"%>
<%@page import="javax.naming.InitialContext"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1 " pageEncoding="ISO-8859-1"%>
http://www.w3.org/TR/html4/loose.dt?...>
Israel's Casino Hotel - Search By Room

" width="1100" height="150">
<%
Connection con = null;
try {
//connect the jboss services
InitialContext ic = new InitialContext();
//get the reference to the datasource
DataSource ds = (DataSource) ic.lookup("java:/DefaultDS");
//create a connection to the database in the ds
con = ds.getConnection();
//execute a statement
PreparedStatement pr = con
.prepareStatement("SELECT ROOM_NUMBER, ROOM_FLOOR, ROOM_TYPE FROM PUBLIC.ROOMS");
ResultSet rs = pr.executeQuery();
while (rs.next()) {
out.println("
ROOM_NUMBER:" + rs.getInt("ROOM_NUMBER")
+ " ROOM_FLOOR: " + rs.getString("ROOM_FLOOR") + " ROOM_TYPE: "
+ rs.getString("ROOM_TYPE"));
}
rs.close();
pr.close();
}
catch (Exception e) {
out.println("Error:" + e);
e.printStackTrace();
}
finally {
//release the connection
if (con != null) {
con.close();
}
}
%>
" border ="0" width="50" height="30">
&l;code/&r;
[/code]