Calling Java Servlets in JSP

S

Stefan

In Short: How can I include or call a Java Servlet in a JSP?

In Long:

Hi,

We got a little "application" - it consists of a few jsp pages that
create a little news box with scrolling down Text - you can click on it
and read the full content if you want, from there you can select wether you
want to go back or
if you want to see archived news as well.
As this is used in several other jsp pages, to easily include it,
we decided to use Servlets instead of JSP's for that little news window.
Now I got my Servlets, but how can I include them in my JSP Page???

Thanks,

Stefan
 
J

Java Architect

It's not in the JSP's, really. It's the links within the rendered HTML that
must point at the Servlets. Not sure how you're doing things, but you may
need to use some javascript here.
 
C

Chris Smith

Stefan said:
In Short: How can I include or call a Java Servlet in a JSP?

Use the jsp:include standard action.

--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
J

jAnO!

Java Architect said:
It's not in the JSP's, really. It's the links within the rendered HTML that
must point at the Servlets. Not sure how you're doing things, but you may
need to use some javascript here.

wether
a JSP is a servlet.....
 
T

Tor Iver Wilhelmsen

Stefan said:
In Short: How can I include or call a Java Servlet in a JSP?

A JSP is an "inverted" JSP with conveniences like custom tags. So you
use the same mechanism as in a servlet - calling via RequestDispatcher
- but there is a JSP tag to do that, called <jsp:include>.

Note: This has the usual limitation of working inside one web app. If
your servlet is in another webapp on the same server, you need a
"scriptlet" that ask for that webapp's context and get a
RequestDispatcher from that. If you do that ofter, try writing a
custom tag for it. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top