• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Forwarding data to jsp from servlet

 
Nick Price
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a servlet which looks like so


So in the servlet, this section


performs a search through my bean, and stores it in a List called searchResult. I then forward this List to SearchEdit.jsp. Now in my SearchEdit, i am trying to display this list. So i have done


But nothing is displaying when i click search. What would i have to do to get it to display through my jsp? (Or through the servlet if better). Any advise would be of great help.
thanks
 
Vinoth Thirunavukarasu
Ranch Hand
Posts: 164
Android Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I used bellow example It works fine
Example

Regards,
Vinoth.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you sure that the problems lies in the JSP part? You posted too much code. There´s a lot what goes on here. Have you for instance debugged the servlet code? Did for example the DAO return a non-empty list? That kind of straifhtforward and logical stuff. Trackback the cause of problem step by step in the code.

Only when you can say that the 'searchResult' variable in the servlet actually contains data and the ${searchResult} variable in JSP didn´t output anything (have you checked the HTML source?) or if it did output the plain vanilla EL string "${searchResult}" to HTML, then there´s indeed a problem in JSP/EL.
 
Naga Niranjan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

<c:forEach var="item" begin="" items="${myWork.CompetitorInfo}">


You are using wrong list to iterate, which is not in request scope.
Use this
<c:forEach var="item" begin="" items="${requestScope.searchResult}">
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Omit the empty being attribute.
 
Vijitha Kumara
Bartender
Posts: 3914
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Omit the empty being attribute.


I think you mean begin ?
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naga Niranjan wrote:

<c:forEach var="item" begin="" items="${myWork.CompetitorInfo}">


You are using wrong list to iterate, which is not in request scope.
Use this
<c:forEach var="item" begin="" items="${requestScope.searchResult}">

The topicstarter doubleposted/crossposted similar topics countless times over all places and he finally mentioned at one of the topics at the Sun forum yesterday tonight that it all was solved. So please stop responding to this topic (or all other of his previous topics), you're wasting your time otherwise.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic