Getting jsp filename within a servlet

Hi,

I am trying to build a simple web app to get deeper into the basic of jsp/servlet programming.Until now I only used the JSF framework but I want to know some basics :)

For this little project I have 2 JSP Views with forms which will be send to the Controllerservlet where the servlet could access the Model. After that, the Servlet should redirect to the proper result page( depend on the form-views).

An Example:

I fill out a form at user.jsp. User.jsp sends the submit via POST to the Controllerservlet. Within the servlet I want to identify the name of the submitter (user.jsp) to select the proper result page via a redirect.

But how can I do this? I could only find methods inside the request object where I can get the servlet name. Is it possible to get "user.jsp" or should I use a hidden paramater to decide which result page I should "render"?

Thnx

Alex

[918 byte] By [Troilusa] at [2007-11-27 10:41:46]
# 1

Check out the HTTP header field "referer" (yes, the spelling is wrong in the standard). That tells you what page called the servlet, which will be your user.jsp. Just be careful with redirects because they change the referrer. You can get headers from the request object also using the getHeader() method.

gimbal2a at 2007-7-28 19:14:35 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...