Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

JSF MVC Sample Application

Posted on 2006-07-12
9
Medium Priority
?
7,020 Views
Last Modified: 2013-11-24
I've read a LOT of documentation on the MVC model and how it is implemented in JSF, but I would like to see a small sample web app that uses JSF and the MVC arcitecture so that I can poke around the code and get a good sense of it.

Please list any places I can find such samples.
0
Comment
Question by:mmarksbury
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 24

Expert Comment

by:slyong
ID: 17096217
Hi mmarksbury,

> but I would like to see a small sample web app that uses JSF and the MVC arcitecture so that I can poke around the code and get a good sense of it.

JSF "is" an MVC framework, so I am not very clear by what you mean that you would like to see an app that uses JSF and the MVC arcitecture.  Have a look at the discussion here http://forum.java.sun.com/thread.jspa?threadID=563379&messageID=2782685 and there are a few tutorials about using JSF as MVC framework (if I understand you correctly):

http://www.javaworld.com/javaworld/jw-12-1999/jw-12-ssj-jspmvc.html
http://www-128.ibm.com/developerworks/library/j-jsf1/
http://www.jsftutorials.net/
0
 
LVL 7

Author Comment

by:mmarksbury
ID: 17096279
Well, you can easily use JSF without following an MVC architecture.  For example, I could put all business logic and data access in my backing bean, or even on my JSP.  I would like to some sample code of JSF as MVC in action that follows some standards.

In short, I'm looking for a good model.
0
 
LVL 24

Expert Comment

by:slyong
ID: 17096300
Hi mmarksbury,

yes you are right, have a look at the first link from javaworld, the JSP Model 2 is a very good example of MVC.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Accepted Solution

by:
anumalas earned 500 total points
ID: 17097270
Hi

These are the best links:

First link provides all MVC 2 pattern support JSF implementation for Classifields.

http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic=/com.ibm.etools.webtools.tutorial.doc/topics/intro.html

Second one  will provide IDE and some tutorials to create jsf applications

http://www.exadel.com

Hope this will help you to build good JSF knowledge :)
0
 
LVL 7

Author Comment

by:mmarksbury
ID: 17100645
I still haven't seen a good model of a JSF built on the MVC architecture.  I am looking for a sample application, nothing big, but a working sample that I can look at and learn from.  I know JSF already, and I understand the MVC model.  I simply want to poke around at an application that has already been built.  Anyone have a link to such a sample application?
0
 
LVL 28

Expert Comment

by:rrz
ID: 17104733
>I still haven't seen a good model of a JSF built on the MVC architecture.
I am not an JSF expert.  But, for the sake of this dicussion,  I propose a simple app.  
 the model
----------------------------------------------------------------
package myPack;
public class UserBean{
                 private int count;
                 public UserBean(){
                                   count = 0;
                 }
                 public int getCount(){
                           return count;
                 }
                 public void addOne(){ count++;}
}
-----------------------------------------------------------------------------------
the view  
-------------------------------------------------------------
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<HTML>
    <HEAD> <title>MVC</title> </HEAD>
    <body>
      <f:view>
           <h:form id="AddOneForm" >
                 <h:outputText id="count" value="#{userBean.count}"/>  
                 <h:commandButton id="addOne" value="addOne" action="#{userBean.addOne}"/><p>
           </h:form>
      </f:view>
    </body>
</HTML>
---------------------------------------------------
in  faces-config.xml
-----------------------------------------
<faces-config>
  <managed-bean>
    <managed-bean-name>userBean</managed-bean-name>
    <managed-bean-class>myPack.UserBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>
</faces-config>
0
 
LVL 7

Author Comment

by:mmarksbury
ID: 17131300
It seems to me that there is a lot of descrepancy out there as to what in JSF is the Model and what is the View/Controller...hence, the reason for my question in the first place.

In many tutorials and even in answers within this question, I see reference to backing beans as the model.  It seems to me that it would play out more like this.  What do you all think?

Model:
----------------
Class library or classes containing business objects that reflect your business process needs including classes and methods that handle data access.

View:
----------------
The JSF's and UI components that actually present data on the page.

Controller:
----------------
A combination of various things including Backing Beans that control the flow of the application.  For example, a faces servlet in combination with a backing bean sending a response.
0
 
LVL 3

Expert Comment

by:anumalas
ID: 17133450
yes it  seems like that

but

JSF is like a swing application from server side :)

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

927 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question