This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SpringMVC Model Object in JSP

 
Ansar Shah
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

I am building a dynamic page, that gets its html contents from the model object passed to jsp using ModelAndView type. The html content is passed to jsp but the html code gets displayed as it is on the page. Like if i pass "<table><tr><td>Hello!</td></tr></table", this string would display on the page but no actual table. I am using following code in the jsp page.

<c:forEach items="${model.criCellList}" var="cell"><c ut value="${cell.cellContents}" />
</c:forEach>

Can any one help?
 
Ansar Shah
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have just seen that the compiled jsp page source is showing
" < " in place of " < " in my dynamically generated html.

I dont know why this is happening.. Please help..
 
Ansar Shah
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well ! its even working in the ranch page then why dont on my page. . I meant to say .
 
sruthi das
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try like this for example
this is in my controller.
return new ModelAndView("View_printer_detail.jsp", "Model", persons);
and in my jsp
<c:forEach var="log1" items="${Model}">
<tr><td> <c ut value="${log1.printerid}" /> </td><td> <c ut value="${log1.ipaddress}" /> </td><td><c ut value="${log1.storeid}"/></td><td><c ut value="${log1.default1}"/></td></tr>
</c:forEach>
 
Ansar Shah
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response.
Infact I want even the columns and rows to be dynamic. Why the contents from the model object dont get compiled to a html page? Is there a way out?

Thanks.
 
sruthi das
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
did you import this taglibrary
 
Ansar Shah
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I did, no problem with this tag library as the html content is getting to the page at least.
Even when I copy the html code displayed on the page, and then paste it direct on the jsp page, then it works perfectly fine. But some how when it comes through server side, then it displays it as a text.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic