Solved

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

Posted on 2003-11-27
4
326 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
  • 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
stateless EJB with glassfish 2 70
maven webservice example issue 2 91
struts spring hibernate example 12 86
instanceof  operator in java 26 73
In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
Find out what the Office 365 disclaimer function is, why you would use it and its limited ability to create Office 365 signatures.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now