Servlet DoPost

Dear Friends;

Suppose we produced an HTML page using the doGet method which contains five
different submit buttons and now we want to produce a servlet doPost method
in a way that by pressing every each one of these keys something we desire happens.

How shall I write my "if" statements in the doPost method?

regards

Ehsan Farzam

1 comment
Comment actions Permalink

ehsan wrote:

Dear Friends;

Suppose we produced an HTML page using the doGet method which contains five
different submit buttons and now we want to produce a servlet doPost method
in a way that by pressing every each one of these keys something we desire happens.

How shall I write my "if" statements in the doPost method?


IIRC, you can give the buttons different name attributes (e.g.
name="button1", ..., name="button5"). If you click on say
button3, the request will contain parameters named button3.x
and button3.y. This is how you can detect which button was
pressed.

Regards,
Jens

0

Please sign in to leave a comment.