Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlet to JSP - Can't display the rows.  RSS feed

 
Jaco Smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to display rows from my database from servlet by passing it to a JSP, but nothing is displayed.
I checked the syntax and even the source of the page shows that it gets the data but the rows are not displayed!
My servlet (serv.jsp)


My JSP (SP.jsp)


searchResult.java:

My servlet file is in the Pack1 package under Source Packages and jsp file is under Web Pages.
Please help me debug my program, any help would be greatly appreciated!
Thank you!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66182
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you done a View Source at the browser to see what's being generated?

If so, is it valid HTML?
 
Jaco Smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Have you done a View Source at the browser to see what's being generated?

If so, is it valid HTML?


Yes, I've also check that, here is the view source code page:


After the I enter a word in the textbox and click "search", it retrieves the data correctly - because we can see the address of the searchResult objects right?
So, why is it not being displayed?..
 
hai nd
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume that you have jstl library. If not. You can download it from http://www.coderanch.com/how-to/java/JstlTagLibDefinitions. Choose your version(JSTL 1.2 I guess).
And JP.jsp don't have taglib
Add this line of code to beginning into JP.jsp
For version JSTL 1.1 or 1.2


With version JSTL 1.0


Then It's maybe gonna work
 
Jaco Smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai nd wrote:I assume that you have jstl library. If not. You can download it from http://www.coderanch.com/how-to/java/JstlTagLibDefinitions. Choose your version(JSTL 1.2 I guess).
And JP.jsp don't have taglib
Add this line of code to beginning into JP.jsp
For version JSTL 1.1 or 1.2


With version JSTL 1.0


Then It's maybe gonna work


Thank you for your reply!
I downloaded it and added it to my libraries, but now I am getting another error..


I have a class names searchResult.java in my Pack1 folder - it is just a class to create objects to make storing the data easier..
Should I add it as a Java servlet class? full code of searchResult is:

 
hai nd
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried create getter for searchResult class or make data field public.
If getter, then change ${m.URL} -> ${m.getUrl()}
 
Jaco Smith
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai nd wrote:Have you tried create getter for searchResult class or make data field public.
If getter, then change ${m.URL} -> ${m.getUrl()}


Made a few other modification along with that getter idea of yours and it works!
Thanks! ;)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!