Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSTL-Table issue  RSS feed

 
sihani rani
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am passing the table data from servlet by adding request attribute..but while printing through EL,it is not printing the table..please find the below

Servelet
=========

request.setAttribute("tableDatas","<table><tr><td>JAVA RANCH</td></tr></table>");


IN jsp
======

<c:out value="${tableDatas}"/> ----> it is printing "<table><tr><td>JAVA RANCH</td></tr></table>".............i need that it ll print table..kindly help on this.




 
Mansukhdeep Thind
Ranch Hand
Posts: 1163
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sihani rani wrote:i am passing the table data from servlet by adding request attribute..but while printing through EL,it is not printing the table..please find the below

Servelet
=========

request.setAttribute("tableDatas","<table><tr><td>JAVA RANCH</td></tr></table>");


What are you trying to set here? The way you set an attribute is first you retrieve the attribute from the request object and then set it. Something like:



Why are you writing HTML instead of the value?

sihani wrote: IN jsp
======

<c:out value="${tableDatas}"/> ----> it is printing "<table><tr><td>JAVA RANCH</td></tr></table>".............i need that it ll print table..kindly help on this.


Of course it will print that as that is the string value that your tableDatas named variable is holding.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up the documentation for the <c:out> tag. Perhaps there's something there that would help you. Hint: there is.

Also, why are you building up HTML in the servlet? You should be sending the table data to the JSP, where JSTL and EL are used to build the HTML.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!