This content has been marked as final. Show 5 replies
Like any decent JSP book or tutorial will tell you, you should be doing that kind of stuff in a servlet. You'd fetch the data, stick it in an array or list (note that JPA makes that process so much easier) and pass it to request.setAttribute() (which puts the data in the view scope). When all business logic has been performed you forward control to a JSP which will render the view based on the data prepared in the servlet.
Actually I didn't get an answer to my question. I understand that I am doing it "wrong" there is a reason for that.
Is it not possible to do what I am proposing is the answer I am looking for...
You seem to think that iterating through that "rs" thing somehow uses it up, so that you can't iterate through it again. That isn't the case. You can iterate through it as often as you like, as long as it's still accessible.
If your question involved using it in several different requests, then the way to deal with that is to make your "rs" be a session attribute. However you didn't say that. In fact you didn't say much of anything, you just demanded that your unstated reason for doing it wrong should be treated as if it were a good reason. I'm not inclined to look for ugly workarounds when fixing the original error would be a better strategy, so I'm not going to play along with that. If you had a good reason for bad programming then let's hear it. For all we know (remember we know very little) you may just be misunderstanding things.
Sorry I didn't mean to demand anything if that is how you took it.
I was simply trying to build a rapid prototype for demonstration
purposes. It doesn't need to be perfect just quick. I figured it out
myself. And it works and works fine. It is not meant to be production
code by any means. So maybe it is "wrong" and those who answered
were not willing to help and rather bash me for wanting to do something
"wrong". Thanks for all of your help!