aspose file tools*
The moose likes Servlets and the fly likes Determine Which Form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Determine Which Form" Watch "Determine Which Form" New topic
Author

Determine Which Form

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

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?


GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks guys.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Determine Which Form