[opencms-dev] MVC in Opencms: how to get the pageContext into the model?

aden adenener at hotmail.com
Wed Feb 6 15:27:33 CET 2008


I want to start with MVC-architecture (type 2) without struts or jsf. 

So my idea is following: The view start the controller with html-code for
instance <form name="form" method="post" action="/opencms/Controller.do">,
then the controller should init() the model for instance
NewUserBean(pageContext, request, response ) and  collect the "result" from
the model-method NewUserBean.newUser( bla-bla, ...) und put it in an
RequestDispatcher. So the view.jsp is called and this have access to the
"result" and show the page.

But how I get the PageContext in this controller? Please send me some
code-pieces for help. Or I am completly wrong with this controller-code?

thanks.

public class Controller extends OpenCmsServlet{

public void doPost ( HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException{

NewUserBean ub = new NewUserBean( !!pageContext!!, request, response );
result = ub.newUser( emailName, lastName, firstName, password1, password2,
addInfos, group );
				
request.setAttribute("result", result);
RequestDispatcher rd = request.getRequestDispatcher( "/view.jsp" );
rd.forward(request, response);
}
}
-- 
View this message in context: http://www.nabble.com/MVC-in-Opencms%3A-how-to-get-the-pageContext-into-the-model--tp15306671p15306671.html
Sent from the OpenCMS - Dev mailing list archive at Nabble.com.




More information about the opencms-dev mailing list