spring

Spring root WebApplicationContext for Servlet

I have a webapp that uses SpringMVC DispatcherServlet to load a WebApplicationContext. The Spring reference documentation says: "each DispatcherServlet has its own WebApplicationContext, which inherits all the beans already defined in the root WebApplicationContext. These inherited beans can be overridden in the servlet-sp...

Sprin mvc and different required fields depending on action

Hi, i have a form with 2 buttons let say A & B. The required fields are depending on the button pressed. Im using actually a DataBinder allowing me to specify requiredFields but for all actions. How can i customize the required fields that will be depending on the button pressed ? Thanks in advance ...

Seamless SSO with CAS

I have Spring MVC app with Spring Security set up to use CAS. Also I have Liferay Portal 5.2.3 configured to use CAS. I authenticate from app_1 Open Liferay Portal (app_2) It does not check authentication immediately (I see sign in link) If I click Sign in then CAS verifies that user is authenticated and I'm automatically signed in. ...

In Spring how do you get the current user whose credentials are not part of the current http request?

Is there a "getCurrentUser" method in Spring to access the user that is currently part of a request - even if that user's name is not being passed around as part of a web request? ...

Is request.getMethod().equalsIgnoreCase("post") a bad idea in a (pre-Spring-3.0) Spring blog app?

In Spring 3.0 annotations allow you to specify the blog post method as a url. But prior to that version of Spring, is this the best way to achieve it: @SuppressWarnings("unchecked") public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse arg1) throws Exception { ModelAndView mav = handleRequestInternal(reques...

spring mvc annotation - object missing values on post

I have a domain object with 5 property. I preload the object in my GET method and display just one of the property in the form. When the form gets submitted, the object contains only one property with value. How do I get the remaining properties and their values without putting a hidden variable for each property in my form. ...

spring mvc annotation - dummy form variable

I have a form with two select boxes that are used to move values from one box to another. I need to submit values only from second select box to my ModelAttribute. How do i prevent spring mvc from complaining about "unable to bind" on my first selectbox. ...

How can I get a WebSphere project to run under tc server?

Just wondering if anyone has ever converted a Websphere project to run under tc server? I run on a Mac and would love to be able to run my application locally without having to run Websphere in a VM. I realize there are differences which would have to be accounted for, and that's really my question - what would I have to change? I als...

What's the proper way to handle JDBC connections with Spring and DBCP?

I'm using the Spring MVC to build a thin layer on top of a SQL Server database. When I began testing, it seems that it doesn't handle stress very well :). I'm using Apache Commons DBCP to handle connection pooling and the data source. When I first attempted ~10-15 simultaneous connections, it used to hang and I'd have to restart the se...

ActiveMQ Ajax not processing topic messages published by Spring JmsTemplate

Hello, I created a quick web site with ActiveMQ's Ajax javascript message handlers to subscribe to a topic that is published by a JAX-RS/Spring web service. I noticed something rather weird, the ActiveMQ ajax does not call the message handler function if I publish a MapMessage from JmsTemplate, however it does call it if I publish it ...

Spring MVC @PathVariable getting truncated

I have a controller that provides RESTful access to information: @RequestMapping(method = RequestMethod.GET, value = Routes.BLAH_GET + "/{blahName}") public ModelAndView getBlah(@PathVariable String blahName, HttpServletRequest request, HttpServletResponse response) { The problem I am experiencing is that i...

entityManager.persist(user) -> javax.persistence.EntityExistsException: User@b3089 is already persistent

// lookup existing user & set a currently null child entity (ContactInfo) user.setContactInfo(contactInfo); // update the user in the datastore with newly created child Entity entityManager.persist(user); Generates exception: javax.persistence.EntityExistsException: User@b3089 is already persistent Since the user alrea...

Spring, multiple Hibernate Sessionfactories configuration

Hi there, I need to set up multiple Sessionfactories in my app, now I'm facing a problem. I can't use the 2nd level cache at the moment because only the cache from the first factory is returned. Providing a hibernate.cache.region_prefix would solve the problem I guess. How can I supply for each factory a own region per Spring XML config...

Spring Batch: migrating 1 to n relationship where n is potentially huge

I am experienced with Spring, but new to Spring Batch. Now I have the task to migrate a data structure from a simple structure in one database to a complexer one in the other. The data structure corresponds to an object hierarchy that I will name like this OldParent 1 --> n OldChild // old system NewParent 1 --> n NewChild // new syst...

Integrate reports (jasper, Jfreechart) to existing spring mvc project

Please, i need to integrate report (Jasper, JfreeChart, or birt) with an existing web Spring mvc project ...

JDBC connection pooling issue

Hello I have, I might say, a quite a big issue. I'm working on Java web application which use springs BasicDataSource to setup DB connection. I was testing the application locally and it works just fine... but, when application is online, connection to DB in some point just stuck. I was than investigating regarding connection pooling, ...

Jackson (JSON) throws JsonMappingException when Float is null

Hi I am using Spring (with Jackson) and jQuery to pass a form as an object. My pojo includes nullable floats. However, when the fields are empty, Jackson throws an Exeption: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.lang.Float from String value '': not a valid double value What do I have to do ...

How does Spring @Autowired work

I came across an example of @Autowired public class EmpManager { @Autowired private EmpDao empDao; } I was curious about how the empDao get sets since there are no setter methods and it is private. ...

redirecting to another page after an ajax response from a spring controller using jquery

HI we are using spring MVC as our application framework and in one of our modules we need to make an ajax request from one of the jsp's based on the response from the controller we need to redirect to another page. $.ajax({ type: 'POST', dataType:'text', async: false, url: "${requestContextPath}/home.htm...

Preparing simple multipart/alternative email using MimeMessageHelper (Spring Framework)

Hi, I'd like to prepare simple html email with alternative plain-text version. I don't need any attachments or inline elements. By default if I use: MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true, "UTF-8"); I get MimeMessageHelper.MULTIPART_MODE_MIXED_RELATED mode. My email content body looks like this: Conten...