aspose file tools*
The moose likes Servlets and the fly likes MVC Architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "MVC Architecture" Watch "MVC Architecture" New topic
Author

MVC Architecture

Shaibaz Gadhwala
Greenhorn

Joined: Jan 22, 2001
Posts: 11
Hello everyone,
Can anyone tell me the answer for the following question
The designers of JSP put forward two recommendations of architecture, known as Model 1 and Model 2. In a Model 2 achitecture it is the job of a Servlet to recognize what data a JSP page requires, to retrieve it and pass it into the JSP page.
Given the above information, how can a Servlet dynamically register a Bean for use with a JSP page?
The options are
1> forward.registerBean(new Bean(), REQUEST_SCOPE);
2> pageContext.setAttribute(new Bean(), REQUEST_SCOPE);
3> <jsp:useBean id="id" scope="page" class = "<%=..%>"/>
4> servletContext.setAttribute(new Bean(), REQUEST_SCOPE);
5> jspEngine.registerBean(new Bean(), REQUEST_SCOPE);
Thanks in advance....
Shaibaz Gadhwala
Greenhorn

Joined: Jan 22, 2001
Posts: 11
It seems no one is interested in replying to my questions of MVC Architecture....
A final call to all the sleeping nerds to help a desparate soul like me....
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Is this some sort of exam question, or have you a real need to do this? The simplest way to find out is to try each case and see what happens!


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Kameswari Jyosyula
Ranch Hand

Joined: Feb 20, 2001
Posts: 39
Hi , I think the answer that this is an examination question ;-)and i think the answer is 3.
The web borwser sends a request to the sever through a JSP page which in turn calls bean and returns to the client the output.
Whenever the JSP page is called it automatically is transformed to a servlet.In the usebean tag you specify the class that is required.The scope has nothing to do with the way the bean is called from the servlet.
hth
Originally posted by Shaibaz Gadhwala:
Hello everyone,
Can anyone tell me the answer for the following question
The designers of JSP put forward two recommendations of architecture, known as Model 1 and Model 2. In a Model 2 achitecture it is the job of a Servlet to recognize what data a JSP page requires, to retrieve it and pass it into the JSP page.
Given the above information, how can a Servlet dynamically register a Bean for use with a JSP page?
The options are
1> forward.registerBean(new Bean(), REQUEST_SCOPE);
2> pageContext.setAttribute(new Bean(), REQUEST_SCOPE);
3> <jsp:useBean id="id" scope="page" class = "<%=..%>"/>
4> servletContext.setAttribute(new Bean(), REQUEST_SCOPE);
5> jspEngine.registerBean(new Bean(), REQUEST_SCOPE);
Thanks in advance....

Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
servletRequest.setAttribute(string,object);


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MVC Architecture
 
Similar Threads
JSP, Beans and Session
Trouble accessing a singleton within a JSP page!
java.lang.IllegalStateException: using sendRedirect()
MVC architecture
Page Beans