[jboss-user] [JBoss Tools] - activate a Modalpanel with commandbutton
yasser zairi
do-not-reply at jboss.com
Wed Jul 20 11:41:25 EDT 2011
yasser zairi [http://community.jboss.org/people/yasser_z] created the discussion
"activate a Modalpanel with commandbutton"
To view the discussion, visit: http://community.jboss.org/message/616468#616468
--------------------------------------------------------------
Hi,
i want to activate a modalPanel from a Commandbutton but it seem that is sth wrong .
_______________________________________________________________________________________
here is the code of the ModalPanel with the commandbutton ::
<a4j:commandbutton value="Modifier" ajaxSingle="true" id="editlink"
oncomplete="#{rich:component('editPanel')}.show()" action="#{valeursMBean.viwDetail}" />
<rich:modalPanel id="editPanel" autosized="true" width="450">
<f:facet name="header">
<h:outputText value="Modifier la valeur mobiliere actuelle :" />
</f:facet>
<f:facet name="controls">
<h:panelGroup>
<h:graphicImage value="../style/close.jpeg" id="hidelink"
styleClass="hidelink" />
<rich:componentControl for="editPanel" attachTo="hidelink"
operation="hide" event="onclick" />
</h:panelGroup>
</f:facet>
<h:form>
<rich:messages style="color:red;"></rich:messages>
<h:panelGrid columns="1">
<a4j:outputPanel ajaxRendered="true">
<h:panelGrid columns="2">
<h:outputLabel value="CodeIsin" for="codeIsin" />
<h:inputText id="codeIsin"
value="#{valeursMBean.currentItem.codeIsin}" />
<h:outputLabel value="Categorie" for="categorie" />
<h:inputText id="categorie"
value="#{valeursMBean.currentItem.categorie}" />
<h:outputLabel value="Denomination" for="denomination" />
<h:inputText id="denomination"
value="#{valeursMBean.currentItem.denomination}" />
<h:outputLabel value="Date Echeance" for="dateEcheance" />
<h:inputText id="dateEcheance"
value="#{valeursMBean.currentItem.dateEcheance}" />
<h:outputLabel value="Etat" for="etat" />
<h:inputText id="etat" value="#{valeursMBean.currentItem.etat}"/>
</h:panelGrid>
<rich:message showSummary="true" showDetail="false" for="etat" />
</a4j:outputPanel>
<a4j:commandButton value="Enregistrer"
action="#{valeursMBean.update}"
reRender="codeIsin, categorie, etat, denomination, dateEcheance"
oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.hide();" />
</h:panelGrid>
</h:form>
</rich:modalPanel>
_______________________________________________________________________________________________
and here is my Bean ::
package cdvm.surv.web;
import java.io.Serializable;
import java.util.Iterator;
import java.util.List;
import javax.annotation.PostConstruct;
import org.richfaces.component.html.HtmlScrollableDataTable;
import org.richfaces.model.ScrollableTableDataModel.SimpleRowKey;
import org.richfaces.model.selection.Selection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import cdvm.surv.model.ValeurRef;
import cdvm.surv.service.ValeurRefService;
@Component("valeursMBean")
@Scope("session")
public class ValeursMBean implements Serializable {
@Autowired
private transient ValeurRefService valeurefService;
private transient HtmlScrollableDataTable valeurTable;
private List<ValeurRef> valeurefList;
private ValeurRef currentItem;
@PostConstruct
public void init(){
valeurefList = valeurefService.find();
}
public String update(){
valeurefService.save(currentItem);
init();
return null;
}
public void viewDetail(){
List<ValeurRef> valueList=(List<ValeurRef>) valeurTable.getValue();
Selection sl = valeurTable.getSelection();
Iterator<Object> keys= sl.getKeys();
if(keys.hasNext()){
//SimpleRowKey ky = (SimpleRowKey)keys.next();
currentItem=valueList.get((Integer)keys.next());
System.out.println(currentItem.getCodeIsin());
}
}
// Getter and Setter
public ValeurRef getCurrentItem() {
return currentItem;
}
public void setCurrentItem(ValeurRef currentItem) {
this.currentItem = currentItem;
}
public HtmlScrollableDataTable getValeurTable() {
return valeurTable;
}
public void setValeurTable(HtmlScrollableDataTable valeurTable) {
this.valeurTable = valeurTable;
}
public List<ValeurRef> getValeurefList() {
return valeurefList;
}
public void setValeurefList(List<ValeurRef> valeurefList) {
this.valeurefList = valeurefList;
}
}
________________________________________________________________________________
the error that i get is ::
javax.el.PropertyNotFoundException: /GestionRef/Grid.jsp @86,56 value="#{valeursMBean.currentItem.codeIsin}": Target Unreachable, 'currentItem' returned null
com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
javax.faces.component.UIInput.getConvertedValue(UIInput.java:936)
javax.faces.component.UIInput.validate(UIInput.java:861)
javax.faces.component.UIInput.executeValidate(UIInput.java:1071)
javax.faces.component.UIInput.processValidators(UIInput.java:663)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
javax.faces.component.UIForm.processValidators(UIForm.java:229)
javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1040)
javax.faces.component.UIInput.processValidators(UIInput.java:661)
javax.faces.component.UIForm.processValidators(UIForm.java:229)
org.ajax4jsf.component.AjaxViewRoot$3.invokeContextCallback(AjaxViewRoot.java:447)
org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:240)
org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:463)
com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
i'll be thankful for any suggestions
thanks in advance
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/616468#616468]
Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2128]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110720/a28471c4/attachment-0001.html
More information about the jboss-user
mailing list