Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- My managed bean:
- package web;
- import java.util.List;
- import javax.annotation.PostConstruct;
- import javax.enterprise.context.SessionScoped;
- import javax.faces.bean.ManagedBean;
- import mapping.*;
- import gestion.*;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Component;
- @Component
- @ManagedBean(name="bean")
- @SessionScoped
- public class AjoutChamp {
- private Module module;
- private int m;
- private int etape;
- private int menu;
- private int TypeChamp;
- private int action;
- private int selecteur;
- private String valeur_selecteur;
- private String contexte;
- private String texte;
- @Autowired
- private GestionEtape gEtape;
- @Autowired
- private GestionModule gModule;
- private List<Module> listeModule;
- @PostConstruct
- void init(){
- listeModule=gModule.selectAll();
- }
- public int getM() {
- return m;
- }
- public void setM(int m) {
- this.m = m;
- }
- public List<Module> getListeModule() {
- return listeModule;
- }
- public void setListeModule(List<Module> listeModule) {
- this.listeModule = listeModule;
- }
- public GestionEtape getgEtape() {
- return gEtape;
- }
- public void setgEtape(GestionEtape gEtape) {
- this.gEtape = gEtape;
- }
- public GestionModule getgModule() {
- return gModule;
- }
- public void setgModule(GestionModule gModule) {
- this.gModule = gModule;
- }
- public Module getModule() {
- return module;
- }
- public void setModule(Module module) {
- this.module = module;
- }
- public int getEtape() {
- return etape;
- }
- public void setEtape(int etape) {
- this.etape = etape;
- }
- public int getMenu() {
- return menu;
- }
- public void setMenu(int menu) {
- this.menu = menu;
- }
- public int getTypeChamp() {
- return TypeChamp;
- }
- public void setTypeChamp(int typeChamp) {
- TypeChamp = typeChamp;
- }
- public int getAction() {
- return action;
- }
- public void setAction(int action) {
- this.action = action;
- }
- public int getSelecteur() {
- return selecteur;
- }
- public void setSelecteur(int selecteur) {
- this.selecteur = selecteur;
- }
- public String getValeur_selecteur() {
- return valeur_selecteur;
- }
- public void setValeur_selecteur(String valeur_selecteur) {
- this.valeur_selecteur = valeur_selecteur;
- }
- public String getContexte() {
- return contexte;
- }
- public void setContexte(String contexte) {
- this.contexte = contexte;
- }
- public String getTexte() {
- return texte;
- }
- public void setTexte(String texte) {
- this.texte = texte;
- }
- public AjoutChamp(){}
- }
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd">
- <context:component-scan base-package="web"></context:component-scan>
- <context:component-scan base-package="dao"></context:component-scan>
- <context:component-scan base-package="gestion"></context:component-scan>
- <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
- <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
- <property name="url" value="jdbc:mysql://localhost:3306/yo?useSSL=false"/>
- <property name="username" value="root"/>
- <property name="password" value=""/>
- </bean>
- <bean id="factory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
- <property name="dataSource" ref="dataSource"/>
- <property name="hibernateProperties">
- <props>
- <prop
- key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- </props>
- </property>
- <property name="packagesToScan">
- <list>
- <value>mapping</value>
- </list>
- </property>
- </bean>
- <bean id="transactionManager"
- class="org.springframework.orm.hibernate5.HibernateTransactionManager">
- <property name="sessionFactory" ref="factory"/>
- </bean>
- <tx:annotation-driven transaction-manager="transactionManager"/>
- </beans>
- xmlns:context="http://www.springframework.org/schema/context"
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd
- http://www.springframework.org/schema/aop
- http://www.springframework.org/schema/aop/spring-aop.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context.xsd">
- ...
- </beans>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version><!-- version of Spring context. --></version>
- </dependency>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement