Solved

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

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
java cyclic graphs 15 212
parse example 13 95
if statement not resolving in my code 5 55
spring example errors 33 401
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Most MSPs worth their salt are already offering cybersecurity to their customers. But cybersecurity as a service is wide encompassing and can mean many things.  So where are MSPs falling in this spectrum?
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

792 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