Forums Register Login

Passing data to two servlets?

+Pie Number of slices to send: Send
Is it possible to pass same form data to different servlets at a time
Thanks
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Can't do it through form action; but could achieve it through javascript. see XMLHttpRequest
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send
 

What if the form is on a .html file


I am just getting required fields in the servlet and using there only
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send
 

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
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
 

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?
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
Thanks for replies alllllllll
It's weird that we cook bacon and bake cookies. Eat this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 2110 times.
Similar Threads
Un-downloadable Applets
add a bean to many servlets which share their data
Downloading HTML page
Once HTML pages are created how do i link it to servlets without JSP.
Data Integrity in sevlets
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:09:59.