stathis30_2000
07-29-2006, 06:34 AM
Hi !!!
I am trying to create an xml file from jsp.
My code is :
<%@ page import="java.sql.*"%>
<mycontacts>
<%
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
String cs = "jdbc:mysql://localhost/laszlochat?user=user&password=password";
connection = DriverManager.getConnection(cs);
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT status,nickname,email FROM `clients_contacts` inner join clients on clients.id=clients_contacts.contact_id where clients_contacts.client_id=1");
while (rs.next()) {
%>
<contact status="<%=rs.getString("status")%>"
nickname="<%=rs.getString("nickname")%>"
email="<%=rs.getString("email")%>"
message="<%=rs.getString("message")%>"/>
<%
}
} catch (Exception e) {
System.out.println("Exception1:"+e);
e.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e) {
System.out.println("Exception2:"+e);
}
}
%>
</mycontacts>
An error occures with the description :
ERROR: data conversion error for http://localhost:8080/lps-3.2/my-apps/getContacts.jsp: Error on line 8: The value of attribute "message" associated with an element type "contact" must not contain the '<' character.
The strage thing is that the value of attribute message doesn't contain the '<' character ...
The jsp code works fine without the attribute "message"
Please help!
ST.
I am trying to create an xml file from jsp.
My code is :
<%@ page import="java.sql.*"%>
<mycontacts>
<%
Connection connection = null;
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
String cs = "jdbc:mysql://localhost/laszlochat?user=user&password=password";
connection = DriverManager.getConnection(cs);
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT status,nickname,email FROM `clients_contacts` inner join clients on clients.id=clients_contacts.contact_id where clients_contacts.client_id=1");
while (rs.next()) {
%>
<contact status="<%=rs.getString("status")%>"
nickname="<%=rs.getString("nickname")%>"
email="<%=rs.getString("email")%>"
message="<%=rs.getString("message")%>"/>
<%
}
} catch (Exception e) {
System.out.println("Exception1:"+e);
e.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e) {
System.out.println("Exception2:"+e);
}
}
%>
</mycontacts>
An error occures with the description :
ERROR: data conversion error for http://localhost:8080/lps-3.2/my-apps/getContacts.jsp: Error on line 8: The value of attribute "message" associated with an element type "contact" must not contain the '<' character.
The strage thing is that the value of attribute message doesn't contain the '<' character ...
The jsp code works fine without the attribute "message"
Please help!
ST.