Not able to call managed bean method on submit button - jsf

Here is my code of my .xhtml page
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
template="/WEB-INF/templates/admin/main_body_template.xhtml">
<ui:define name="bodycontent">
<h:panelGroup>
<h:form class="form-horizontal" enctype="multipart/form-data">
<!-- Build page from here: Usual with <div class="row-fluid"></div> -->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default" style="min-height: inherit;">
<div class="panel-heading">
<h4><span class="icon16 icomoon-icon-pencil-3"></span><span>Create New Module</span></h4>
</div>
<div class="panel-body">
<div class="form-group">
<label class="col-lg-5 control-label" for="select">Select app</label>
<div class="col-lg-3 dropdown-error">
<h:selectOneMenu class="form-control" required="required" value="#{moduleBean.appList}">
<f:selectItem itemValue="0" itemLabel="-- Please select app --"></f:selectItem>
<f:selectItem itemValue="1" itemLabel="AdMan"></f:selectItem>
<f:selectItem itemValue="2" itemLabel="Neokala"></f:selectItem>
<f:selectItem itemValue="3" itemLabel="Recrudesk"></f:selectItem>
<f:selectItem itemValue="4" itemLabel="E-commerce"></f:selectItem>
<f:selectItem itemValue="5" itemLabel="Restaurants"></f:selectItem>
<f:selectItem itemValue="6" itemLabel="Account"></f:selectItem>
<f:selectItem itemValue="7" itemLabel="MockExam"></f:selectItem>
</h:selectOneMenu>
</div>
</div>
<!-- End .form-group -->
<hr/>
<div class="form-group a1">
<label class="col-lg-5 control-label" for="normalInput">Module name</label>
<div class="col-lg-3">
<h:inputText class="form-control" required="true" value="#{moduleBean.selected.moduleName}"></h:inputText>
</div>
<a href="#"
class="btip"
rel="tooltip"
data-placement="right"
data-original-title="Tooltip on right">
<span class="icon16 entypo-icon-help-2 icon-position"></span>
</a>
</div>
<!-- End .form-group -->
<div class="form-group b1">
<label class="col-lg-5 control-label" for="fileinput">Upload image</label>
<div class="col-lg-3">
<h:inputFile class="form-control" id="file" value="#{moduleBean.imgFile}"/>
</div>
<a href="#"
class="btip"
rel="tooltip"
data-placement="right"
data-original-title="Tooltip on right">
<span class="icon16 entypo-icon-help-2 icon-position"></span>
</a>
</div>
<!-- End .form-group -->
<div class="form-group">
<label class="col-lg-5 control-label" for="checkboxes">Active</label>
<div class="col-lg-3">
<div class="normal-toggle-button toggle-custom-size">
<h:selectBooleanCheckbox class="nostyle" value="#{moduleBean.selected.active}"></h:selectBooleanCheckbox>
</div>
</div>
</div>
<!-- End .form-group -->
<div class="form-group">
<label class="col-lg-5 control-label" for="checkboxes">Add-on</label>
<div class="col-lg-3">
<div class="left marginR10">
<div class="normal-toggle-button toggle-custom-size">
<h:selectBooleanCheckbox class="nostyle" value="#{moduleBean.selected.addOn}"></h:selectBooleanCheckbox>
</div>
</div>
</div>
</div>
<!-- End .form-group -->
</div>
<div class="panel-heading form-footer-top">
<div class="footer-btn-position">
<h:commandButton class="btn btn-primary nostyle marginR5" value="Save" action="#{moduleBean.create()}"></h:commandButton>
<h:commandButton type="button" class="btn btn-warning nostyle cancel-btn-position" value="Cancel"></h:commandButton>
</div>
<div style="clear:both;"></div>
</div>
</div>
<!-- End .panel -->
</div>
<!-- End .span12 -->
</div>
<!-- End .row -->
</h:form>
</h:panelGroup>
</ui:define>
</ui:composition>
and below is my managedbean code.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.aptegrainc.ymapps.supadm.managedbeans.masters;
import com.aptegrainc.ymapps.supadm.controller.masters.ModuleController;
import com.aptegrainc.ymapps.supadm.dto.ModuleVo;
import com.aptegrainc.ymapps.supadm.managedbeans.UserDataBean;
import static com.aptegrainc.ymapps.supadm.managedbeans.UserDataBean.setErrorMessage;
import static com.aptegrainc.ymapps.supadm.managedbeans.UserDataBean.setInfoMessage;
import java.io.Serializable;
import java.util.List;
import java.util.ResourceBundle;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.servlet.http.Part;
/**
*
* #author Vaibhavi
*/
#ManagedBean(name = "moduleBean")
#ViewScoped
public class ModuleBean extends UserDataBean implements Serializable{
private static final long serialVersionUID = 1L;
private DataModel items;
private ModuleVo current;
private Part imgFile;
private boolean createPanel = false;
private ModuleController moduleController = new ModuleController();
private String appList;
public Part getImgFile() {
return imgFile;
}
public void setImgFile(Part imgFile) {
this.imgFile = imgFile;
}
public ModuleVo getSelected() {
if (current == null) {
current = new ModuleVo();
}
return current;
}
/**
* Creates a new instance of ModuleBean
*/
public ModuleBean() {
}
public String create() {
System.out.println("current : " + current);
System.out.println("---------"+current.getAppName()+current.getModuleName()+current.isActive()+current.isAddOn());
if(checkError()){
try {
System.out.println("---------"+current.getAppName()+current.getModuleName()+current.isActive()+current.isAddOn());
current.setActive(true);
boolean val = moduleController.create(current);
if(!val){
return "pretty:commonerror";
} else if (val){
setInfoMessage("Module created successfully");
}
setCreatePanel(false);
recreateModel();
return "success";
} catch (Exception e) {
setErrorMessage(ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
}
}
return "fail";
}
public boolean checkError(){
boolean flag = true;
if(current.getModuleName() == null || current.getModuleName().equals("")){
//setErrorMessage("Enter module name");
flag = false;
}
return flag;
}
private void recreateModel() {
items = null;
}
// Getters, Setters
/**
* #return the items
*/
public DataModel getItems() {
if (items == null) {
List<ModuleVo> moduleVos = null;
//moduleVos = moduleController.findAll();
items = new ListDataModel(moduleVos);
}
return items;
}
/**
* #param items the items to set
*/
public void setItems(DataModel items) {
this.items = items;
}
/**
* #return the current
*/
public ModuleVo getCurrent() {
return current;
}
/**
* #param current the current to set
*/
public void setCurrent(ModuleVo current) {
this.current = current;
}
/**
* #return the moduleController
*/
public ModuleController getModuleController() {
return moduleController;
}
/**
* #param moduleController the moduleController to set
*/
public void setModuleController(ModuleController moduleController) {
this.moduleController = moduleController;
}
/**
* #return the appList
*/
public String getAppList() {
return appList;
}
/**
* #param appList the appList to set
*/
public void setAppList(String appList) {
this.appList = appList;
}
/**
* #return the createPanel
*/
public boolean isCreatePanel() {
return createPanel;
}
/**
* #param createPanel the createPanel to set
*/
public void setCreatePanel(boolean createPanel) {
this.createPanel = createPanel;
}
}
I have just called a method on submit button but its not calling even the method. I have checked the code many times but couldn't find any logical error. I am not getting why the bean method is not called.

Related

JSF couldn't pass data to bootsrtap modal

hello everyone i have a bootsfaces dataTabble, each row has an edit end delete action, i want to show a modal that contains selected row data to edit that object.
i successfully get the selected row i pass data to the managedBean, i assign data to managedProperties, but nothing is shown in Modal input elements.
this is my dataTable code:
<b:dataTable id="articleslist" value="#{listeArticlesAction.listeArticles}" var="article" page-length="10" paginated="true"
page-length-menu="10,20,30">
<b:dataTableColumn value="#{article.code}" label="Code" />
<b:dataTableColumn value="#{article.nom}" label="Nom" />
<b:dataTableColumn value="#{article.description}" label="Description" />
<b:dataTableColumn value="#{article.prix}" label="Prix (DH)" />
<b:dataTableColumn label="Modifier" style="text-align: center">
<h:commandButton style="padding: 0 4px;" iconAwesome="pencil" look="link" pt:data-target="#userEditModal" pt:data-toggle="modal"
action="#{listeArticlesAction.modifierArticle}">
<f:setPropertyActionListener target="#{listeArticlesAction.editArticle}" value="#{article}"
/>
<f:ajax render="#form"/>
</h:commandButton >
</b:dataTableColumn>
<b:dataTableColumn label="Supprimer" style="text-align: center">
<h:commandButton style="padding: 0 4px; text-align: center;" iconAwesome="trash" look="link" pt:data-target="#userEditModal" pt:data-toggle="modal"
onclick="confirmDelete()" action="#{listeArticlesAction.supprimerArticle}" >
<f:param name="actionDelete" value="article" />
</h:commandButton >
</b:dataTableColumn>
</b:dataTable>
and this is my managedBean class:
public class ListeArticlesAction {
private List<Article> listeArticles = new ArrayList<Article>();
private String editArticleNom;
private String editArticleDescription;
private int editArticlePrix;
private Article editArticle;
/**
* Methode pour preparer la liste des articles
*/
#PostConstruct
public void init() {
listeArticles = ServiceFactory.getArticleService().allArticles();
}
public List<Article> getListeArticles() {
return listeArticles;
}
public void setListeArticles(List<Article> listeArticles) {
this.listeArticles = listeArticles;
}
public String getEditArticleNom() {
return editArticleNom;
}
public void setEditArticleNom(String editArticleNom) {
this.editArticleNom = editArticleNom;
}
public String getEditArticleDescription() {
return editArticleDescription;
}
public void setEditArticleDescription(String editArticleDescription) {
this.editArticleDescription = editArticleDescription;
}
public int getEditArticlePrix() {
return editArticlePrix;
}
public void setEditArticlePrix(int editArticlePrix) {
this.editArticlePrix = editArticlePrix;
}
public Article getEditArticle() {
return editArticle;
}
public void setEditArticle(Article editArticle) {
this.editArticle = editArticle;
}
public void supprimerArticle() {
}
/**
* methode pour modifier un article quelconque
*/
public void modifierArticle() {
editArticleDescription = editArticle.getDescription();
editArticleNom = editArticle.getNom();
editArticlePrix = editArticle.getPrix();
}
}
and this is my modal html code:
<div class="modal" id="userEditModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">
Modifier le produit
</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">
×
</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="edit_product_name" class="form-control-label">
Nom:
</label>
<h:inputText type="text" class="form-control" id="edit_product_name"
value="#{listeArticlesAction.editArticleNom}" autocomplete="off" />
</div>
<div class="form-group">
<label for="edit_product_description" class="form-control-label">
Description:
</label>
<h:inputTextarea class="form-control" id="edit_product_description"
value="#{listeArticlesAction.editArticleDescription}" autocomplete="off" />
</div>
<div class="form-group">
<label for="edit_product_price" class="form-control-label">
Prix(DH):
</label>
<h:inputText type="text" class="form-control m-input" id="edit_product_price"
value="#{listeArticlesAction.editArticlePrix}" autocomplete="off" />
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">
Annuler
</button>
<button type="button" class="btn btn-primary">
Modifier
</button>
</div>
</div>
</div>
</div>
Most likely you're updating the wrong part of the screen. That happens to many people using modals for the first time. Thing is, the modal is rendered when the page is loaded. That's potentially a minute before the button is clicked. So the modal doesn't know which data to display. You tell it using the update attribute of the command button.
As far as I can see, the datatable and the Java bean are OK. With the exception of the update region. Your code snippets don't show where the <h:form> or <b:form> tag is, so it's almost certainly outside the datatable. However, what you should update is the content of the modal. Don't update the entire modal (because that renders it hidden again). Just the content. Something like update="#(.modal-dialog)".
The modal itself looks a bit odd to me. What is listeArticlesAction? Judging from the other code snippets, you want to use listeArticlesAction.editArticle instead.
Side remark: I suggest you choose a language for the variable names (and stuff like this) and use it consistently. French is a good choice, although most developers (except me) recommend English. But it's hard enough to remember the variable name. You don't have to add the burden of remembering the language :).

the data on my database are not updatd when i change the value of p:selectBooleanCheckbox , but it works with the inputText [duplicate]

This question already has an answer here:
when i click on the p:selectBooleanCheckbox, it works but for the second click it doesn't work,why?
(1 answer)
Closed 5 years ago.
when i want to update the value of the <p:selectBooleanCheckbox> and click on update button, its value doesn't change on the database, but when i replace it with .
this is my code :
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:evoice="http://ccs.tn/taglib/evoice">
<ui:include src="CloseTicketDialog.xhtml" />
<div class="form-body pal">
<div class="row">
<p:outputLabel for="call_from_tel_number"
styleClass="col-md-2 control-label" value="Numéro Entrant" />
<div class="col-md-3">
<div class="input-icon right">
<i class="fa fa-phone" />
<p:inputText id="call_from_tel_number" maxlength="32" size="9"
value="#{ticketController.ticket.callFromTelNumber}"
validatorMessage="Numéro Entrant : Composé au minimum par 8 chiffres dans [0..9]."
styleClass="form-control">
<f:validateRegex pattern="[0-9\s]*" />
<f:validateLength minimum="8" maximum="32" />
<p:ajax event="blur" id="ajax_call" disabled="#{ticketController.ticket.ticketId ne null}"
process="call_from_tel_number,form:growl"
update="form:growl,form:tab_view:lastName, form:tab_view:firstName"
listener="#{ticketController.queryOldTickets(ticketController.ticket)}"
onstart="PF('statusDialog').show()"
oncomplete="PF('statusDialog').hide()"/>
</p:inputText>
</div>
</div>
<p:outputLabel for="reply_to_tel_number" value="Deuxièmme Numéro"
styleClass="col-md-3 control-label" />
<div class="col-md-3">
<div class="input-icon right">
<i class="fa fa-phone" />
<p:inputText id="reply_to_tel_number" maxlength="32" size="9"
readonly="{ticketController.ticket.ticketId ne null}"
value="#{ticketController.ticket.otherPhonenum}"
validatorMessage="Deuxièmme Numéro : Accepte seulement des chiffres dans [0..9]."
styleClass="form-control">
<f:validateRegex pattern="[0-9]*" />
</p:inputText>
</div>
</div>
</div>
<div class="form-group" />
<div class="row">
<p:outputLabel for="telOwner" value="proprietaire de num"
styleClass="col-md-2 control-label" />
<div class="col-md-3">
<div class="input-icon right">
<p:selectBooleanCheckbox selected="true" id="telOwner" value="#{ticketController.ticket.phoneLineOwner}" />
</div>
</div>
</div>
what is the problem? what the value of "telOwner" is updated when i use p:inputText and its not updated when i use p:selectBooleanCheckbox?
this is the controller:
#Controller(value = "ticketController")
#Scope("view")
public class TicketController extends eVoiceController implements Serializable {
public String saveTicket() {
log.info("saveTicket");
if (!isValide(ticket)) {
return null ;
}
if (ticket.getOwner() == null) {
ticket.setOwner(currentUser());
} else {
ticket.setLastUpdateBy(currentUser());
ticket.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
}
Integer ticketId = ticketService.saveTicket(ticket);
// ticket.getTicketCategories().size();
if (closeTicketCmdBtn != null) {
closeTicketCmdBtn.setDisabled(false);
}
showInfoMessage(i18n("ticket.saved.number", ticketId));
log.info("TICKET[" + ticketId + "]");
return null;
}
this is the service:
#Override
#Transactional(readOnly = false)
public Integer saveTicket(final Ticket ticket) {
LoyaltyCard card = ticket.getLoyaltyCard();
if (card != null) {
card.setCreatedBy(ticket.getCreatedBy());
card = loyaltyCardService.save(card);
}
ticket.setLoyaltyCard(card);
Integer id = ticketDao.save(ticket).getTicketId();
/**
* #TODO run on seperate Thread
*/
ruleService.assignSeverity(ticket);
return id;
}
and this is the entity code:
#Column(name = "phone_line_owner")
#org.hibernate.annotations.Type(type = "yes_no")
private Boolean phoneLineOwner;

Why Spring Security is not working in my Spring Boot project?

MY QUESTION! WHY Once admin or users after login, they can not get on their dashboards. It updates the pages "/" or "/ home", but does not go
to UserDashboards or AdminDashboards?!
I am trying to configure Spring boot with Spring security and DB() for an application.
I have login-form in my home.jsp. User can login or registred in my site in modal window.
I will show you only a portion of home.jsp
<!-- Header -->
<li><spring:message code="nav.section.link5"/></li>
<c:if test="${email == null}">
<li><spring:message code="nav.section.link6"/></li>
<li><spring:message code="nav.section.link9"/></li>
</c:if>
<c:if test="${email != null}">
<li>${email}</li>
<li><spring:message code="nav.section.link10"></spring:message> </li>
</c:if>
<!-- modal login
================================================== -->
<div class="modal" id="modal-1">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default active"><spring:message code="nav.section.link6"/></button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-2" data-dismiss="modal"><spring:message code="nav.section.link9"/></button>
</div>
</div>
</div>
<div class="modal-footer">
<div align="center">
<ul class="sign-social-icon">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div class="or">
<p><spring:message code="modal.section.h3"/></p>
</div >
<form:form method="post" action="/userLogin" id="contact-formL" class="form-horizontal">
<input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}"/>
<div class="control-group controls">
<input type="email" class="reg" placeholder="<spring:message code="modal.section.h6"/>" name="email" id="emailL" value="${dto.email}">
</div>
<div class="control-group controls ">
<input type="password" class="reg" id="passwordL" placeholder="<spring:message code="modal.section.h7"/>" name="password" value="${dto.password}" >
</div>
<div class="sign form-actions">
<input role="button" type="submit" class="btn btn-primary btn-block" value="<spring:message code="nav.section.link6"/>">
</div>
</form:form>
<%--<div class="fmp">--%>
<%--<a><spring:message code="modal.section.h4"/></a>--%>
<%--</div>--%>
</div>
</div>
</div>
</div>
<!-- modal registration
================================================== -->
<div class="modal" id="modal-2">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-body">
<div class="btn-group btn-group-justified" role="group" aria-label="...">
<div class="btn-group" role="group">
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal-1" data-dismiss="modal" ><spring:message code="nav.section.link6"/></button>
</div>
<div class="btn-group" role="group">
<button type="button" class="btn btn-default active"><spring:message code="nav.section.link9"/></button>
</div>
</div>
</div>
<div class="modal-footer">
<div align="center">
<ul class="sign-social-icon">
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
<div class="or">
<p><spring:message code="modal.section.h3"/></p>
</div>
<form:form action="/saveUser" modelAttribute="dto" name="myForm" id="contact-form" class="form-horizontal">
<div class="control-group controls">
<input type="email" class="reg" placeholder="<spring:message code="modal.section.h6"/>" name="email" id="email" value="${dto.email}">
</div>
<div class="control-group controls ">
<input type="password" class="reg" id="password" placeholder="<spring:message code="modal.section.h7"/>" name="password" value="${dto.password}" >
</div>
<div class="control-group controls">
<input type="password" class="reg" id="conf" placeholder="<spring:message code="modal.section.h8"/>" name="conf">
</div>
<div class="sign form-actions">
<input role="button" type="submit" class="btn btn-primary btn-block" value="<spring:message code="nav.section.link9"/>">
</div>
</form:form>
<div class="policy">
<spring:message code="modal.section.h5"/> </div>
</div>
</div>
</div>
</div>
This is my login method in HomeController.class:
#RequestMapping(value = "/userLogin", method = RequestMethod.POST)
public String updateOne(#RequestParam(required = true) String email, #RequestParam(required = true) String password, HttpServletRequest request) throws SQLException {
HttpSession session = request.getSession();
User user = userService.getByEmail(email);
System.out.println("проверка пароля и имейла с БД");
if (user != null && user.getPassword().equals(password)) {
session.setAttribute("email", user.getEmail());
System.out.println("ЛОГИНИТСЯ!!!");
if (userService.getByEmail(email).getRole().equals(Role.USER)) {
System.out.println("SALUT USER!!");
session.setAttribute("user", user);
return "redirect:/";
} else if (userService.getByEmail(email).getRole().equals(Role.MODERATOR)) {
System.out.println("SALUT MODERATOR!!");
session.setAttribute("moderator", user);
return "redirect:/";
} else if (userService.getByEmail(email).getRole().equals(Role.ADMIN)) {
System.out.println("SALUT ADMIN!!");
session.setAttribute("admin", user);
return "redirect:/";
}
}
return "redirect:/loginProblems";
}
The users and admin then has to open their dashboards(using click on button <li>${email}</li> in HEADER).
This is my DashboardController.class:
#Controller
public class DashboardsConroller {
#Autowired
UserService userService;
#Autowired
UserDataService userDataService;
#RequestMapping(value = "/dashboards", method = RequestMethod.GET)
public String selectDashboard(HttpServletRequest request) {
System.out.println("method selectDashboard!!");
HttpSession session = request.getSession();
User user = userService.getByEmail((String) session.getAttribute("email"));
System.out.println("СМОТРИ СЮДА = " + user);
if (userService.getByEmail(user.getEmail()).getRole().equals(Role.USER)) {
System.out.println("USER want to open dashboard!!");
session.setAttribute("user", user);
return "redirect:/userDash";
} else if (userService.getByEmail(user.getEmail()).getRole().equals(Role.MODERATOR)) {
System.out.println("Moderator want to open dashboard!!");
session.setAttribute("moderator", user);
return "redirect:/moderatorDash";
} else if (userService.getByEmail(user.getEmail()).getRole().equals(Role.ADMIN)) {
System.out.println("ADMIN want to open dashboard!!");
session.setAttribute("admin", user);
return "redirect:/adminDash";
} else {
System.out.println("LAST ELSE IS WORKING");
return "redirect:/home";
}
}
}
This is my showAdminDashboard() method in AdminDashController.class:
#PreAuthorize("hasAuthority('ADMIN')")
#RequestMapping(value = "/adminDash", method = RequestMethod.GET)
public ModelAndView showAdminDashboard(#ModelAttribute("myUserData") UserData myUserData,
#RequestParam(required = false) String firstName,
#RequestParam(required = false) String secondName,
HttpServletRequest request) throws SQLException {
...
}
This is my showUserDashboard() method in UserDashController.class:
#PreAuthorize("hasAuthority('USER')")
#RequestMapping(value = "/userDash", method = RequestMethod.GET)
public ModelAndView showUserDashboard(#ModelAttribute("myUserData") UserData myUserData,
#RequestParam(required = false) String firstName,
#RequestParam(required = false) String secondName,
HttpServletRequest request) throws SQLException, InstantiationException, IllegalAccessException {
...
return modelAndView;
}
This is my SecurityConfig.class :
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
#Configuration
#EnableGlobalMethodSecurity(prePostEnabled = true)
#Order(SecurityProperties.ACCESS_OVERRIDE_ORDER)
class SecurityConfig extends WebSecurityConfigurerAdapter {
#Autowired
private UserDetailsService userDetailsService;
#Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/resources/**");
}
#Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/", "/home", "/userLogin", "/dashboards", "/saveUser").permitAll()
.antMatchers("/adminDash").hasAuthority("ADMIN")
.antMatchers("/userDash").hasAuthority("USER")
.anyRequest().fullyAuthenticated()
.and()
.formLogin()
.loginPage("/")
.usernameParameter("email")
.passwordParameter("password")
.failureUrl("/loginProblems")
.permitAll()
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/accountLogout"));
}
#Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth
.userDetailsService(userDetailsService)
.passwordEncoder(new BCryptPasswordEncoder());
}
}
pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
WHY Once admin or users after login, they can not get on their dashboards.
It happens because user wasn't authenticated properly, in fact for a Spring Security, user is still not authenticated.
When you're using Spring Security, it should authenticate users (by finding user in the database, comparing passwords, assigning roles and so on). But you're trying to authenticate users by your own code (in /userLogin).

#ViewScoped beans are not supported on stateless views

I have a page in JSF:
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:param name="navLinkActive" value="poiAdder"/>
<ui:define name="content">
<h:outputStylesheet library="clock" name="clockpicker.css"/>
<h:outputScript library="clock" name="clockpicker.js"/>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script>
<div class="col-md-12">
<ui:include src="/WEB-INF/lego/leftMenu.xhtml"/>
<div class="col-md-10">
<h:form id="poiForm" prependId="false" enctype="multipart/form-data">
<div class="col-md-6">
<h:outputLabel for="address"
value="Adres"/>
<h:inputText id="address"
styleClass="col-md-10"
value="#{poiAdderBean.poi.address}"
requiredMessage="#{msg.fieldRequired}"
required="true"/>
<input type="button"
class="btn btn-default"
value="#{msg.findAddress}"
onclick="codeAddress()"/>
<h:message for="address" style="display: block; color:red"/>
<h:outputLabel for="longitude"
value="Współrzędne (automatycznie)"/>
<h:outputLabel for="latitude"
styleClass="descriptionLabel"
value="podaj adres, a potem wybierz dokładną lokalizację na mapie, jeśli potrzebne"/>
<div class="col-md-12">
<h:inputText id="longitude"
styleClass="col-md-4 col-md-offset-2"
required="true"
requiredMessage="#{msg.fieldRequired}"
value="#{poiAdderBean.poi.longitude}"
converter="javax.faces.Double">
</h:inputText>
<h:inputText id="latitude"
styleClass="col-md-4"
required="true"
requiredMessage="#{msg.fieldRequired}"
value="#{poiAdderBean.poi.latitude}"
converter="javax.faces.Double">
</h:inputText>
</div>
<h:message for="latitude" style="display: block; color:red"/>
<h:message for="longitude" style="display: block; color:red"/>
<h:outputLabel for="poiTypeSelector"
value="Wybierz kategorię POI"/>
<h:selectOneMenu id="poiTypeSelector"
styleClass="btn"
value="#{poiAdderBean.poi.poiCategory}">
<f:selectItems value="#{poiAdderBean.poiCategoryList}"
var="poiCat"
itemLabel="#{msg['poi'.concat(poiCat)]}"
itemValue="#{poiCat}"/>
</h:selectOneMenu>
<h:outputLabel for="phoneNumber"
value="#{msg.phoneNumber}"/>
<h:inputText id="phoneNumber"
style="width: 350px"
value="#{poiAdderBean.poi.phone}"
validator="#{PhoneValidator.validate}">
</h:inputText>
<h:message for="phoneNumber" style="display: block; color:red"/>
<h:outputLabel for="linkwww1"
value="Link www #1"/>
<h:inputText id="linkwww1"
style="width: 350px"
value="#{poiAdderBean.poi.link}">
<f:validator validatorId="linkValidator"/>
<f:attribute name="linkDescritpion" value="#{description1}"/>
</h:inputText>
<h:message for="linkwww1" style="display: block; color:red"/>
<h:outputLabel for="linkwww1Description"
value="Opis #1"/>
<h:inputText id="linkwww1Description"
binding="#{description1}"
style="width: 350px"
value="#{poiAdderBean.poi.linkDescription}">
</h:inputText>
<h:message for="linkwww1Description" style="display: block; color:red"/>
<h:outputLabel for="linkwww2"
value="Link www #2"/>
<h:inputText id="linkwww2"
style="width: 350px"
value="#{poiAdderBean.poi.link2}">
<f:validator validatorId="linkValidator"/>
<f:attribute name="linkDescritpion" value="#{description2}"/>
</h:inputText>
<h:message for="linkwww2" style="display: block; color:red"/>
<h:outputLabel for="linkwww2Description"
value="Opis #2"/>
<h:inputText id="linkwww2Description"
binding="#{description2}"
style="width: 350px"
value="#{poiAdderBean.poi.link2Description}">
</h:inputText>
<h:message for="linkwww2Description" style="display: block; color:red"/>
<h:outputLabel value="#{msg.openingHours}"/>
<div class="col-md-12">
<div class="col-md-6">
<div class="input-group clockpicker">
<span class="input-group-addon" id="from">DO</span>
<h:inputText styleClass="form-control"
id="clockInputStart"
value="#{poiAdderBean.poi.openHoursStart}">
</h:inputText>
<span class="input-group-addon" id="timeFrom">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
<div class="col-md-6">
<div class="input-group clockpicker">
<span class="input-group-addon" id="to">DO</span>
<h:inputText styleClass="form-control"
id="clockInputStop"
value="#{poiAdderBean.poi.openHoursStop}">
</h:inputText>
<span class="input-group-addon" id="timeTo">
<span class="glyphicon glyphicon-time"></span>
</span>
</div>
</div>
</div>
<div class="col-md-12">
<h:outputLabel for="disableAccess"
value="#{msg.disableAccess}"/>
<h:selectBooleanCheckbox id="disableAccess"
value="#{poiAdderBean.poi.disableAccess}">
</h:selectBooleanCheckbox>
</div>
<div class="col-md-6">
<h:outputLabel for="titlePl" value="#{msg.polishTitle}"/>
<h:inputText id="titlePl"
value="#{poiAdderBean.polish.title}"
required="true"
requiredMessage="#{msg.fieldRequired}"/>
<h:message for="titlePl" style="display: block; color:red"/>
</div>
<div class="col-md-6">
<h:outputLabel for="titleEng" value="#{msg.englishTitle}"/>
<h:inputText id="titleEng"
value="#{poiAdderBean.english.title}"
required="true"
requiredMessage="#{msg.fieldRequired}"/>
<h:message for="titleEng" style="display: block; color:red"/>
</div>
<div class="col-md-6">
<h:outputLabel for="descriptionPl" value="#{msg.descriptionPl}"/>
<h:inputTextarea id="descriptionPl"
value="#{poiAdderBean.polish.description}"
style="resize: none"
required="true"
styleClass="form-control"
rows="4"
requiredMessage="#{msg.fieldRequired}"/>
<h:message for="descriptionPl" style="display: block; color:red"/>
</div>
<div class="col-md-6">
<h:outputLabel for="descriptionEng" value="#{msg.descriptionEn}"/>
<h:inputTextarea id="descriptionEng"
value="#{poiAdderBean.english.description}"
required="true"
style="resize: none"
styleClass="form-control"
rows="4"
requiredMessage="#{msg.description}"/>
<h:message for="descriptionEng" style="display: block; color:red"/>
</div>
<div class="col-md-6">
<h:inputFile styleClass="btn btn-default" id="file" value="#{poiAdderBean.uploadedFile}">
<f:ajax listener="#{poiAdderBean.uploadFile()}" execute="#this"/>
</h:inputFile>
</div>
</div>
<div class="col-md-6">
<div id="map-canvas" style="height: 600px;"></div>
</div>
<div class="col-md-12 loginSubmit">
<h:commandButton styleClass="btnDefault"
style="margin-top: 50px"
value="#{msg.add}"
action="#{poiAdderBean.createPoi}">
</h:commandButton>
</div>
</h:form>
</div>
</div>
<script type="text/javascript">
// <![CDATA[
$('.clockpicker').clockpicker({
placement: 'bottom',
align: 'left',
autoclose: true,
'default': 'now'
});
var map;
var marker;
var geocoder;
google.maps.event.addDomListener(window, 'load', initialize);
function initialize() {
geocoder = new google.maps.Geocoder();
var mapOptions = {
zoom: 13,
center: new google.maps.LatLng(50.05923273190915, 19.92233544588089)
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
google.maps.event.addListener(map, 'click', function (event) {
setLatLong(event.latLng);
makeMarker(map, event.latLng);
codeLatLng(event.latLng);
}); //end addListener
}
function makeMarker(map, latLong) {
if (marker != null) {
marker.setMap(null);
}
marker = new google.maps.Marker({
position: latLong,
map: map
});
}
function codeAddress() {
var address = document.getElementById("address").value;
if (address != null && address != "") {
geocoder.geocode({'address': address}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var location = results[0].geometry.location;
map.setCenter(location);
map.setZoom(18);
makeMarker(map, location);
setLatLong(location);
}
else {
alert("Geocode was not successful for the following reason: " + status);
}
});
} else {
alert("Nie podano adresu");
}
}
function codeLatLng(latLng) {
geocoder.geocode({
'latLng': latLng
}, function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
if (results[0]) {
document.getElementById("address").value = results[0].formatted_address;
console.log(results[0]);
} else {
alert('No results found');
}
} else {
alert('Geocoder failed due to: ' + status);
}
});
}
function setLatLong(location) {
document.getElementById("longitude").value = location.lng();
document.getElementById("latitude").value = location.lat();
}
//]]>
</script>
</ui:define>
</ui:composition>
and bean for this page:
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.Part;
import java.io.*;
#Named("poiAdderBean")
#SessionScoped
public class PoiAdderBean implements Serializable {
#Inject
PrincipalBean principalBean;
#Inject
#Created
Event<Poi> poiCreated;
private Poi poi;
private Translation polish;
private Translation english;
private Part uploadedFile;
private Image image;
public void uploadFile() {
image = new Image();
byte[] bytes = new byte[0];
if (uploadedFile!= null) {
try {
InputStream is = uploadedFile.getInputStream();
if (is != null) {
bytes = IOUtils.toByteArray(is);
is.close();
}
} catch (IOException e) {
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR,
"error uploading file",
null);
FacesContext.getCurrentInstance().addMessage(null, msg);
}
}
image.setContent(bytes);
image.setContentType(uploadedFile.getContentType());
}
public Part getUploadedFile() {
return uploadedFile;
}
public void setUploadedFile(Part uploadedFile) {
this.uploadedFile = uploadedFile;
}
public Poi getPoi() {
return poi;
}
public void setPoi(Poi poi) {
this.poi = poi;
}
public Translation getPolish() {
return polish;
}
public void setPolish(Translation polish) {
this.polish = polish;
}
public Translation getEnglish() {
return english;
}
public void setEnglish(Translation english) {
this.english = english;
}
public PoiCategory[] getPoiCategoryList(){
return PoiCategory.values();
}
#PostConstruct
public void init(){
poi = new Poi();
polish = new Translation(Language.PL, Status.READY);
english = new Translation(Language.EN, Status.READY);
}
public String createPoi(){
english.setAuthor(principalBean.getLoggedUser());
polish.setAuthor(principalBean.getLoggedUser());
poi.addTranslation(polish);
poi.addTranslation(english);
polish.setPoi(poi);
english.setPoi(poi);
if(image != null){
poi.setImage(principalBean.getDataAccess().mergeEntity(image));
}
principalBean.getDataAccess().mergeEntity(poi);
poiCreated.fire(poi);
return "/secure/poiTranslator.xhtml?faces-redirect=true";
}
}
For some completely strange and unknown to me reason, there is always error message on a bottom of a page that says:
#ViewScoped beans are not supported on stateless views
but this is clearly #SessionScoped bean. I can't find source of this error, that's why I posted entire code.
PLUS - when I don't upload a file - validation works just fine, and after successfully writing Poi object in database, page is redirected to poiTranslator page, just like it should. BUT when I add image - validation don't work, and page is not redirected - but objects are stored correctly in database.
Thanks for any help
Thanks to #Gimby I found small error in my template file.
Like in post from BalusC blog he posted, in my template was line that was enabling statelessness - which was not wanted in first place.
Thanks for help.
link to BalusC artickle

JSF APPLY_REQUEST_VALUES lifecycle not call during POST request process

I create JSF form with Jquery Diaolg. When I submit my form , the request doesn't invoke my bean method on first click but calls it at second click. I implement a PhaseListener to debug and found out that during first click only RESTORE_VIEW and RENDER_RESPONSE were called. My Question is what can cause this.
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:forseti="http://xmlns.jcp.org/jsf/composite/components"
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<ui:composition >
<div jsf:id="modal-wizard-edit" class="modal">
<div id="user-profile-3" class="modal-dialog">
<div class="modal-content" style="width:800px;">
<div id="modal-content">
<form class="form-horizontal" jsf:id="personne-morale-edit-form" jsf:prependId="false">
<div class="modal-header no-padding">
<div class="table-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
<span class="white">×</span>
</button>
Results for "Latest Registered Domains
</div>
</div>
<div class="tabbable" style="margin-top: 20px; margin-left: 20px;margin-right: 20px; margin-bottom: 20px;">
<ul class="nav nav-tabs padding-16">
<li class="active">
<a data-toggle="tab" href="#edit-basic">
<i class="green ace-icon fa fa-pencil-square-o bigger-125"></i>
Etat civil/Identité
</a>
</li>
</ul>
<div class="tab-content profile-edit-tab-content">
<div id="edit-basic" class="tab-pane in active">
<div class="row">
<div class="col-xs-6 col-lg-6 col-md-6 col-sm-6">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="edit-raison-sociale">Raison sociale:</label>
<div class="col-xs-12 col-sm-9">
<input id="edit-raison-sociale" type="text" jsf:value="#{personneMoraleBean.selectedPersonneMorale.raisonSociale}"/>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="edit-ifu">IFU:</label>
<div class="col-xs-12 col-sm-9">
<input id="edit-ifu" type="text" jsf:value="#{personneMoraleBean.selectedPersonneMorale.ifu}"/>
</div>
</div>
</div>
<div class="col-xs-6 col-lg-6 col-md-6 col-sm-6">
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="nature_juridique_edit">Nature juridique:</label>
<div class="col-xs-12 col-sm-9">
<h:selectOneMenu class="chosen-select" id="nature_juridique_edit" value="#{personneMoraleBean.selectedPersonneMorale.natureJuridique}" p:data-placeholder="#{bundle.champNatureAffaireClassification}" required="true" >
<f:selectItem itemValue="" itemLabel="" />
<f:selectItems value="#{personneMoraleBean.listeNatureJuridiques}" var="item" itemValue="#{item}" itemLabel="#{item.libelle}" />
<f:converter converterId="natureJuridiqueConverter" />
</h:selectOneMenu>
</div>
<script src="../../resources/components/chosen.jquery.min.js"></script>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="secteur_edit">Secteurs d'activités:</label>
<div class="col-xs-12 col-sm-9">
<h:selectManyListbox class="multiselect" id="secteur_edit" value="#{personneMoraleBean.selectedPersonneMorale.secteurs}" p:data-placeholder="#{bundle.champNatureAffaireClassification}" p:multiple="" required="true" >
<f:selectItems value="#{personneMoraleBean.listeSecteurActivites}" var="item"
itemLabel="#{item.libelle}" itemValue="#{item}"/>
<f:converter converterId="secteurActiviteConverter"/>
</h:selectManyListbox>
</div>
</div>
<script src="../../resources/js/bootstrap-multiselect.min.js"></script>
<script type="text/javascript">
$('#secteur_edit').multiselect({
enableFiltering: true,
buttonClass: 'btn btn-white btn-primary',
templates: {
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"></button>',
ul: '<ul class="multiselect-container dropdown-menu"></ul>',
filter: '<li class="multiselect-item filter"><div class="input-group"><span class="input-group-addon"><i class="fa fa-search"></i></span><input class="form-control multiselect-search" type="text"/></div></li>',
filterClearBtn: '<span class="input-group-btn"><button class="btn btn-default btn-white btn-grey multiselect-clear-filter" type="button"><i class="fa fa-times-circle red2"></i></button></span>',
li: '<li><label></label></li>',
divider: '<li class="multiselect-item divider"></li>',
liGroup: '<li class="multiselect-item group"><label class="multiselect-group"></label></li>'
}
});
</script>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="telephone_edit">Telephone:</label>
<div class="col-xs-12 col-sm-9">
<forseti:phoneNumber id="telephone_edit" value="#{personneMoraleBean.selectedPersonneMorale.telephone}"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row" style="margin-top: 20px; margin-left: 20px;margin-right: 20px; margin-bottom: 20px;">
<div class="clearfix col-sm-12 ">
<button type="submit" jsf:id="submit-morale-edit" class="btn btn-primary btn-block" jsf:action="#{personneMoraleBean.doEdit}">
Block Button
</button>
</div>
</div>
</form>
</div>
</div><!-- /.span -->
</div><!-- /.user-profile -->
</div><!-- PAGE CONTENT ENDS -->
<script type="text/javascript">
function ajaxMonitoringFinishEdit(data) {
if (data.status == "success") {
$('#modal-wizard-edit').modal('hide');
}
}
</script>
</ui:composition>
</html>
This is my form code source
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package forseti.controller.personne;
import forseti.ejb.NatureJuridiqueFacade;
import forseti.ejb.PersonneMoraleFacade;
import forseti.ejb.SecteurActiviteFacade;
import forseti.jpa.personne.NatureJuridique;
import forseti.jpa.personne.PersonneMorale;
import forseti.jpa.personne.SecteurActivite;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.event.ActionEvent;
import javax.inject.Named;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
/**
*
* #author Gildasdarex
*/
#Named(value = "personneMoraleBean")
#ViewScoped
public class PersonneMoraleBean implements Serializable {
/**
* Creates a new instance of PersonneMoraleBean
*/
#Inject
private PersonneMoraleFacade personneMoraleFacade;
#Inject
private SecteurActiviteFacade secteurActiviteFacade;
#Inject
private NatureJuridiqueFacade natureJuridiqueFacade;
private PersonneMorale newPersonneMorale;
private PersonneMorale selectedPersonneMorale;
private List<PersonneMorale> listePersonneMorales;
private SecteurActivite selectedSecteurActivite;
public PersonneMoraleBean() {
}
#PostConstruct
public void init() {
newPersonneMorale = new PersonneMorale();
selectedPersonneMorale = new PersonneMorale();
}
public PersonneMorale getNewPersonneMorale() {
return newPersonneMorale;
}
public void setNewPersonneMorale(PersonneMorale newPersonneMorale) {
this.newPersonneMorale = newPersonneMorale;
}
public PersonneMorale getSelectedPersonneMorale() {
return selectedPersonneMorale;
}
public void setSelectedPersonneMorale(PersonneMorale selectedPersonneMorale) {
this.selectedPersonneMorale = selectedPersonneMorale;
}
public List<PersonneMorale> getListePersonneMorales() {
listePersonneMorales = personneMoraleFacade.findAll();
return listePersonneMorales;
}
public List<SecteurActivite> getListeSecteurActivites() {
return secteurActiviteFacade.findAll();
}
public List<NatureJuridique> getListeNatureJuridiques() {
return natureJuridiqueFacade.findAll();
}
public SecteurActivite getSelectedSecteurActivite() {
return selectedSecteurActivite;
}
public void setSelectedSecteurActivite(SecteurActivite selectedSecteurActivite) {
this.selectedSecteurActivite = selectedSecteurActivite;
}
public void doCreate() {
newPersonneMorale.setId(newPersonneMorale.getIfu());
personneMoraleFacade.create(newPersonneMorale);
listePersonneMorales = personneMoraleFacade.findAll();
}
public void doDel() {
personneMoraleFacade.remove(selectedPersonneMorale);
}
public void doEdit() {
System.out.println("edit "+selectedPersonneMorale.getId());
System.out.println("edit "+selectedPersonneMorale.getIfu());
System.out.println(selectedPersonneMorale.getRaisonSociale());
System.out.println(selectedPersonneMorale.getNatureJuridique());
System.out.println(selectedPersonneMorale.getSecteurs().size());
personneMoraleFacade.edit(selectedPersonneMorale);
}
public void doRemoveSecteur() {
selectedPersonneMorale.getSecteurs().remove(selectedSecteurActivite);
personneMoraleFacade.edit(selectedPersonneMorale);
listePersonneMorales = personneMoraleFacade.findAll();
}
public void passItemMoraleSecteur(PersonneMorale personneMorale, SecteurActivite secteurActivite) {
selectedPersonneMorale = personneMorale;
selectedSecteurActivite = secteurActivite;
}
public void passItem(PersonneMorale item) {
selectedPersonneMorale = item;
System.out.println("getItem "+selectedPersonneMorale.getId());
}
}

Resources