This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP processing attribute in request object

 
Jay White
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, I'm working on a web app a class that i'm taking and I've ran into a little trouble. The app is a mock up of a college registration for students. I have my login screen working and now I'm working on my registration page. When they click on the registration link in the menu, they are taken to a jsp where they are to select a subject from a combobox and submit which retrieve all the classes open for that subject. What I planned on doing was use the same jsp. They selected the subject and after processing with a servlet I wanted to send them back to the same jsp but display the classes under the comboxbox. I've written all the code for the server side processing but when it sends it back to the jsp, I'm unable to retrieve the classes with jstl.

I'm using netbeans and I'm really not familar with it. Usually what I'd do in a java app would be to insert System.out.println statements to see where the program is going wrong, but these statements don't show up in the debugger output in netbeans. I have each class stored in a ClassItem class I created and then use and arraylist to hold these ClassItems objects. What I wanted to do was to output the values to the output window to check if the values are being added correctly before I add the attribute to the request and send it back to the jsp. How do I go about doing that , or is there a better way of accomplishing this. Again I'm new so I'm not 100% sure of proper debugging tactics.


I did step through the app with the debugger and it seems that they are being added properly but I'm unsure if they are getting sent back to the jsp. In the jsp I used jstl to loop through the object and each class into a table but when debuggin it gets to the forEach loop and doesn't execute the code inside.

I'm going provide the code i'm working on, hoping someone can explain where I'm going wrong.


thanks
jay

JSP



SERVLET




DAO

 
Jay White
Greenhorn
Posts: 2
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well of course a couple hours after I wrote this I happen to figure it out. I had a loop in my addClass() method to see if the class was already in the arrayList, turns out I coded it wrong and was not add any classes to the list causing nothing to be returned to the jsp.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for posting back with your findings!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic