This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes servlet tag in JSPs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet tag in JSPs" Watch "servlet tag in JSPs" New topic

servlet tag in JSPs

Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Does anybody know how the <servlet> tag works?
If I write a servlet, then put the name of it in the servlet tag (SERVLET NAME="myservlet" CODE="myservlet.class" CODEBASE="url">
will the servlet run automatically and replace the servlet tag with the values returned by the servlet?
Raukutam Sandeep
Ranch Hand

Joined: Nov 15, 2000
Posts: 61

If u include the servlet tag in a html file and u must save that file with a extension .shtml
The servlet tag refreshes automatically(if it contains data) after submitting the data from the html form.
But at times it may not, and for that u have to clear u'r cache memory.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13027
In JSP pages you can include the output of servlets with the
<jsp:include> tag
The only <servlet> tag I know of in the current APIs is used in the web.xml file to define a servlet to the "container."
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Here's the link to the little bit of information I found. Seems to me like I should be able to put this code in, and then it will replace it with the output of the servlet.
If you scroll down, there's a section called
"Specifying a servlet within the <servlet> tag."
I dont' know if the <jsp:include> would do the same thing.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
The answer to your question is "yes" as long as the page ends with .shtml extension and support is turned on in the web server.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Annette L'Heureux
Ranch Hand

Joined: Dec 07, 2000
Posts: 135
Thanks Thomas! I'll have to go check that out.
jQuery in Action, 3rd edition
subject: servlet tag in JSPs
It's not a secret anymore!