Solved

Java SERVLETS---How to handle multiple forms in same servlet

Posted on 2003-11-27
4
335 Views
Last Modified: 2010-05-18
Hi,
I'm trying to write a web service program,and am invoking a JAX-RPC client and SAAJ client through one servlet at the user interface.Now,i want to split the functionality and have the result of JAX-RPC display its result when the first "submit"  button is hit.When this response is generated , a new form should be created on the same page which will call the SAAJ client when the submit button on the second form is hit.(i.e the same servlet handles calling SAAJ client but it calling the SAAJ depends on the response generated by the JAX-RPC) .

I'm new to the whole web services thing as well as servlets...so any help will be appreciated.
Thanks
S
0
Comment
Question by:srik18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 125 total points
ID: 9830886
Your servlet will be able to determine which form was used to call it by checking any parameter from the request that will be unique to the form.

If you don't have something obvious that you can use with the forms you already have, just add a hidden form field to each form that can be used for the identification.
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9831046
I believe jimjack is right but you should not control both forms from the same servlet, just make 2 servlets one for each form it will take some headeaches from you.
0
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 125 total points
ID: 9831124
I would go with Jimmack's idea... Because its more in line MVC.... you should not create more controllers( servlets) if you can avoid them...

may be you can attach a hidden field named as origin.... and then servlet can check the value of Origin.. by doing a String origin=request.getParameter("origin"); and then determine the next action as
if(origin!=null && origin.equals("SAAJ"))
{
dothis();
}else
{
doThat();
}
Hope this helps
0
 
LVL 6

Expert Comment

by:jarasa
ID: 9831176
>>I'm new to the whole web services thing as well as servlets...so any help will be appreciated.

Sincerely I don't think for the comments that srick18 is trying to implement MVC but I agree with you if that is what he's doing.

Javier
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes a serious pitfall that can happen when deleting shapes using VBA.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question