小编smi*_*kce的帖子

javax.el.PropertyNotWritableException:集合操作的非法语法

我正在JSF的学校做一个项目,我几乎没有问题.

首先,当我想通过推送将自己重定向到项目的另一个页面时,h:commandButton无法正常工作.显示错误:

javax.el.PropertyNotWritableException:集合操作的非法语法

的index.jsp:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>  
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>  

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core">
  <head>
<title>Firma Komputerowa - Baza Danych</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/resources/table-style.css" />
  </head>
     <body>
       <f:view>
         <h:form>   
        <h:panelGrid columns="3">
     <h:commandButton action="#{producentBean.redirect }" value="Dodaj"/>
</h:panelGrid>
<h:panelGrid>
    <h:dataTable value="#{producentBean.List}" var="p" 
                styleClass="order-table"
                headerClass="order-table-header"
                rowClasses="order-table-odd-row,order-table-even-row" border="1" > 
        <h:column>
            <f:facet name="header">ID producenta</f:facet>
            <h:inputText value="#{p.getId}"/>
        </h:column>

        <h:column>
            <f:facet name="header">Nazwa producenta</f:facet>
            <h:inputText value="#{p.getNazwa}" /> …
Run Code Online (Sandbox Code Playgroud)

jsf

11
推荐指数
1
解决办法
4万
查看次数

使用SelectOneMenu在JSF(PrimeFaces)中转换:验证错误

我正在使用PrimeFaces在JSF中创建一个项目,我遇到了一个问题<p:SelectOneMenu>,特别是将一个对象的选定值转换为String.我已经编写了必需的Converter类,实现toString()equals()方法,我认为非常正确.然而,在一个<h:messages />组件中,它无休止地给了我:

j_idt7:j_idt92: Validation Error: Value is not valid
j_idt7:j_idt98: Validation Error: Value is not valid

我必须选择属于一个较大形式的值.然后,根据所选的所有者(właściciel)和公司(firma),我将它们添加到数据库中.

这是我的<p:SelectOneMenu>(两次 - 两个菜单):

<p:selectOneMenu value="#{wniosek.selectedWl}" var="w">
<f:selectItem itemLabel="Wybierz" itemValue=""/>
   <f:selectItems value="#{wniosek.listaWl}" var="wlasciciel" 
      itemLabel="#{wlasciciel.nazwisko}" itemValue="#{wlasciciel}" />

      <p:column>
          #{w.nazwisko}
      </p:column>
      <f:converter converterId="WlascicielConverter" />
</p:selectOneMenu>                      
 <h:outputText value="Nazwa firmy: "/>

 <p:selectOneMenu value="#{wniosek.selectedFi}"  var="f">
      <f:selectItem itemLabel="Wybierz" itemValue=""/>
      <f:selectItems value="#{wniosek.listaFi}" var="firma" 
           itemLabel="#{firma.nazwa}" itemValue="#{firma}" />
      <f:converter converterId="FirmaConverter" />
      <p:column>
           #{f.nazwa}
      </p:column>
 </p:selectOneMenu>
Run Code Online (Sandbox Code Playgroud)

这是我所有者的转换器类<p:SelectOneMenu>(同样我已经完成了公司的一个):

public class WlascicielConverter implements Converter …
Run Code Online (Sandbox Code Playgroud)

validation jsf converter selectonemenu

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

jsf ×2

converter ×1

selectonemenu ×1

validation ×1