Note that there are some explanatory texts on larger screens.

plurals
  1. POJSF selectOneMenu value not set
    primarykey
    data
    text
    <p>I have a page where a SelectOneMenu is rendered whether there is some info on DB or not. My form looks like this:</p> <pre><code>... &lt;h:form id="wrapperUpload" enctype="multipart/form-data" &gt; &lt;h:outputLabel for="option" value="Tipo de carga: " rendered="#{uploadFile.check(userVerifier.dependencia)}" /&gt; &lt;h:selectOneMenu id="option" value="#{uploadFile.optionSelected}" rendered="#{uploadFile.check(userVerifier.dependencia)}" &gt; &lt;f:selectItems value="#{uploadFile.options}" /&gt; &lt;/h:selectOneMenu&gt; &lt;h:outputLabel for="upfile" value="Archivo: " /&gt; &lt;t:inputFileUpload id="upfile" required="true" value="#{uploadFile.upFile}" /&gt; &lt;h:commandButton value="Validar #{userVerifier.dependencia}" action="#{uploadFile.upload}" onclick="return confirmation()" &gt; &lt;f:param name="dependencia" value="#{userVerifier.dependencia}" /&gt; &lt;/h:commandButton&gt; &lt;/h:form&gt; ... </code></pre> <p>And my Beans is</p> <pre><code>private UploadedFile upFile; private boolean showOptions = false; private final String[] options = { "Seleccione una opción.", "Cargar toda la información.", "Cargar solo información errónea." }; private String optionSelected; private Database db = new Database(); public UploadedFile getUpFile() { return upFile; } public void setUpFile(UploadedFile upFile) { this.upFile = upFile; } public String[] getOptions() { return options; } public void setOptionSelected(String optionSelected) { this.optionSelected = optionSelected; } public String getOptionSelected() { return optionSelected; } public boolean check(String dependencia) { String hasInfo; hasInfo = db.checkForInfo(dependencia); if (hasInfo.equals("T")) { showOptions = true; } else { showOptions = false; } return showOptions; } public String upload() { byte[] buffer = null; int count = 0; File serverFile = null; InputStream input = null; OutputStream output = null; Map&lt;String, String&gt; params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String dependencia = params.get("dependencia"); String extension = FilenameUtils.getExtension(upFile.getName()); System.out.println("__depend: " + dependencia); System.out.println("__option: " + optionSelected); //null ... ... </code></pre> <p>Finally when I hit the button the value of SelectOneMenu (or selectedOption in my bean) is always null... How to fix this? Am I missing something?</p> <p>Forgot to mention that, if I delete the render part everything works fine...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload