Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Generating table with servlet

 
Mark Leong
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using servlet to generate a table:-
out.println("<form>");
out.println("<table width=200>");
do something here......
out.println("</table>");
out.println("</form>");
Somehow the width=200 does not seem to work.
When I use pure html, it works perfectly.
Anybody has the same experience?
 
Graham Thorpe
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes sure we can create table using servlets also same as html.
 
Mark Leong
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I am trying to say is that the width attribute of the tables does not seem to work when the table is generated by servlet.
I have a very long text insert the table cell. I find that if I create the table by writing the html page manually, the table maintained its width of 200 and the text got wrapped round.
However if the table is generated through a servlet, the text flow out of the screen to the right.
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
have you tried?
out.println("<table width=\"200\">");

hope it helps... and let me know if you sort it out
 
Mark Leong
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
That was actually what I first tried.
 
WiLL Tao
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Mark Leong:
I am using servlet to generate a table:-
out.println("<form>");
out.println("<table width=200>");
do something here......
out.println("</table>");
out.println("</form>");
Somehow the width=200 does not seem to work.
When I use pure html, it works perfectly.
Anybody has the same experience?

out.println("table width='200'");
-----------------
hope it works
 
Mark Leong
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the help. I found the problem.
I've placed a <pre></pre> tag within the cell. Removed it and all is OK.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic