I have a web application that uses a main
servlet. My objective is to have everything pointing at the servlet in which most of the business logic is implemented. Currently, my servlet contains a few else-if statements that capture various button-clicks. At this point, I would like to have a
jsp page that will have dynamically generated content based on the hyperlink clicked. My problem is that I cannot capture the hyperlink-click event on the servlet; capturing a button can be as easy as having an if-statement, but there is no such feature for the anchors.
One solution might include the use of javascript; if I am not mistaken it is possible to capture such events using a simple function, however I am not sure whether it is possible from inside the function to set a parameter/attribute on the session.
Another solution would be to create more servlets that would take care each hyperlink (by having the hyperlink itself pointing at the servlet and implementing an "on-page-load") however this is not an option because the hyperlinks themselves are dynamically generated and also that would pretty much ruin my design (one main servlet).
I was hoping there is a way when clicking a hyperlink some value would change (in a form maybe?) and this change could be captured by the servlet. (e.g. when clicking the hyperlink set a parameter on the session?)
Any suggestions/directions would be much appreciated.