spring-mvc

org.hibernate.lazyinitialization exception

帅比萌擦擦* 提交于 2020-01-14 14:20:53
问题 org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: pojo.Person.address, no session or session was closed. I am getting this exception and I'm using Spring 3.0 and Hibernate 3.6. 回答1: It looks like you have an Entity called Person which has a lazily loaded mapped collection of Addresses? You have loaded the Person and the session it was loaded in has now been closed. After the session was closed you then attempted to access that collection of address

org.hibernate.lazyinitialization exception

不羁的心 提交于 2020-01-14 14:20:11
问题 org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: pojo.Person.address, no session or session was closed. I am getting this exception and I'm using Spring 3.0 and Hibernate 3.6. 回答1: It looks like you have an Entity called Person which has a lazily loaded mapped collection of Addresses? You have loaded the Person and the session it was loaded in has now been closed. After the session was closed you then attempted to access that collection of address

Spring MVC: RESTful web services + BlazeDS integration possible in the same web application?

我们两清 提交于 2020-01-14 14:07:33
问题 I have a Spring MVC web application which provides RESTful web services via a controller class (annotated with @Controller) which has methods mapped to specific request types and signatures via @RequestMapping annotations. I have attempted to integrate a BlazeDS service destination into the mix by 1) adding the HttpFlexSession listener to the web.xml, 2) adding the flex:message-broker and flex:remoting-destination declarations to my Spring application context configuration file, and 3) adding

Spring MVC: RESTful web services + BlazeDS integration possible in the same web application?

一个人想着一个人 提交于 2020-01-14 14:05:46
问题 I have a Spring MVC web application which provides RESTful web services via a controller class (annotated with @Controller) which has methods mapped to specific request types and signatures via @RequestMapping annotations. I have attempted to integrate a BlazeDS service destination into the mix by 1) adding the HttpFlexSession listener to the web.xml, 2) adding the flex:message-broker and flex:remoting-destination declarations to my Spring application context configuration file, and 3) adding

JSP Component Creation

我的梦境 提交于 2020-01-14 13:44:15
问题 When creating JSP pages one thing that I'd often like is the ability to do something like this: <jsp:include page="fancystoryrenderer.jsp" value="${aStoryObjectInMyModel}/> ... fancystoryrenderer.jsp <div id="fancymainbody"> ... ${theStory.title} ... </div> The main important characteristics of this is that I can reuse the same component on the same JSP page in different places without having to copy paste the component and give the story variables different names, notice that the story is

Spring request mapping to a different method for a particular path variable value

蹲街弑〆低调 提交于 2020-01-14 13:03:55
问题 @Controller @RequestMapping("/authors") public class AuthorController { @RequestMapping(value = "/{id}", method = RequestMethod.GET) public Author getAuthor( final HttpServletRequest request, final HttpServletResponse response, @PathVariable final String id) { // Returns a single Author by id return null; } @RequestMapping(value = "/{id}/author-properties", method = RequestMethod.GET) public AuthorProperties getAuthorProperties( final HttpServletRequest request, final HttpServletResponse

Why this Thymeleaf form binding with selection field does not work?

隐身守侯 提交于 2020-01-14 12:52:30
问题 I have two models, Patient and Study . In the Study model, I want to use Patient 's Id as a foreign key. My Study Model (without getter/setter) is as below @Entity @Table(name = "Study") public class Study { @Id @Column(name = "study_id") @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @NotNull @ManyToOne @JoinColumn(name = "patient_id") private Patient patient; @NotNull @Column(name = "description") private String description; @NotNull @Column(name = "status") private String

ModelAttribute returns null values in controller in Spring MVC

给你一囗甜甜゛ 提交于 2020-01-14 12:37:09
问题 Ok, its time to seek help; I am sending a (shopping) Cart ModelAttribute to my jsp, allowing the user to edit the quantity, when the Model is POST to the controller the fields are null except the editable (quantity) field. I have researched for days on similar issues but nothing is matching. I am using spring 3.1. Here is my controller on the GET and POST: @Controller public class CartController { @Autowired private Cart cart; @RequestMapping(value = "/cart", method = RequestMethod.GET)

Java Spring Interceptor with no XML

我的梦境 提交于 2020-01-14 11:51:47
问题 I understand that it is possible to configure a Spring application without the use of XML config files, and have commited to this method. I am not sure, however, how to declare HTTP interceptors in this manner. I am using this tutorial, which declares the following XML. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans

Spring MockMvcBuilders Security filter

情到浓时终转凉″ 提交于 2020-01-14 10:26:27
问题 I have manage to create REST API with spring mvc. My purpose was about to protect a resource with JWToken. Now i am trying to write three Test : 1. Get the Token with granted user/password Authentication Fail => test:OK 2. Get the Token with not granted user/password Authentication success => test:OK 3. Get the protected resource without providing the Token => test:fail because my rest service give the protected resource .... Here is my REST controller: @Component @RestController