unable to display data on broswer using spring hibernate.below is my code and outputWrong ordering in generated table in jpaajax jquery url specificationwant to add two different tables(classes) in one hibernate criteriaGenericDAO + Spring + JPA2 no unique beanHibernate: ManyToMany inverse DeleteHow to render partial view in Spring MVCMappingJackson2HttpMessageConverter Can not find a (Map) Key deserializer for typecom.fasterxml.jackson.databind.JsonMappingException: Multiple back-reference properties with name 'defaultReference'org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update&ORA-02289: sequence does not existshow details of all orders placed by customer
How to deal with fear of taking dependencies
Can a planet have a different gravitational pull depending on its location in orbit around its sun?
Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?
Could Giant Ground Sloths have been a good pack animal for the ancient Mayans?
Ideas for 3rd eye abilities
How do I create uniquely male characters?
Domain expired, GoDaddy holds it and is asking more money
Where else does the Shulchan Aruch quote an authority by name?
Unbreakable Formation vs. Cry of the Carnarium
Landing in very high winds
Are white and non-white police officers equally likely to kill black suspects?
Landlord wants to switch my lease to a "Land contract" to "get back at the city"
"My colleague's body is amazing"
How can I plot a Farey diagram?
New order #4: World
Why did the Germans forbid the possession of pet pigeons in Rostov-on-Don in 1941?
Prime joint compound before latex paint?
Typesetting a double Over Dot on top of a symbol
Why was the "bread communication" in the arena of Catching Fire left out in the movie?
Is it wise to focus on putting odd beats on left when playing double bass drums?
Is there a way to make member function NOT callable from constructor?
Was there ever an axiom rendered a theorem?
Shall I use personal or official e-mail account when registering to external websites for work purpose?
Is there any use for defining additional entity types in a SOQL FROM clause?
unable to display data on broswer using spring hibernate.below is my code and output
Wrong ordering in generated table in jpaajax jquery url specificationwant to add two different tables(classes) in one hibernate criteriaGenericDAO + Spring + JPA2 no unique beanHibernate: ManyToMany inverse DeleteHow to render partial view in Spring MVCMappingJackson2HttpMessageConverter Can not find a (Map) Key deserializer for typecom.fasterxml.jackson.databind.JsonMappingException: Multiple back-reference properties with name 'defaultReference'org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update&ORA-02289: sequence does not existshow details of all orders placed by customer
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Unable to display data on broswer using spring hibernate.below is my code and output..
Class: CustomerController
package com.luv2code.springdemo.controller;
import com.luv2code.springdemo.DAO.CustomerDAO;
import com.luv2code.springdemo.entity.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/customer")
public class CustomerController
@Autowired
private CustomerDAO customerDAO;
@RequestMapping("/list")
public String listCustomer(Model theModel)
List<Customer> theCustomers = customerDAO.getCustomers();
theModel.addAttribute("customers", theCustomers);
System.out.println(theCustomers);
return "list-customer";
Class: CustomerDAO Implementation
package com.luv2code.springdemo.DAO;
import com.luv2code.springdemo.entity.Customer;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
public class CustomerDAOImpl implements CustomerDAO
@Autowired
private SessionFactory sessionFactory;
@Override
@Transactional
public List<Customer> getCustomers()
Session getSession = sessionFactory.getCurrentSession();
Query<Customer> theCustomers = getSession.createQuery("from Customer", Customer.class);
List<Customer> customers = theCustomers.getResultList();
return customers;
Class: Customer mapping to database
package com.luv2code.springdemo.entity;
import javax.persistence.*;
@Entity
@Table(name="customer")
public class Customer
@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;
public Customer()
public int getId()
return id;
public void setId(int id)
this.id = id;
public String getFirstName()
return firstName;
public void setFirstName(String firstName)
this.firstName = firstName;
public String getLastName()
return lastName;
public void setLastName(String lastName)
this.lastName = lastName;
public String getEmail()
return email;
public void setEmail(String email)
this.email = email;
@Override
public String toString()
return "Customer" +
"id=" + id +
", firstName='" + firstName + ''' +
", lastName='" + lastName + ''' +
", email='" + email + ''' +
'';
jsp page..
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
<!-- loop over and print our customers -->
<c:forEach var="tempCustomer" items="$customers">
<tr>
<td> $tempCustomer.firstName </td>
<td> $tempCustomer.lastName </td>
<td> $tempCustomer.email </td>
</tr>
</c:forEach>
</table>
Output
spring hibernate
add a comment |
Unable to display data on broswer using spring hibernate.below is my code and output..
Class: CustomerController
package com.luv2code.springdemo.controller;
import com.luv2code.springdemo.DAO.CustomerDAO;
import com.luv2code.springdemo.entity.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/customer")
public class CustomerController
@Autowired
private CustomerDAO customerDAO;
@RequestMapping("/list")
public String listCustomer(Model theModel)
List<Customer> theCustomers = customerDAO.getCustomers();
theModel.addAttribute("customers", theCustomers);
System.out.println(theCustomers);
return "list-customer";
Class: CustomerDAO Implementation
package com.luv2code.springdemo.DAO;
import com.luv2code.springdemo.entity.Customer;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
public class CustomerDAOImpl implements CustomerDAO
@Autowired
private SessionFactory sessionFactory;
@Override
@Transactional
public List<Customer> getCustomers()
Session getSession = sessionFactory.getCurrentSession();
Query<Customer> theCustomers = getSession.createQuery("from Customer", Customer.class);
List<Customer> customers = theCustomers.getResultList();
return customers;
Class: Customer mapping to database
package com.luv2code.springdemo.entity;
import javax.persistence.*;
@Entity
@Table(name="customer")
public class Customer
@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;
public Customer()
public int getId()
return id;
public void setId(int id)
this.id = id;
public String getFirstName()
return firstName;
public void setFirstName(String firstName)
this.firstName = firstName;
public String getLastName()
return lastName;
public void setLastName(String lastName)
this.lastName = lastName;
public String getEmail()
return email;
public void setEmail(String email)
this.email = email;
@Override
public String toString()
return "Customer" +
"id=" + id +
", firstName='" + firstName + ''' +
", lastName='" + lastName + ''' +
", email='" + email + ''' +
'';
jsp page..
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
<!-- loop over and print our customers -->
<c:forEach var="tempCustomer" items="$customers">
<tr>
<td> $tempCustomer.firstName </td>
<td> $tempCustomer.lastName </td>
<td> $tempCustomer.email </td>
</tr>
</c:forEach>
</table>
Output
spring hibernate
add a comment |
Unable to display data on broswer using spring hibernate.below is my code and output..
Class: CustomerController
package com.luv2code.springdemo.controller;
import com.luv2code.springdemo.DAO.CustomerDAO;
import com.luv2code.springdemo.entity.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/customer")
public class CustomerController
@Autowired
private CustomerDAO customerDAO;
@RequestMapping("/list")
public String listCustomer(Model theModel)
List<Customer> theCustomers = customerDAO.getCustomers();
theModel.addAttribute("customers", theCustomers);
System.out.println(theCustomers);
return "list-customer";
Class: CustomerDAO Implementation
package com.luv2code.springdemo.DAO;
import com.luv2code.springdemo.entity.Customer;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
public class CustomerDAOImpl implements CustomerDAO
@Autowired
private SessionFactory sessionFactory;
@Override
@Transactional
public List<Customer> getCustomers()
Session getSession = sessionFactory.getCurrentSession();
Query<Customer> theCustomers = getSession.createQuery("from Customer", Customer.class);
List<Customer> customers = theCustomers.getResultList();
return customers;
Class: Customer mapping to database
package com.luv2code.springdemo.entity;
import javax.persistence.*;
@Entity
@Table(name="customer")
public class Customer
@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;
public Customer()
public int getId()
return id;
public void setId(int id)
this.id = id;
public String getFirstName()
return firstName;
public void setFirstName(String firstName)
this.firstName = firstName;
public String getLastName()
return lastName;
public void setLastName(String lastName)
this.lastName = lastName;
public String getEmail()
return email;
public void setEmail(String email)
this.email = email;
@Override
public String toString()
return "Customer" +
"id=" + id +
", firstName='" + firstName + ''' +
", lastName='" + lastName + ''' +
", email='" + email + ''' +
'';
jsp page..
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
<!-- loop over and print our customers -->
<c:forEach var="tempCustomer" items="$customers">
<tr>
<td> $tempCustomer.firstName </td>
<td> $tempCustomer.lastName </td>
<td> $tempCustomer.email </td>
</tr>
</c:forEach>
</table>
Output
spring hibernate
Unable to display data on broswer using spring hibernate.below is my code and output..
Class: CustomerController
package com.luv2code.springdemo.controller;
import com.luv2code.springdemo.DAO.CustomerDAO;
import com.luv2code.springdemo.entity.Customer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@Controller
@RequestMapping("/customer")
public class CustomerController
@Autowired
private CustomerDAO customerDAO;
@RequestMapping("/list")
public String listCustomer(Model theModel)
List<Customer> theCustomers = customerDAO.getCustomers();
theModel.addAttribute("customers", theCustomers);
System.out.println(theCustomers);
return "list-customer";
Class: CustomerDAO Implementation
package com.luv2code.springdemo.DAO;
import com.luv2code.springdemo.entity.Customer;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Repository
public class CustomerDAOImpl implements CustomerDAO
@Autowired
private SessionFactory sessionFactory;
@Override
@Transactional
public List<Customer> getCustomers()
Session getSession = sessionFactory.getCurrentSession();
Query<Customer> theCustomers = getSession.createQuery("from Customer", Customer.class);
List<Customer> customers = theCustomers.getResultList();
return customers;
Class: Customer mapping to database
package com.luv2code.springdemo.entity;
import javax.persistence.*;
@Entity
@Table(name="customer")
public class Customer
@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;
public Customer()
public int getId()
return id;
public void setId(int id)
this.id = id;
public String getFirstName()
return firstName;
public void setFirstName(String firstName)
this.firstName = firstName;
public String getLastName()
return lastName;
public void setLastName(String lastName)
this.lastName = lastName;
public String getEmail()
return email;
public void setEmail(String email)
this.email = email;
@Override
public String toString()
return "Customer" +
"id=" + id +
", firstName='" + firstName + ''' +
", lastName='" + lastName + ''' +
", email='" + email + ''' +
'';
jsp page..
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
</tr>
<!-- loop over and print our customers -->
<c:forEach var="tempCustomer" items="$customers">
<tr>
<td> $tempCustomer.firstName </td>
<td> $tempCustomer.lastName </td>
<td> $tempCustomer.email </td>
</tr>
</c:forEach>
</table>
Output
spring hibernate
spring hibernate
edited Mar 8 at 7:23
alseether
1,70121731
1,70121731
asked Mar 8 at 7:12
RazanRazan
63
63
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You're probably using an old version of jstl where expressions must be called witch <c:out/>
tag.
Try the following in your jsp
<td><c:out value="$tempCustomer.firstName" /></td>
<td><c:out value="$tempCustomer.lastName" /></td>
<td><c:out value="$tempCustomer.email" /></td>
I tried this way... but same issue.
– Razan
Mar 8 at 8:49
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058394%2funable-to-display-data-on-broswer-using-spring-hibernate-below-is-my-code-and-ou%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You're probably using an old version of jstl where expressions must be called witch <c:out/>
tag.
Try the following in your jsp
<td><c:out value="$tempCustomer.firstName" /></td>
<td><c:out value="$tempCustomer.lastName" /></td>
<td><c:out value="$tempCustomer.email" /></td>
I tried this way... but same issue.
– Razan
Mar 8 at 8:49
add a comment |
You're probably using an old version of jstl where expressions must be called witch <c:out/>
tag.
Try the following in your jsp
<td><c:out value="$tempCustomer.firstName" /></td>
<td><c:out value="$tempCustomer.lastName" /></td>
<td><c:out value="$tempCustomer.email" /></td>
I tried this way... but same issue.
– Razan
Mar 8 at 8:49
add a comment |
You're probably using an old version of jstl where expressions must be called witch <c:out/>
tag.
Try the following in your jsp
<td><c:out value="$tempCustomer.firstName" /></td>
<td><c:out value="$tempCustomer.lastName" /></td>
<td><c:out value="$tempCustomer.email" /></td>
You're probably using an old version of jstl where expressions must be called witch <c:out/>
tag.
Try the following in your jsp
<td><c:out value="$tempCustomer.firstName" /></td>
<td><c:out value="$tempCustomer.lastName" /></td>
<td><c:out value="$tempCustomer.email" /></td>
answered Mar 8 at 7:42
noiaverbalenoiaverbale
826718
826718
I tried this way... but same issue.
– Razan
Mar 8 at 8:49
add a comment |
I tried this way... but same issue.
– Razan
Mar 8 at 8:49
I tried this way... but same issue.
– Razan
Mar 8 at 8:49
I tried this way... but same issue.
– Razan
Mar 8 at 8:49
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55058394%2funable-to-display-data-on-broswer-using-spring-hibernate-below-is-my-code-and-ou%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown