-KINGMAN- 26.12.1111:43

צריך עזרה ב- JBOSS ובאקליפס גלילאו ו-hypersonic SQL

עבר עריכה לאחרונה בתאריך 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();
}
}
%>


Back To Home Page" border ="0" width="50" height="30">



Search By Room:




Please Enter Record To Search















Room Number:
Room Floor:
Room Type:





TYPE=RESET
onClick="return confirm('Are you sure you want to reset the form?')"
>



&l;code/&r;
[/code]










































dvir8 27.12.1108:37
1. לגבי השמות של השדות? שמת שם רווחים? בתגובה להודעה מספר 0
-KINGMAN- 27.12.1120:02
2. כן אחי בתגובה להודעה מספר 0
sharkk 05.01.1216:54
3. לא הבנתי בדיוק את השאלה... בתגובה להודעה מספר 0
אתה מפנה את הטופס ל- search.jsp... ואיפה הדף הזה...?

אתה צריך לקבל את ה- input ב- get או ב- post אתה תחליט, ואז לפתוח connection עם ה- DB או עם שכבה אחרת שתבצע קריאה ל- DB שיבצע לך את עבודת השמת הנתונים במסד נתונים.

בעיקרון השיטה שאתה מבצע פה לוקה בחסר אבל זה החלטה שלך.
העבר לפורום אחר
העבר לפורום:
סיבה:
תגובה חדשה
כותרת:
תוכן:
סמיילים:
הצג
עריכת אשכול
כותרת:
תוכן:
סמיילים:
הצג