spring-mvc

Rails flash messages in Java

What's the best way to achieve Rails-like flash messages such as "Update successful" http://api.rubyonrails.org/classes/ActionController/Flash.html) in the Java world? I'm using Spring MVC. ...

Intent of Spring form command

Spring's form controller (such as SimpleFormController or BaseCommandController) uses commands to pass data between the HTML form and controller. My question is, is it common practice to use the backing model as the command itself? Or is it common to create a separate command with correspond attributes to those in the backing model. My ...

Can a Spring form command be a Map?

Can a Spring form command be a Map? I made my command a Map by extending HashMap and referenced the properties using the ['property'] notation but it didn't work. Command: public class MyCommand extends HashMap<String, Object> { } HTML form: Name: <form:input path="['name']" /> Results in the error: org.springframework.beans.NotR...

What is the most commonly used Java web framework?

Which of the following frameworks is the most commonly used in Java right now and, if different, which framework is growing in popularity the fastest in terms of adoption? Stripes Spring MVC Struts Struts 2 Tapestry Wicket JSF No Framework - Pure JSP/Servlet Grails Some other framework not mentioned here ...

How do I migrate Struts application into Spring?

How do I migrate Struts application into Spring? ...

What tactics can I use to prevent users from discovering what language a website is written in?

So, if you are writing a website using Java and JSP's and didn't want users to know what language you written it in. What techniques would you use? ...

Spring MVC JavaScript

In a Spring MVC app, what is the best approach for putting external JavaScript files in WEB-INF/ along with jsps? /WEB-INF/spring/foo.jsp which has an include of <script src="foo.js"></script>. I want foo.js in the WEB-INF/spring/ directory right beside the owning jsp? I've noticed Spring has a ResourceSerlvet, but I'm not sure i...

spring MVC sample web app

Hi, I'm looking for an example Spring MVC 2.5 web app that I can easily: Setup as a project in Eclipse Deploy to a local app server (using Ant/Maven) There are a couple of example applications included with the Spring distribution ('petclinic' and 'jpetstore'), but they don't provide any Eclipse project files (or a way to generate t...

Hibernate: lazy-loading doesn't work on one-to-many mapping on set

Hi, I'm using Spring together with Hibernate for developing a Portlet for the Liferay portal server. I now have basically two entities, A and B, where A possibly contains many B's. So this goes to a one-to-many mapping between the two. <set cascade="all" lazy="true" name="comments" order-by="creationDate desc"> <key column="lfpn_pin...

SpringMVC and FreeMarker

Hi everybody! I hope someone can help me.. I have the follow code: <@formInput "${value}", "tabindex=\"${index}\" class=\"yui-ac-input\"", "text"/> For the Input tag, the attibute VALUE obtains the value of "${value}" My problem appears when the user inserts a apostrophe in the input field. (') I used the escaped method of the manual ...

How do I write a custom converter in Spring Web Flow 2?

Hello. I am using Web Flow 2.0.7 with Spring MVC and Hibernate. My problem is about custom converters for my custom types and database connection from within my converter. Let's say I have a type Person and the Person has a field of my custom type Title, and all Titles are already in my database. Now I have an html form, in which a use...

Java and SEO URLS

I'm building a webapp using spring MVC and am curious as to whether there is any clean way to make SEO urls. For example, instead of http://mysite.com/articles/articleId and the such, have: http://mysite.com/articles/my-article-subject ...

Spring MVC controller HTTP GET query parameters

How do I, without annotations, create and wire a controller that will perform an action based on a query parameter? So maybe I've got a page with a list of items on it, and each one is a link like "edititem.htm?id=5". When the user clicks a link I want the controller to load up "item #5" and pass it to my edit form. I'm sorry to ask ...

In Spring Webflow unit test, how do you assert that a view state has a view of a given name?

I'm developing a Spring webflow, trying to use TDD so I've extended AbstractXmlFlowExecutionTests. I can't see an obvious way to assert what I would have thought would be a simple thing: that a view state has an associated view of a given name. For example, given this flow (excerpt): <?xml version="1.0" encoding="UTF-8"?> <flow ...> ...

annotations in Spring MVC

Hi, I'd like to convert this SimpleFormController to use the annotation support introduced in Spring MVC 2.5 Java public class PriceIncreaseFormController extends SimpleFormController { ProductManager productManager = new ProductManager(); @Override public ModelAndView onSubmit(Object command) throws ServletE...

Spring-MVC controller redirect to "previous" page?

Let's say I've got a form for editing the properties of a Pony, and in my web application there are multiple places where you can choose to edit a Pony. For instance, in a list of Ponies there might be an "edit" link next to each Pony, and when the user is viewing a Pony, there might also be an "edit" link in that view. When a user cli...

Spring + JPA (Hibernate) on Glassfish --> ClassVisitor problem

I'm trying to write a simple web app with Spring 2.5 (core + MVC) and JPA (using Hibernate for the persistence mechanism). Every time I deploy, I'm getting a "Class not found exception" that points to ClassVisitor. This is a known version problem with the asm library. In a stand-alone app, I can make sure that the proper asm version i...

Is it possible to use a "front controller" in Rails?

In Spring MVC a Dispatcher servlet is used as a "front controller" to handle all of the application requests and route them appropriately. Is it possible to use such an approach in Rails or is it required to write a separate controller for each type of action without having a "traffic cop" (front controller) directing the flow? ...

Spring MVC, one controller for "add" and "update" when using setDisallowedFields?

So I've got a simple form through which I can either "add" a new Thing, or "update" an existing Thing. What I would like is to have one controller that can process both adding and updating. On the outset this seems simple enough, until I consider the problem of using setDisallowedFields in my InitBinder so that the "id" field is not al...

Spring MVC @SessionAttributes confusion!

I'm using 2.5 and doing everything via annotations. I have a simple form that allows the user to edit an object. The controller behind it creates the object and adds it to the model on GET, and processes the changes on POST (submit). It works fine, but I don't understand why. The object is never explicitly added to the session, and the ...