Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Printing values in JSP page one by one

 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request.sendRedirect("welcome.jsp"?list="+list);
In the variable list I get list of names from database. My problem is while I redirect the same to jsp page(welcome.jsp), the names are printed in the same line
Ex: sandeep sharmi geetha
I don't know how to print it in new lines
sandeep
sharmi
geetha
Please help me to find out a solution for this
 
dileep keely
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the <br> tag say,something like the below should solve.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65545
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why are you redirecting from the controller to the JSP? And why pass data on the URL?

It's much more conventional to transfer control from the controller to the JSP with a forward. In that case, you can pass the list as a scoped variable rather than serializing it to a string for use on the URL.

In the JSP page, it's then a simple matter to iterate over the list with the JSTL <c:forEach> tag to produce the appropriate HTML markup.

See this article for information on properly structuring web applications.
 
sahana mithra
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,
Can you please help me with the problem I am facing with JSTL. I am using eclipse. I am not getting any output after adding the uri,web.xml,jstl.jar and standard.jar. Please help me how should I add jstl support? In web.xml What should give under <taglib>
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65545
110
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See the JSP FAQ for information on setting up for the JSTL. Nothing goes in the web.xml.
 
Can't .... do .... plaid .... So I did this tiny ad instead:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!