Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
When we talk about DevOps toolchains, I sometimes wonder how many people really get what we’re talking about. I don’t know if it’s just semantics or tone or something else, but sometimes I think it just sounds like buzzword sausage. So it’s always …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

863 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

24 Experts available now in Live!

Get 1:1 Help Now