Solved

JSF MVC Sample Application

Posted on 2006-07-12
9
6,783 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
 
LVL 8

Expert Comment

by:kaliyugkaarjun
ID: 17096864
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 3

Accepted Solution

by:
anumalas earned 250 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 27

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now