Request object in MVC

Dear all, I have some inquiry about the request object, I'm using MVC implementation recommended by IBM, where JSP submits to a controller servlet which redirect the request & response over appropriate class handlers, My question is: - The nature of the request object, as I don't figure its behaviour, let me be more clear about what I mean: JSP submits to a controller servlet which figure which handler the JSP requires & passes the request & response to this handler which take what it needs of parameter passed to it using getParameter, or getParameterValues methods and do some logic and passes the result to a JSP after adding the result in the SAME request object using setAttribute method, and then uses getServletContext().getRequestDispatcher( p_szPage ).forward( p_Request, p_Response ); to submit to a second JSP. I want to know how the request object differentiate between parameters passed to it from the first JSP & the attributes he is sending to the second JSP.

Ashraf The biggest difference is that the data sent in the request by the original form/page is stared as parameters while the data added by the servelt woould be attributes. As you said, you get the parameter values out with getParameter or getParameterValues and with attributes you'd use getAttribute or getAttributeNames. Once the parameters are set you cant change them except by invalidating the entire request object itself. There are other differences but that is the most obvious and probably the most helpfuil for what you're trying to do. hope that helps

Dave

Ashraf Fouad
Ranch Hand

Joined: Oct 07, 2001
Posts: 80

posted May 31, 2002 11:19:00

0

1- I want to know when the parameters & attributes are invalidated or removed in the MVC, and by whom? 2- I have an object that is maintained through several pages & I don't want to use the session because I can't determine when to remove it from session, I want to pass it in the request from the JSP to the Handler, how could this be done? can setAttriute be called in the JSP, I tried it but it returns null in the handler. But it seems the only possible way to me. Any help

Hello! U can setAttributes in jsp and can get it back in servlets. U write u dont know when to remove the object from session. U r the programmer and if u dont know ... i think u not know what u want to do and how to impliment MVC. If u give some code snipts of what u want to do than may be we can help in better way.