• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Jsp calling multipul servlets

 
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I need to call more then one servlet from a jsp. In my jsp Form Action define a servlet and there are some other buttons and links which invokes other servlet. What are the possible and best way to do it.

Fot now what I am doing I am calling a JSP and on it's form action calling a servlet which forwards me on a different JSP page, from where I cal other servlet. Here I need to call both Servlet from a same page on different differnt submit button events or link.


 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How would you make a plain HTML page FORM having submit buttons to different URLs?

Just think about it.

Bill
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

William Brogden wrote:How would you make a plain HTML page FORM having submit buttons to different URLs?

Just think about it.

Bill




Hi Will want to make an correction, actually this is a jsp page, having a submit button and some links which takes me to different different servlets.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kaustubh G Sharma wrote:

William Brogden wrote:...

Bill




Hi Will



Pay attention to names while addressing others. Some might be offended and some may not, but it's always good to get that right.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kaustubh G Sharma wrote: actually this is a jsp page, having a submit button and some links which takes me to different different servlets.



So each link does take you to a different servlet, isn't it? What do you want to change then? Point the href attribute of the anchor tag to the right servlet.
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:

Kaustubh G Sharma wrote: actually this is a jsp page, having a submit button and some links which takes me to different different servlets.



So each link does take you to a different servlet, isn't it? What do you want to change then? Point the href attribute of the anchor tag to the right servlet.



Hi Jai

Tried my hand on it but gettting issues with correct selection of seperators '\\' '\\' '\' .. tried all of them but not worked out. Can you please give me some example for the same.

Thanks
K
 
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kaustubh G Sharma wrote:Hi

I need to call more then one servlet from a jsp. In my jsp Form Action define a servlet and there are some other buttons and links which invokes other servlet. What are the possible and best way to do it.

Fot now what I am doing I am calling a JSP and on it's form action calling a servlet which forwards me on a different JSP page, from where I cal other servlet. Here I need to call both Servlet from a same page on different differnt submit button events or link.

your question is ,you want to keep Two html Buttons in the same Html Page,

with one submit button some action should be done, with other submit button some other action should be done....

is that right

 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

raj talatam wrote:

your question is ,you want to keep Two html Buttons in the same Html Page,

with one submit button some action should be done, with other submit button some other action should be done....

is that right



No that's not my requirement
 
Ranch Hand
Posts: 34
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There isn't a proper way to submit two form at once or send request to two Servlets by one action.

However, I believe you could use AJAX here. Send one request to Servlet via javascript before submitting the form.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic