I've switched from classpath scanning of Controller classes to explicitly declaring the beans, but was wondering what else I can do to cut down on the initial startup of a Spring MVC application.
...
I have a form that needs to put its results into another window. I am using:
It has both client and server side validation. The problem is when the server side validation fails, it puts the resulting error screen in the new window rather on the original page (as it should).
What I'm trying to figure out is how to have the server sid...
Hi! I am trying to implement a @Future validator for joda time objects.
I followed the implementation for the @Past annotation found here. So far, so good.
Now I am failing at telling spring that I have this new constraint. Is there a way to configure the Spring MVC (other than just <mvc:annotation-driven />) to tell him where the vali...
Spring MVC names objects that contain a logical view name and the payload to render ModelAndView, the JAX-RS implementation Jersey names them Viewable. I like Viewable a bit better, but maybe you have a better suggestion.
Example:
return new Viewable("index", payload);
How would you name a class, that combines a view (template) name ...
Hi
When trying to autowire JdbcUserDetailsManager from Spring Security, I use following statement in appcontext.xml (located separated from webapp):
<bean class="org.springframework.security.provisioning.JdbcUserDetailsManager">
<property name="dataSource" ref="dataSource"/> ...
How can an object be accessed from the ModelMap in jsp so that a method can be called on it? Currently I recieve this error:
Syntax error on token "$", delete this token
JSP
<body>
<% MenuWriter m = ${data.menus} %>
<%= m.getMenus()%>
</body>
Java
@Controller
@RequestMapping("/dashboard.htm")
@SessionAttributes(...
I reading spring 3.0.x reference but I don't know how to use ,can you paste a full example?
...
I have a mid-size Spring application and I want to insert key/value pairs into all my ModelAndViews in a cross cutting fashion (much like AOP).
The motivation is to add all kind of data to all my pages (configuration values, build number, etc).
What is the easiest way to have this done? I prefer without AOP but I am ready to use it if ...
I solved this myself, but I spent so long discovering such a simple solution, I figured it deserved to be documented here.
I have a typical Spring 3 MVC setup with an InternalResourceViewResolver:
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org...
I need to tidy user input in a web application so that I remove certain HTML-tags and encode < to > etc.
I've made a couple of simple util methods that strips the HTML, but I find myself adding these EVERYWHERE in my application.
Is there a smarter way to tidy the user input? E.g. in the binding process, or as a filter somehow?
I've...
I have error at the first line of the following code while building with Ant builder,
<war warfile="${wartemp.dir}/${name}.war" basedir="${wartemp.dir}" webxml="${wartemp.dir}/WEB-INF/web.xml">
<include name="*"/>
<include name="scripts/**"/>
<include name="styles/**"/>
<include name="imag...
Hello everyone,
has anyone a good hint how to send E-Mails from Spring 3 that were created by a view (a jsp)?
(the spring manual describes how to use Velocity as template engine for generating e-mail bodies, but is it also possible to use JSPs instead?)
...
I'm using class that is not called by my @Controller directly and when I try to use @Autowired propeprty in that class what is defined as @Service, property is null. But @Autowired with same markup will work inside @Controller.
Example code:
@Service
public class UsernameValidator implements Validator {
@Autowired private UserDao...
Hi all,
My problem with cookies are in following I'm try to add new cookie and few lines after I'm going to read all cookies and to make new object and to assign it to Spring View, problem is that mine cookies are not added, everything works after page reload but not in same time...
Cookie[] cookies = request.getCookies();
if (cook...
I just co https://src.springframework.org/svn/spring-samples/ and tried to build petclinic.
I did:
mvn clean install
mvn eclipse:eclipse
I imported to eclipse but:
The import org.aspectj cannot be resolved
What are the odds that the pom.xml is wrong and I have to add the dependency myself?
...
If I pass variables with extended characters to my JSP, the end of the rendered file is truncated by 2 bytes for each non-ascii character. Why is this so? Here is an example.
My Controller:
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestM...
I was wondering if there is a possibility that I could use the JSTL function to import spring Views.
so something likes this:
<div id="contentHolder">
<c:import url="/foo.do?bar" />
</div>
In the XML stands:
<!-- Viewresolver -->
<b:bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver...
Very new to spring and working my way through validation.
I have examples working where I actually implement the spring Validator class, but am working on getting examples working without implementing the Validator class and instead using annotations directly on model class attributes such as @NotBlank and @Email.
My question is this. ...
I am learning spring-mvc and I am doing a simple crud.
I have a list of items with a big add button on top of it.
When the user clicks add it will redirect to /item/add where the view is a form.
Now, when the user loads a new item I want to show a msg in the list saying something like:
"Item added successfully"
I noticed that I c...