• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help.... Servlet Chaining

 
Aru Ven
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am a new learner. Please help.
I have a servlet which has to call another servlet either when a button is clicked or when clicked on a link.
I have a input item, whose value is to be passed to the servlet being called. Here is my code

What exactly happening is
when ckicked on the url the second servlet is started but the parameter when displayed in all cases shows only "val".
But when is button is clicked.
?varname=whatever value i have entered for the name
gets appended to the current URL but the second servlet is not displayed.
I have coded both servlets as doGet.
Please Help
Thx in advance.
Aruna
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think your HTML form is very strange. Typically a HTML form starts with a tag something like <FORM METHOD='POST' ACTION='/servlets/whatever'>, then has a series of <INPUT> tags, then finally a </FORM> tag at th ened to finish it.
You seem to have some input elements outside the form, and a form start with no end. Does this work at all?
 
Aru Ven
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank,
I have just given the lines which I think I'm wrong.
sorry it was a mistake due to cut & paste.

And my prog has all the reqd tags.
Aruna
[This message has been edited by Aru Ven (edited December 01, 2000).]
 
Aru Ven
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CAN ANYONE HELP ME.......???
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your problem may be that you say that I have coded both servlets as doGet, but your form is submitting a POST request. Try changing the form method to GET and see if it works.
 
Rayudu addagarla
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i think for sevlet chaining you need to administer the
javawebserver admin.bat in bin directory. in that servlet
alias will be there.u have to give the same name for both servlets in the alias field and "servlet1,servlet2" in the
next field. then if you invoke the first one it will redirect to other.
if that is not what you want i am sorry....
rayudu
 
Monty Ireland
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a quick question...
How do you code servlet1 to call servlet2 directly...?
Monty
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I understand it, servlet chaining is not really part of the official Servlet API, but was an early kludge. You are supposed to use a RequestDispatcher object to accomplish things like having one servlet call another.
That said - the original poster's problem just looks like a matter of getting the HTML form right.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic