This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Servlets and the fly likes JSP -> servlet -> JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "JSP -> servlet -> JSP " Watch "JSP -> servlet -> JSP " New topic
Author

JSP -> servlet -> JSP

sabah ammar
Greenhorn

Joined: Jan 10, 2005
Posts: 23
Hi, I am working on learning JSP/Servlet. I need to know that how may i retrieve some data from servlet into JSP? as my servlet already is retrieving data from jsp.thank you.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

What do you mean by:
as my servlet already is retrieving data from jsp.
?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
sabah ammar
Greenhorn

Joined: Jan 10, 2005
Posts: 23
ok.. from an html page i am submitting form action to servlet. where I am retreiving data thru sql. now I want to display the selected data in another JSP. I just need to know how to link servlet to a new JSP. hope i cleared my question.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Does this describe what you're trying to do?

I assumed we wanted to get some data from the server, and elaborated a bit with the call to get data from the model. It's common for the servlet to get something from the database (for example) and put the data on the request, then forward to the JSP which gets that data and merges it into the response HTML.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Wow, you answered my question while I was typing! Now the bad news: I do this so rarely I don't have the answer to your question memorized. I'll be back in a few minutes after I dig up an example.

Ok, I'm back. Look at:

[ June 12, 2005: Message edited by: Stan James ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You did.

You'll want to read up on the RequestDispatcher interface.

You'll also want to learn how to bind your objects to the various 'scoped' objects that are available to JSP pages.
Section 13.4 in this chapter is helpful in this regard:
http://csajsp-chapters.corewebprogramming.com/CSAJSP-Chapter13.pdf

If you would like to see all of this being done in a very simple example, look at SimpleMVC from http://simple.souther.us
[ June 12, 2005: Message edited by: Ben Souther ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Doesn't anybody have anything better to do on Sunday night besides type faster than me?

Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Stan James:
Doesn't anybody have anything better to do on Sunday night besides type faster than me?



If I tried to type that ascii art UML sequence diagram I'd still be working on it and wouldn't look half as nice.
sabah ammar
Greenhorn

Joined: Jan 10, 2005
Posts: 23
good good... both of you keep it up :roll: I got my answer. thanks.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have a tool to make those diagrams, but last night I guess I forgot part of it was case sensitive. I sat for a few minutes scratching my head.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP -> servlet -> JSP