• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing data to two servlets?

 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to pass same form data to different servlets at a time
Thanks
 
Georges Salameh
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not get what you are going but if you are for example filling a form with fields on multiple servlets you can simply use a java Bean to save the data and retrieve the bean wherever you want in your application.
 
Ashutosh Limaye
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't do it through form action; but could achieve it through javascript. see XMLHttpRequest
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to send the form data directly, not by using another controller(servlet) or setting a bean.because i have to edit my previous servlet(which we are using in the application).So please tell me how to invoke two servlets from one html/jsp.
 
Ashutosh Limaye
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Georges Salameh wrote:I did not get what you are going but if you are for example filling a form with fields on multiple servlets you can simply use a java Bean to save the data and retrieve the bean wherever you want in your application.

What if the form is on a .html file, how do you access your bean there to fill it with form data?
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if the form is on a .html file

I am just getting required fields in the servlet and using there only
 
Vijitha Kumara
Bartender
Posts: 3916
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mallikarjun dontamsetti wrote:because i have to edit my previous servlet(which we are using in the application).

What do you mean by editing the previous servlet?
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:
mallikarjun dontamsetti wrote:because i have to edit my previous servlet(which we are using in the application).

What do you mean by editing the previous servlet?

In my application we have to add some module. we are using a servlet to act as controller.We have to add some more fields to jsp(Form) and the controller for new module will be another servlet(As my lead said) it is working separate from main servlet. i have to give only few fields(newly added and some old) to new servlet.So i am searching for passing data for multiple servlets at a time.If there is any possibility please suggest me.
Thanks for replies....All
 
Ashutosh Limaye
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mallikarjun dontamsetti wrote:
Vijitha Kumara wrote:
mallikarjun dontamsetti wrote:because i have to edit my previous servlet(which we are using in the application).

What do you mean by editing the previous servlet?

In my application we have to add some module. we are using a servlet to act as controller.We have to add some more fields to jsp(Form) and the controller for new module will be another servlet(As my lead said) it is working separate from main servlet. i have to give only few fields(newly added and some old) to new servlet.So i am searching for passing data for multiple servlets at a time.If there is any possibility please suggest me.
Thanks for replies....All


Why aren't you accepting all the data in one servlet and passing the only the relevant data to the next servlet from this servlet?
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As i said above i have no option (my lead is the boss) he doesn't want the communication between two servlets or setting/extending bean class
 
Vijitha Kumara
Bartender
Posts: 3916
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So i am searching for passing data for multiple servlets at a time.If there is any possibility please suggest me.

I don't think you can do this by a single form submission. Servlet specification does not provide such a feature as per my understanding. But you can consider AJAX for talking to other servlet(s) while you are on the form which are triggered by form events, is this feasible for you?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vijitha Kumara wrote:Servlet specification does not provide such a feature as per my understanding.

It has nothing to do with servlets at all but with HTTP.

And yes, Ajax is the most likely recourse.
 
assert assertion
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don't want to use AJAX the other option is using multiple Iframes and post the form using java script . While posting set the target of the form = name of the Iframe.
 
mallikarjun dontamsetti
Ranch Hand
Posts: 246
Firefox Browser Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replies alllllllll
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic