0

I have the following scenario .

There is a jsp (let's call it user.jsp) .

The user.jsp contains 2 buttons (Submit and Register). The two buttons are referring to entirely different actions (let us call it A and B).

Now when I click on Register button , since the same form is submitted , there are certain attributes in A which are not in B . Therefore I get an error saying , setter methods are not present .

how to solve this situation .

Please let me know if the question is not clear.

Vinoth Kumar C M
  • 10,378
  • 28
  • 89
  • 130

1 Answers1

2

You can always add dummy setters -or even manipulate the fields in javascript before submiting. But your implementation problem points to a conceptual-design problem. I find conceptually objectionable to send a form with same inputs field to two actions, specially if some of the fields only apply (make sense) for one of the actions.

In general, it doesn't seem right to me to have two submit buttons in a form pointing to different actions. The standard way is to make the different submits buttons in the same form point to different methods in the same action. The alternative, if the actions are really unrelated, is to make two different forms.

leonbloy
  • 73,180
  • 20
  • 142
  • 190