spring

Spring JSP form:input tag puts commas in int value

Using Spring 2.5 tag library, I have an Integer value in a command form that's rendered on my page using <form:input path="budget" htmlEscape="true" /> When the value is > 999, it renders the number as value="x,xxx" on the page. My validation isn't expecting the comma and rejects the value. Is there a fix for the rendering, or do I n...

Fixing BeanNotOfRequiredTypeException on Spring proxy cast on a non-singleton bean?

I'm having an issue with pulling a Spring bean from an application context. When I try; InnerThread instance = (InnerThread) SpringContextFactory.getApplicationContext().getBean("innerThread", InnerThread.class); I get; org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'innerThread' must be of type [com.g...

Setting global variable in Struts with Spring

What is the best approach to set servlet context variable in Struts? This variable is displayed on every single page in header tile and has to be loaded from DB. For that purpose there is Hibernate DAO and Spring Service which returns the requested value. My current approach was to extend Struts PlugIn class and inject my service into i...

How to inject MessageSource to a View extending AbstractView

I have a view class that extends AbstractExcelView public class ExportExcelParticipantsView extends AbstractExcelView { ... } I would like to inject a MessageSource to this bean. Is this possible? I use a ResourceBundleViewResolver to resolve views (in this case) <bean id="resourceBundleViewResolver" class="org.springframework.web...

Loading a popup using ajax

I have a jsp page which should load a popup using ajax. The content of the page is determined by form filled by user. Something like this: javascript: ajax('getPage.action', 'content_id', 'form_id'); foo.jsp: <div id="content_id"></div> <form id="form_id"> ... </form> java/spring: @RequestMapping("getPage.action") MyController...

Applying Spring .Net Advice to HibernateTemplate object

I have an class for auditing: public class AuditAfterAdvise : IAfterReturningAdvice This is applied to a Dao class in my Spring.Net configuration, using a RegularExpressionMethodPointcutAdvisor. The Dao class implementation calls HibernateTemplate.SaveOrUpdate(object entity) to commit changes. I would like to be able to apply AuditA...

Encrypting sensitive information in JBoss configuration

The standard data source configuration in JBoss requires the username and password of the database user to be in the xxx-ds.xml file. If I define my data source as a c3p0 mbean I encounter the same issue. Is there a standard way to have the user and password encrypted? What is a good place to save the key? This of course relevant to to...

Spring MVC DefaultRequestToViewNameTranslator capitalization issue

I'm trying out the whole "convention over configuration" thing with Spring MVC. Spring has all sorts of tools to help with this, and I'm trying some of them out. However, I ran into a problem with our team's configuration not quite matching what Spring wants. The problem is that we take URLs like "http://ourSite/SomePage.do", put them...

Merge Spring and Grails projects

We are developing an backoffice application using Spring and Maven as configuration manager. The project is moreless divided in two parts, and one of this parts is just for manage the data in the DB tables. Now someone has discovered Grails, and with Grails this job is very easy, but we can't drop all the job and start a new project (th...

Any good Spring threading with a TaskExecutor examples?

I'm trying to get a handle on how to implement threading in a Java application that uses Spring for transaction management. I've found the TaskExecutor section in the Spring documentation, and ThreadPoolTaskExecutor looks like it would fit my needs; ThreadPoolTaskExecutor This implementation can only be used in a Java 5 environm...

What is the minimal configuration for REST-fully annotated service built on Spring 3 (m3)?

I'm trying to expose a REST-full service (hosted by Tomcat) and can't figure out what is the required configuration for Spring 3 (M3). This is how (example) the service looks like: @Controller @Scope("prototype") public class UsersController { @RequestMapping(value="/users/hello", method=RequestMethod.GET) public String hello()...

Spring MVC - Form Mapping

Probably missing something completely obvious here, but here goes. I'm starting out with Spring MVC. I have a form controller to process inbound requests to /share/edit.html. When I hit this url from my browser, I get the following error: The requested resource (/inbox/share/share/edit) is not available. Here is my applicationCont...

Best way to show the user full name in a JSP header file with a spring/struts framework?

I have a JSP struts application that uses Spring to integrate with the services/dao/database. Basically, struts uses spring to get the data from the DB, it builds the form and forward them to the JSP files. I have a header file that is injected in each JSP file using Tiles. I would like to show "Welcome John Doe" on each page inside th...

Problem configuring Spring's MailSender for our SMTP-server (but GMail works)

Hi, I have some problems sending mails through SMTP using Spring's MailSender interface and the concrete implementation JavaMailSenderImpl. I'm able to send mail through GMail, but not through our company SMTP-server (Postfix). Correct configurations To see that I have the correct configuration I used the excellent mail sender ssmtp. I...

Spring and Stripes Security Design

I'm building a web application using Stripes and Spring. It needs to have a login/authentication feature. Right now I store user information separate from user credentials in the database. My User model does not contain the credentials as I don't want to be passing around valuable passwords. Spring manages all of my DAO's. Now, I ...

Spring MVC isFormSubmission() equivalent for annotations?

With Spring MVC, it's easy to express a concept like "A user is submitting the form if they use POST or if they include the 'isSubmit' parameter." You'd just extend SimpleFormController and override the isFormSubmission method. However, Spring MVC now uses these neat annotations like @RequestMapping to handle requests. @RequestMapping...

Checking validation errors in XMLHttpRequest

$.post(actionUrl, serializedForm, function(response) { ... } I need to check whether validation of form succeeded, or not (I don't need to know the exact validation errors). The validation is done by Spring, and I wouldn't like to interfere the process, because there's some annoying dependencies. What would be the best approach? Is t...

Is it possible to manually set the command object in an @RequestMapping method before Spring binding?

I have a JSP that has a Spring form in it. The form's command object is added in the controller before the JSP is rendered. Spring binds the form in the JSP to this command object, and will correctly handle it when submitting a NEW instance. However, I would like to persist the command object via DWR (which also works correctly), an...

Are EJBs still useful? And what are the Spring Framework ways to replace EJBs?

I have read for a while that EJBs are not useful or cumbersome. But what other ways implement the business delegate pattern? How do EJBs differ from the approach the Spring recommends? Also, how have recent advances with EJBs changed your opinion. ...

Hibernate + Spring using multiple datasources?

I'm working on a web application that uses Spring MVC 2.5 and Hibernate. One of the requirements of the application is that it must be able to export some objects to an external database. I figure I might as well use my existing data layer and just save the objects to the external source. I'm new to Spring and Hibernate, and I guess I...