Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

reading results from javabean into JSP

 
aliya sharma
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I'm new to JSP. I have already posted a question in servlet forum but have figured out that problem and my servlet is working fine. I have a bean that store the query results and then send them to a controller servlet which in turns forwards the result to JSP to read and display it. My bean and servlet is working fine(i tested them both with some System.out statement). Below is a part of my servlet code(its passing part_no parameter to the bean:

I'm accessing this through result.jsp by:

but when i try to access this page..it doesn't show me any result.just the static "hello" that i added. I'm realy confused now. COuld anyone please guide me in right direction or tell me whats wrong with my code. I would really appreciate your help.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by aliya sharma:



you should do something like,

<jsp:getProperty name="result" property="part"/>
<jsp:getProperty name="result" property="content"/>

try this. hope this will solve your problem.
 
aliya sharma
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Adeel,
I changed my code as you mentioned but i'm still only getting static parts of result.java. here's my JSP code.



heres my javabean

Any other suggestions??.I would really appreciate your help with this.
 
aliya sharma
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I finally got it working!!!. I changed the scope to session and got the desired results. Could anyone please tell me why it wasn't working when i had set the scope to "request". like this:
 
aliya sharma
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any takers???..
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cant see any obvious reason for it from looking at your code.
Try to look at the generated Java file for the JSP, that might help you find the reason for it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic