Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / February 2005

Tip: Looking for answers? Try searching our database.

Why won't <BR> stick in out statement ?

Thread view: 
Andrew Rich - 18 Feb 2005 11:39 GMT
My java keeps saying that the <BR> is unterminated

Why ?

It is just a string

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<jsp:directive.page import="java.sql.*" />
<HTML>
   <HEAD>
       <TITLE>JDBC scriptlet example</TITLE>
   </HEAD>
   <BODY>
       <jsp:scriptlet>
           Class.forName("com.mysql.jdbc.Driver");
           Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/smtrack", "", "");
           Statement statement = connection.createStatement();
           ResultSet rs = statement.executeQuery("select region from
sm04022005");
           int numCols = rs.getMetaData().getColumnCount ();
           while (rs.next())
           {
           out.print(" Region=" + rs.getString("region") + "<br>");
           }
           statement.close();
           connection.close();
       </jsp:scriptlet>
       <jsp:expression>numCols</jsp:expression>
   </BODY>
</HTML>
Andrew Rich - 18 Feb 2005 12:01 GMT
while (rs.next())
           {
           <![CDATA[
           out.print(" Region=" + rs.getString("region") + "<br>");
           ]]>
           }

fixed it

My java keeps saying that the <BR> is unterminated

Why ?

It is just a string

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<jsp:directive.page import="java.sql.*" />
<HTML>
   <HEAD>
       <TITLE>JDBC scriptlet example</TITLE>
   </HEAD>
   <BODY>
       <jsp:scriptlet>
           Class.forName("com.mysql.jdbc.Driver");
           Connection connection =
DriverManager.getConnection("jdbc:mysql://localhost:3306/smtrack", "", "");
           Statement statement = connection.createStatement();
           ResultSet rs = statement.executeQuery("select region from
sm04022005");
           int numCols = rs.getMetaData().getColumnCount ();
           while (rs.next())
           {
           out.print(" Region=" + rs.getString("region") + "<br>");
           }
           statement.close();
           connection.close();
       </jsp:scriptlet>
       <jsp:expression>numCols</jsp:expression>
   </BODY>
</HTML>


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.