General design tip needed to write a small Jsp/servlet application

I am developing a small application using few JSP pages and a single servlet(as it iwas told to me that, number of servlet should be 1).

My problem is,

I have multiple JSPs. and multiple button within each JSPs.On click of each button, requeswt should be sent to Servlet and servlet performs some logic for esch button clicked.

I have 2 option to identify the button clicked and write the logic.

1.Servlet will get the value of each button.I will write one 'if loop' each for one button value. Whichever (request.getParameter("btnxyz")) returns 'NOT NULL', corresponding 'if loop' gets executed.This works fine.but servlet code looks like a mess as number of if loops = total number of buttons of all jsps.

2.Have a hidden field in each JSP.Onload of the button i will write some value to the field.On exit of JSp i will make it null.So, when button is clicked, in the servlet i will first identify the JSP from which request has come. and then identify the button as in step1.

My question is , which option is better?

Please suggest me other better solutions for the same.

Thanks,

Gowtam

[1155 byte] By [gowtam123a] at [2007-10-2 17:14:39]
# 1
Have you considered using Struts?It would make your life so much easier.Nick
nikolaosba at 2007-7-13 18:30:05 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...