Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How deal in case of jsp page having multiple forms

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi EveryOne

Scenario as follows

jsp page contains 2 or 3 forms , in this case how to handle the situation like submitting data , sharing data from 2 forms

Thanking you

thanks®ards,
Bhavya
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Depends on how you want to use those forms. For example you can write three different forms with their own actions or you can make them hit the same action and give different values for submit buttons and depending on those values use application logic. It depends on how exactly you want to use them...
 
bhavya raj
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks For spending your valuable time for my request ||||||||||||||


How to share the data of multiple forms like if iam using same action for different forms , how form interaction will be done

<action path="/do" name="actionform1"/>
<action path="/do" name="actionform2"/>
<action path="/do" name="actionform3"/>

so in business logic how will you interact with 3 forms , only one action willbe executed at a time right ?

Here i have to get the data of form1 into form2.


Please,Can you make it clear with example

Thanks and Regards,
Bhavya
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A struts action mapping must be unique. In this situation:

<action path="/do" name="actionform1"/>
<action path="/do" name="actionform2"/>
<action path="/do" name="actionform3"/>


The last entry would be accepted, and the other two would be ignored.

You can have more than one form to a page, but each form must have its own action and its own submit button. It would look something like this:

<html:form action="/action1">
... text, buttons, etc.
<html:submit>
</html:form>

<html:form action="/action2">
... text, buttons, etc.
<html:submit>
</html:form>

When the first submit button is pressed, the first form will be submitted, and action1 will be called. Only input elements assigned to the first form will be processed. The input elements in the second form will be ignored.

When the second submit button is pressed, the second form will be submitted, and action2 will be called. Only input elements assigned to the second form will be processed. The input elements in the first form will be ignored.
 
Karthik Srikanti
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by the fact that you want to get data from form 1 into form 2? Can you elaborate?

If its something like copying the data you can use javascript for that but if you want three forms then you need to use three different actions. But if you want to use different responses then you can use multiple submit buttons with different values and use them up to apply corresponding business logic on server side. Or else you can use LookUpDispatchAction class.

Cheers.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic