Problème d'accessibilité avec le design patterns MVC
Bonjour,
Je suis encore novice en JSF et j'ai quelques problèmes d'accessibilités dans mes pages JSF.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="core" %>
<core:view>
<html:form>
<html:dataTable value="#{catalogCtrl.model.datas.}">
<html:column>
<html:outputText></html:outputText>
</html:column>
</html:dataTable>
</html:form>
</core:view> |
catalogCtrl.model.datas. devrait me donner l'accès a un de mes beans, mais il ne le fait pas (Erreur HTTP 500). Vous pouvez voir dans le constructeur de mon controller que j'instancie bien un bean "Catalog" --> this.getModel().setDatas(new Catalog());
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
/*
* Model.java
*
* Created on 23 juillet 2007, 22:02
*
*/
package be.virtualshop.mvc;
/**
*
* @author Benetti Andrea
*/
public interface Model {
public Object getDatas();
public void setDatas(Object object);
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
/*
* SimpleModel.java
*
* Created on 23 juillet 2007, 22:18
*
*/
package be.virtualshop.mvc;
/**
*
* @author Benetti Andrea
*/
public class SimpleModel implements Model{
private Object datas;
/** Creates a new instance of SimpleModel */
public SimpleModel() {
}
public Object getDatas() {
return datas;
}
public void setDatas(Object datas) {
this.datas = datas;
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
/*
* Controller.java
*
* Created on 23 juillet 2007, 22:04
*
*/
package be.virtualshop.mvc;
/**
*
* @author Benetti Andrea
*/
public interface Controller {
public Model getModel();
public View getView();
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
/*
* CatalogListController.java
*
* Created on 23 juillet 2007, 22:38
*
*/
package be.virtualshop.mvc;
import be.virtualshop.bean.Catalog;
/**
*
* @author Benetti Andrea
*/
public class CatalogListController implements Controller{
private Model model;
private View view;
/** Creates a new instance of CatalogListController */
public CatalogListController() {
this.model = new SimpleModel();
this.view = new ListView();
this.getModel().setDatas(new Catalog());
}
public Model getModel() {
return model;
}
public void setModel(Model model) {
this.model = model;
}
public View getView() {
return view;
}
public void setView(View view) {
this.view = view;
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC
"-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
<!-- =========== FULL CONFIGURATION FILE ================================== -->
<faces-config>
<managed-bean>
<managed-bean-name>catalogCtrl</managed-bean-name>
<managed-bean-class>be.virtualshop.mvc.CatalogListController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config> |
Bizar non ? 8O