[jboss-user] [JBoss Seam] - Re: h:commandButton and h:commandLink don't delegate convers
nfeybesse
do-not-reply at jboss.com
Wed Feb 14 13:18:17 EST 2007
I think there is still a bug with <h:selectmanycheckbox> within <h:form enctype="multipart/form-data"> despite http://jira.jboss.org/jira/browse/JBSEAM-706
JBoss 4.0.5 / JSF 1.2 / Seam 1.1.6
Here is an example showing the bug and working without enctype="mulipart/form-data"
| <!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:ui="http://java.sun.com/jsf/facelets"
| xmlns:h="http://java.sun.com/jsf/html"
| xmlns:f="http://java.sun.com/jsf/core">
|
| <head>
| <title>Manycheckbox and multipart error</title>
| </head>
| <body>
| <f:view>
| <div>
| <h:form enctype="multipart/form-data">
| <h:selectManyCheckbox value="#{errorAction.selectedErrors}">
| <f:selectItems value="#{errorItems}" />
| </h:selectManyCheckbox>
| <h:commandButton action="#{errorAction.save}" value="Save"/>
| <h:messages/>
| </h:form>
| </div>
| </f:view>
| </body>
| </html>
|
and POJO :
| package com.genericsystem.error;
|
| import java.io.Serializable;
| import java.util.Arrays;
| import java.util.List;
|
| import javax.faces.model.SelectItem;
|
| import org.jboss.seam.annotations.Factory;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Out;
| import org.jboss.seam.core.FacesMessages;
| import org.jboss.seam.log.Log;
|
| @Name("errorAction")
| public class ErrorAction implements Serializable {
| private static final long serialVersionUID = 7654273335405896287L;
|
| @Logger Log log;
|
| @In(required=false) @Out(required=false)
| List<SelectItem> errorItems;
|
| private List<String> selectedErrors;
|
| public List<String> getSelectedErrors() {
| return (List<String>)Arrays.asList(new String[]{"Error1","Error2"});
| }
|
| public void setSelectedErrors(List<String> selectedErrors) {
| this.selectedErrors = selectedErrors;
| }
|
| @Factory("errorItems")
| public void findErrorItems(){
| errorItems = (List<SelectItem>)Arrays.asList(new SelectItem[]{new SelectItem("Error1","Error1"),
| new SelectItem("Error2","Error2"),new SelectItem("Error3","Error3"),new SelectItem("Error4","Error4")});
| }
|
| public String save(){
| FacesMessages.instance().add("save : ");
| for (String error : selectedErrors){
| log.info("************** selectedError : "+error+" ***************");
| FacesMessages.instance().add("selectedError : "+error);
| }
| return "/error.xhtml";
| }
|
| }
|
|
Best regards
Nicolas
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016511#4016511
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016511
More information about the jboss-user
mailing list