2013-11-14 53 views
0

Im與Spring一起新增,並且Iam有此例外。Bean類的Bean屬性的無效屬性不可讀或具有無效的getter方法

我有一個jsp,有很多選擇。他們都工作得很好,但一個顯示這個例外:

org.apache.jasper.JasperException: Ha sucedido una excepción al procesar la página JSP /WEB-INF/pages/nuevo-expediente.jsp en línea 45 

42:      <td> 
43:       <form:select path="expedientePadre.codExpediente"> 
44:        <form:option value="-" label="Seleccione un  expediente"/> 
45:        <form:options items="${expedientes}" itemLabel="codExpediente" itemValue="codExpediente"/> 
46:       </form:select> 
47:       <form:errors path="expedientePadre" element="span"/> 
48:      </td> 

org.springframework.beans.NotReadablePropertyException: Invalid property 'codExpediente' of bean class [com.atlantis.atecliente.model.TipoExpediente]: Bean property 'codExpediente' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? 

即時通訊實施selct同樣的方式其他工作正常。在這裏,JSP代碼:

  <tr> 
       <td>Expediente padre:</td> 
       <td> 
        <form:select path="expedientePadre.codExpediente"> 
         <form:option value="-" label="Seleccione un expediente"/> 
         <form:options items="${expedientes}" itemLabel="codExpediente" itemValue="codExpediente"/> 
        </form:select> 
        <form:errors path="expedientePadre" element="span"/> 
       </td> 
      </tr> 

這裏控制器:

@RequestMapping(value = "nuevo-expediente") 
public String createExpedienteGet(Model model) { 
    model.addAttribute("expediente", new Expediente()); 
    model.addAttribute("expedienteP", new Expediente()); 
    List<TipoResolucion> resoluciones = service.getResoluciones(); 
    List<TipoExpediente> listaTipos = service.getTipos(); 
    List<EstadoExpediente> listaEstados = service.getEstados(); 
    List<Expediente> listaExpedientes = service.getExpedientes(); 
    List<TipoRelacion> listaRelaciones = service.getRelaciones(); 
    List<CanalExpediente> listaCanales = service.getCanales(); 
    List<IdiomaExpediente> listaIdiomas = service.getIdiomas(); 
    model.addAttribute("resoluciones", resoluciones); 
    model.addAttribute("tipos", listaTipos); 
    model.addAttribute("estados", listaEstados); 
    model.addAttribute("expedientes", listaExpedientes); 
    model.addAttribute("tiposRelacion", listaRelaciones); 
    model.addAttribute("canales", listaCanales); 
    model.addAttribute("idiomas", listaIdiomas); 
    return "nuevo-expediente"; 
} 

@RequestMapping(value = "nuevo-expediente", method = RequestMethod.POST) 
public String createExpedientePost(@ModelAttribute("expediente") Expediente expediente, BindingResult result) { 
    service.createExpediente(expediente); 
    return "redirect:expedientes"; 
} 

這裏,實體Expediente:

@Entity 
@Table(name="Expediente") 
public class Expediente implements Serializable { 
@Id 
@Column(length = 15) 
private String codExpediente; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "tipoExpediente") 
private TipoExpediente tipoExpediente; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "estadoExpediente") 
private EstadoExpediente estadoExpediente; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "expedientePadre") 
private Expediente expedientePadre; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "tipoRelacion") 
private TipoRelacion tipoRelacion; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "canalEntrada") 
private CanalExpediente canalEntrada; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "idiomaEntrada") 
private IdiomaExpediente idiomaEntrada; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "idiomaSalida") 
private IdiomaExpediente idiomaSalida; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "tipoResolucion") 
private TipoResolucion tipoResolucion; 

@ManyToOne(cascade={CascadeType.ALL}) 
@JoinColumn(name = "canalSalida") 
private CanalExpediente canalSalida; 

@Column(length = 10) 
private String numeroSerie; 

@Column(length = 10) 
private String numeroHoja; 

@Temporal(javax.persistence.TemporalType.TIMESTAMP) 
private Date fechaRedaccion; 

@Temporal(javax.persistence.TemporalType.TIMESTAMP) 
private Date fechaRecepcion; 

@Column(length = 200) 
private String asunto; 

@Column (length = 1000) 
private String descripcion; 

@Column(length = 20) 
private String usuarioRegistro; 

@Temporal(javax.persistence.TemporalType.TIMESTAMP) 
private Date fechaRegistro; 

@Column (length = 20) 
private String usuarioModificacion; 

@Temporal(javax.persistence.TemporalType.TIMESTAMP) 
private Date fechaModificacion; 

@Column (length = 20) 
private String usuarioCierre; 

@Temporal(javax.persistence.TemporalType.TIMESTAMP) 
private Date fechaCierre; 

public String getCodExpediente() { 
    return codExpediente; 
} 

public void setCodExpediente(String codExpediente) { 
    this.codExpediente = codExpediente; 
} 

............................ 
............................ 

最後的TipoExpediente實體

package com.atlantis.atecliente.model; 

import java.io.Serializable; 
import javax.persistence.*; 

@Entity 
@Table 
public class TipoExpediente implements Serializable { 
@Id 
@Column(length = 40) 
private String tipo; 

public String getTipo() { 
    return tipo; 
} 

public void setTipo(String tipo) { 
    this.tipo = tipo; 
} 
} 

我想它可能發生,因爲th e expedientePadre財產,是同一個實體Expediente的外鍵,但我不知道解決它...

有些幫助嗎?謝謝!

+0

向我們展示您的'TipoExpediente'類。 –

+0

我已經添加了這個類。謝謝 – alberph

回答

0

我認爲問題在於您的類TipExpediente類沒有屬性codExpedient的getter或setter方法。 Spring正在查看您的TipoExpediente類,並期望它擁有您在JSP中概述的屬性。

相關問題