spring-mvc

Why are transactions not rolling back when using SpringJUnit4ClassRunner/MySQL/Spring/Hibernate

I am doing unit testing and I expect that all data committed to the MySQL database will be rolled back... but this isn't the case. The data is being committed, even though my log was showing that the rollback was happening. I've been wrestling with this for a couple days so my setup has changed quite a bit, here's my current setup. Lo...

Mapping restful ajax requests to spring

I have this piece of code: @RequestMapping(value = "/test.json", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) public @ResponseBody Object[] generateFile(@RequestParam String tipo) { Object[] variaveis = Variavel.getListVariavelByTipo(tipo); return variaveis; } As far as I know it should take a request to test.jso...

Spring MVC and Weblogic integration

I get this error whenever I try to view my tutorial app in the browser WARNING: No mapping found for HTTP request with URI [/HelloWorld.Web] in DispatcherServlet with name 'dispatcher' That just means the request is being received by the dispatcher servlet but it can't forward it to a controller. But I can't seem to know where th...

Spring - disable bind exceptions (for a particular property)

Hi all, In a web application I'm working on using Spring 2.5.6.SEC01, I essentially have an Integer field that takes a number to determine which page to scroll to. The requirements changed, and we no longer want to display an error message, but simply ignore the user's input if they enter an invalid number, say "adfadf". I was reading...

Spring Annotation based Controllers and Duplicate Form Submission

How does one disable duplicate form submission on Annotation based controllers. ...

How can I connect two users so they can share common object (game instance) with use of J2EE web technologies (JSP, Spring etc.)?

My idea is that player 1 creates a game (for two players), server returns him a URL, player 1 sends this URL to player 2 and the player 2 opens URL and that connects him to the game. What is the best and the easiest way to achieve this using JSP and related technologies? ...

Different i18n in spring according to url

I have a spring web application that is required to work as following the application will be accessed from two different URLs www.domain1.com and www.domain2.com and it is required that the two URLs looks like two different applications with different CSS and I18n. for the css part is done but I am stuck with the i18n part How to m...

Accessing Spring beans from a Tiles view (JSP)

In Spring MVC I can access my beans in JSP using JstlView's exposedContextBeanNames (or exposeContextBeansAsAttributes). For example, then, in my JSP I can write (${properties.myProperty). But when the same JSP is a part of a tiles view, these properties aren't accessible. Is possible to configure Tiles properly or access these propertie...

sitemesh and tiles 2.1 integration with spring MVC

Is posible to integrate sitemesh and tiles 2.1 with spring mvc ? I want to composite the layout with tiles and then decorate with sitemesh. I was using tiles like that. <bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"> <property name="definitions"> <list> ...

access to request object when using spring security

When logging in I want to read the URL and base on the combination of subdomain, username and password user should be authorized. like if the url is abc.xyz.com i somehow need request object to get the subdomain and authorize user using the subdomain and username. ...

What are the principles of developing web-applications with action-based java frameworks?

Background I'm going to develop a new web-application with java. It's not very big or very complex and I have enough time until it'll "officially" start. I have some JSF/Facelets development background (about half a year). And I also have some expirience with JSP+JSTL. In self-educational purpose (and also in order to find the best...

Spring redirecting back to referrer

I have some resources in my application that require redirection to another resource (form) if some context information is not set. After the context gets set (requires two user steps), I need to redirect back to the requested resource. How do I achieve that. I am using annotation based controllers in Spring 3. Is org.springframework.sec...

Spring validation @AssertTrue

How do I display on a view jsp validation error message that occurs as a result of @AssertTrue annotation? It isn't tied to a specific field, but I am using it to validate a combination of fields. If I use <form:errors path="*"/> that will display all the errors for that form? ...

How does spring map post data to POJO?

I have a spring controller defined like this: @Controller @RequestMapping("/user") class UserController { ... @RequestMapping(method=RequestMethod.POST) public String save(User user) { // Do something with user return "redirect:/..."; } } How is post data (data submitted from a form) mapped to the User ...

sitemesh and spring MVC decorator pattern problems

I have sitemesh with spring working, this is the configuration: decorator.xml <?xml version="1.0" encoding="UTF-8"?> <decorators defaultdir="/styles"> <excludes> <pattern>/exclude.jsp</pattern> <pattern>/exclude/*</pattern> </excludes> <decorator page="application/themeManager/theme.jsp" name="dos"> ...

Spring 3 MVC - form:errors not showing the errors

I am using annotation based validation but for one of the forms I am not able to show any errors using the form:errors tag. When I debug the method, I can see the BindingResult has errors, but for some reason its not being displayed on the form. I am stumped as I have got it working on other forms, but for some reason this particular for...

Creating multiple forms in one jsp file. ModelAttributes have to always be set?

I am new to Spring and have been reading about it the last few days. I haven't found an open source example like this so far and didn't see a clear way for it to be done. Many sites have a login or search box that is on every page. If this is the case, how can you avoid setting an attribute in a model on every page for that form? Simila...

java json controller

I have an Java class, like Library, that contains many fields. I want do ajax call to server and in controller's method I want to have partly initialized @RequestBody Library with only fields, which are present in json object. I read the http://blog.springsource.com/2010/01/25/ajax-simplifications-in-spring-3-0/, but I need not full ob...

How do I bind HTML table data to a java object in a spring controller?

I have a spring MVC application using JSP as my view technologies with Jquery for AJAX. I have a table such as the following: <table> <tr> <td>name1</td> <td>value1</td> <td>setting1</td> </tr> <tr> <td>name2</td> <td>value2</td> <td>setting2</td> </tr> </table> I need to serialize this table so that it...

BindingResult.rejectValue does not find value from ValidationMessages.properties

We're using spring with annotations, and our annotated fields get validated fine and error messages get displayed from ValidationMessages.properties, but for custom validation message from ValidationMessages.properties does not seem to be used. Here's the example: Validatior (also the form): public void validateSpecial(BindingResult...