×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

jsp table

jsp table

jsp table

(OP)
With the below code I am getting the output as below.I am getting data from database as shown in the code

Displaying All Users

FirstName LastName UserName Password
Ann go ago VVVV
ffff ffff ffff ffffff
sag rag tom kim
gen man rfff kkk
fff jjj hhh hhh


...so on.

But I have to display as shown below. Is it possible or Not. if it possible, How would show that, Please let me know ASAP

FirstName aaaa aaaa anna ggg henn ffff hhh jjj kkk llll oooo pppp mmmm jjjjj kkkkkkk llllllll gggg qqqqq
LastName ssss ffff ggg hhh nnn kkk lll bbb vvvv ssss aaaa qqqq wwww xxxx ssss aaaa zzzz bbbb nnnnn
UserName ....so on
Password


<%@ page session ="false"%>
<%@ page import ="java.sql.*"%>
<%
 
 try{
     Class.forName(("sun.jdbc.odbc.JdbcOdbcDriver");
      System.out.println("JDBC driver loaded");
}catch(ClassNotFoundException e){
   System.out.println(e.toString());
}
%>
<HTML>
<HEAD>
<TITLE> Display ALL Users<TITLE>
</HEAD>
<Body>
<BR><H2>Displaying ALL Users</H2>
<BR>
<BR>
<TABLE>
<TR>
<TH> First Name </TH>
<TH> Last Name </TH>
<TH> User Name </TH>
<TH> Password</TH>
</TR>
<%
String sql = "select  firstname, lastname, username, password" +"from Users";
try{
Connection con = DriverManager.getConnection("jdbc:odbc:JavaWeb");
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(sql);
while(rs.next()) {
%>
<tr>
<td><% out.print(rs.getString(1); %></TD>
<td><% out.print(rs.getString(2); %></TD>
<td><% out.print(rs.getString(3);%></TD>
<td> <% out.priint(rs.getString(4));%></TF>
</tr>
<%
}
rs.close();
s.close();
con.close();
}
cath(SqlException e) {
}
catch(Exception e) {
}
%>
</Table>
</center>
</body>
</html>


Thanks a lot.

RE: jsp table

if you don't mind tables inside of tables inside of tables....

CODE

<td>
<table><tr><td>
<% out.print(rs.getString(1); %></TD></tr><tr>
<td><% out.print(rs.getString(2); %></TD></tr><tr>
<td><% out.print(rs.getString(3);%></TD></tr><tr>
<td> <% out.priint(rs.getString(4));%></td></tr></table></td>

RE: jsp table

(OP)
Thanks for your reply.

What changes do I have to make for the below code? If the ouput should be like below.

FirstName aaaa aaaa anna ggg henn ffff hhh jjj kkk llll oooo pppp mmmm jjjjj kkkkkkk llllllll gggg qqqqq
LastName ssss ffff ggg hhh nnn kkk lll bbb vvvv ssss aaaa qqqq wwww xxxx ssss aaaa zzzz bbbb nnnnn
UserName ....so on
Password

Here is my code, I don't understand here where exactly I can make changes what you said before for the below format. Can you please help me

*if* (rs.getRow() > 0)
{
 
sResult = sResult.concat( "<tr BGCOLOR=#99CCFF>"); sResult = sResult.concat( "<td valign= bottom><font size="2">" + "HITS" + "</font></td>" );
sResult = sResult.concat( "<tr> <td valign=bottom> <font size="2">" + "REISSUED" + "</font></td></tr>" );
sResult = sResult.concat( "<tr> <td valign= bottom> <font size="2">" + "ADD_COLL" + "</font></td></tr>" );
sResult = sResult.concat( "<tr> <td valign= bottom> <font size="2">" + "CHANGE_FEE" + "</font></td></tr>" );
sResult = sResult.concat( "<tr> <td valign= bottom> <font size="2">" + "AMT_PROCESSED" + "</font></td></tr>" );
sResult = sResult.concat( "<tr> <td valign= bottom><font size="2">" + "Est_AMT" + "</font></td></tr></tr>" );
 
*do*
{
sAmount1 = dfAmount1.format(rs.getInt(1));
sAmount2 = dfAmount1.format(rs.getInt(2));
sAmount3 = dfAmount2.format(rs.getDouble(3));
sAmount4 = dfAmount2.format(rs.getDouble(4));
sAmount5 = dfAmount2.format(rs.getDouble(5));
sAmount6 = dfAmount2.format(rs.getDouble(6));
 
 
sResult = sResult.concat("<td align= right>" + sAmount1 + "</td>");
sResult = sResult.concat("<td align=right>" + sAmount2 + "</td></tr>");
sResult = sResult.concat("<td align=right>" + sAmount3 + "</td></tr>");
sResult = sResult.concat("<td align=right>" + sAmount4 + "</td></tr>");
sResult = sResult.concat("<td align=right>" + sAmount5 + "</td></tr>");
sResult = sResult.concat("<td align=right>" + sAmount6 + "</td></tr>");
}*while*(rs.next());
 
 
 
sResultTable = "<table>"
                                 + sResultTable
                                 +"<p><b><font color="#3366FF"  size="4">"
                                 + s[iC]
                                 + " " + "</font>"
                                 + "<br>"
                                 +"</b>"
                                 +"<table width=90% border=1 cellpadding=0 cellspacing=0 height=60>"
   *+ sResult //* Here I am adding all the result
                                 + "</table>";
 
}

RE: jsp table

(OP)
Could you please anyone help me in resolving this? I am not able to get the format. What changes do I have to make to the above code to get the below format?

hits          4444 55 66 777 888 999 00 77
reissued    666 888 999 000 666 7777


Thanks a lot

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close