getStringfromObject
Jun 14th, 2010, 05:12 AM
Hi,
I'm quite new to this stuff, so be nice. ^^
I'm trying to put through data of a bean into a jsp page. It's working fine with one exception - from the jsp page the id of the bean object doesn't seem to be visible.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
...
<table class="summary">
<thead>
<tr>
<th>Game</th>
<th>Player</th>
<th>Home</th>
<th>Away</th>
</tr>
</thead>
<tbody>
<c:forEach var="tipp" items="${tippsList}">
<tr>
<td>${tipp.game}</td>
<td>${tipp.player}</td>
<td>${tipp.home}</td>
<td>${tipp.away}</td>
</tr>
</c:forEach>
</tbody>
</table>
The above works perfectly fine.
But when I try to add
<td>${tipp.tippid}</td>
I get the following error:
javax.el.PropertyNotFoundException: Property 'tippid' not found on type org.springframework.webflow.wc.Tipps
Here is the Class Tipps:
package org.springframework.webflow.wc;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "tipps")
public class Tipps implements Serializable {
private int TippID;
private String Player;
private int Game;
private int Home;
private int Away;
@Id
@GeneratedValue
@Column(name = "TippID")
public int getTippID() {
return TippID;
}
public void setTippID(int tippID) {
TippID = tippID;
}
public String getPlayer() {
return Player;
}
public void setPlayer(String player) {
Player = player;
}
public int getGame() {
return Game;
}
public void setGame(int game) {
Game = game;
}
public int getHome() {
return Home;
}
public void setHome(int home) {
Home = home;
}
public int getAway() {
return Away;
}
public void setAway(int away) {
Away = away;
}
@Override
public String toString() {
return "Tipps(" + TippID + "," + Player + "," + Game + "," + Home + "," + Away + ")";
}
}
Is it just a coincidence that the one attribute that doesn't go through is the primary key?
Thanks in advance. :)
I'm quite new to this stuff, so be nice. ^^
I'm trying to put through data of a bean into a jsp page. It's working fine with one exception - from the jsp page the id of the bean object doesn't seem to be visible.
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="security" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
...
<table class="summary">
<thead>
<tr>
<th>Game</th>
<th>Player</th>
<th>Home</th>
<th>Away</th>
</tr>
</thead>
<tbody>
<c:forEach var="tipp" items="${tippsList}">
<tr>
<td>${tipp.game}</td>
<td>${tipp.player}</td>
<td>${tipp.home}</td>
<td>${tipp.away}</td>
</tr>
</c:forEach>
</tbody>
</table>
The above works perfectly fine.
But when I try to add
<td>${tipp.tippid}</td>
I get the following error:
javax.el.PropertyNotFoundException: Property 'tippid' not found on type org.springframework.webflow.wc.Tipps
Here is the Class Tipps:
package org.springframework.webflow.wc;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "tipps")
public class Tipps implements Serializable {
private int TippID;
private String Player;
private int Game;
private int Home;
private int Away;
@Id
@GeneratedValue
@Column(name = "TippID")
public int getTippID() {
return TippID;
}
public void setTippID(int tippID) {
TippID = tippID;
}
public String getPlayer() {
return Player;
}
public void setPlayer(String player) {
Player = player;
}
public int getGame() {
return Game;
}
public void setGame(int game) {
Game = game;
}
public int getHome() {
return Home;
}
public void setHome(int home) {
Home = home;
}
public int getAway() {
return Away;
}
public void setAway(int away) {
Away = away;
}
@Override
public String toString() {
return "Tipps(" + TippID + "," + Player + "," + Game + "," + Home + "," + Away + ")";
}
}
Is it just a coincidence that the one attribute that doesn't go through is the primary key?
Thanks in advance. :)