| Author |
Determine Which Form
|
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
I have 2 relativly similar JSP's that are sharing a common servlet because of a specific task that they perform. However, depending on which form called the servlet, I need to forward to a different page. I know how to determine which Button was pressed and for all intent and purposes I could just name the buttons on both pages differently and check for that, however, is there a way to retrieve the calling form in a servlet?
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56179
|
|
|
No. The form name is a client-side element that is not passed to the back end. You could do the button thing or better yet, include a hidden parameter in the form. I prefer the latter because it's a purer "API" than relying on client-side artifacts such as button names.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
|
Ditto for the hidden field
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
Thanks guys.
|
 |
 |
|
|
subject: Determine Which Form
|
|
|