aspose file tools*
The moose likes JSP and the fly likes Forwarding data to jsp from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Forwarding data to jsp from servlet" Watch "Forwarding data to jsp from servlet" New topic
Author

Forwarding data to jsp from servlet

Nick Price
Greenhorn

Joined: Jan 03, 2009
Posts: 25
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

Joined: Dec 18, 2008
Posts: 164

Hi,

I used bellow example It works fine
Example

Regards,
Vinoth.


Java Best Practices
Linux Best Practices
Amortization Calculator

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
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

Joined: Aug 02, 2005
Posts: 25

<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

Joined: Jan 10, 2002
Posts: 61661
    
  67

Omit the empty being attribute.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3855

Bear Bibeault wrote:Omit the empty being attribute.


I think you mean begin ?


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Forwarding data to jsp from servlet