I have a Spring application, in which CRUD operation is being performed. I am unable to fetch data from database using JSP ${tempClients.firstName}
code. The browser keeps printing the same code as I have written in the JSP file. I have connectivity with Database. Which are of code should I consider to check? The console is not throwing any errors.
<c:forEach var="tempClients" items="${clientsModel}">
<tr>
<td class="trtd">${tempClients.firstName}</td>
<td class="trtd">${tempClients.lastName}</td>
<td class="trtd">${tempClients.email}</td>
<td class="trtd">${tempClients.mobileNumber}</td>
<td class="trtd">${tempClients.city}</td>
<td class="trtd">${tempClients.country}</td>
<td class="trtd">${tempClients.domain}</td>
</tr>
</c:forEach>
Entity Class:
@Entity
@Table(name="clients")
public class Clients {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="first_name")
private String firstName;
@Column(name="last_name")
private String lastName;
@Column(name="email")
private String email;
@Column(name="mobilenumber")
private String mobileNumber;
@Column(name="city")
private String city;
@Column(name="country")
private String country;
@Column(name="domain")
private String domain;
@Column(name="requirments")
private String requirments;
@Column(name="startdate")
private Date startDate;
@Column(name="enddate")
private Date endDate;
// Getters and Setters
}
Output in Web-Browser
Output :
Does your JSP page prints the ${tempClients.firstName}?
which may mean your JSP page is ignoring the el expression.
try this
<%@ page isELIgnored="false" %>
You can also add the following to your web.xml to enable it for all pages:
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<el-enabled>true</el-enabled>
<scripting-enabled>true</scripting-enabled>
</jsp-property-group>
</jsp-config>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.