spring-mvc

Lazy Intantiation of the Spring MVC DispatcherServlet?

Is there a way for me to instantiate the Spring MVC DispatcherServlet in code rather put it in the web.xml and have it be instantiated by the web server? The reason for this is that I want to check a memCache to see if I have already recently rendered the page that is being requested and if so just return from the memCache, rather than ...

spring-security & spring-mvc configuration

Hola. i have written a small webapp using spring-security and spring-mvc with an annotation based configuration (@Secured). in order to have that work i had to split up the spring-security configuration: app-context.xml (included in web.xml's ContextConfigLocation) <security:http auto-config="true"/> app-servlet.xml (spring-mvc's di...

How to modularize a Spring MVC application?

Hi there I could not see any samples so far and im wondering is it even possible, can i modularize my spring application? I dont mean just packages and jars. I would like to be able to have lets say a controller a few beans and some views + images and css. All the files necessary bundled together and dropped into the app like a jar. o...

Spring Hibernate Integration

I am new to Spring Hibernate. I was trying Spring Hibernate integration tutorial from "http://www.vaannila.com/spring/spring-hibernate-integration-1.html" and i was able to run the example.This example deals with one table. Now i am trying with one more table. I have few question As per my understanding we need to add following things ...

How do I handle user logins with Spring MVC?

I'm using Spring MVC for a web app. I want to use OpenID for my application, but I'm just wondering of what a good way to handle authentication in general for Spring MVC is. My web app is a question and answer app. Here is the scenario I am confused about: When a user wants to ask a question, they enter a question in a text box and hi...

Trying out Spring 3 MVC, Getting a page error

Trying to configure spring 3 MVC, here is what I did so far: I added all the spring 3.0 libraries to my netbeans project. My web.xml is: <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_...

Setting content type in an action

In spring mvc 3.0, how can I set the content type of a particular action? I want to set the action to return a json result. ...

Spring SimpleFormController onSubmit request parameters

I am using SimpleFormController in my application to handle form submisions. one thing i am missing is the request object that is passed onSubmit(request,response..) is a different one from the initial request object that is received by formBackingObject(..).probably because it is again a new request from web. i just want to use the sa...

Spring MVC Application - How do I set a session scoped bean value

In my application I need to gather information on one screen and then display it on the next. I have selected to store this information in a bean with a scope set as session ( it will be used in several other screens after the initial data gathering screen) Manger configured as follows: <bean name="/springapp.htm" class="foo.bar.cont...

How do you create a Spring MVC project in Eclipse?

I am trying to follow basic tutorial for Spring MVC but get lost at creating a new project in Eclipse. It seems that most tutorials assume you know how to create a Spring Project in Eclipse. Any advice on where to get started or tutorials which explain how to set up Eclipse would be appreciated. ...

In a mvc application, where will the DI take place?

When using spring and spring's MVC, where should the DI take place? example, if you have a controller, and many actions in the controller. Would you be doing: @RequestMapping("/blah") public String SomeAction() { ApplicationContext ctx = new AnnotationConfigApplicationContext(); MyService myService = ctx.getBean("myService"); ...

spring hibernate: save form object in relation

i have table users: relation many-to-many with table role, groups i use hibernate to map with my class; <hibernate-mapping package="cbs.domain"> <class name="User" table="users"> <id name="id" column="id"> <generator class="native" /> </id> <property name="username" /> <property name="password" /> <prope...

Is it possible to pass a strongly typed model to a view/jsp page?

In spring mvc, I noticed the models are passed as a name/value pair into the ModelAndView. is it possible to create a strongly typed model and pass it to the view? this way the caller in the view can't access a string index that doesn't exist. ...

spring mvc: select tag

i have 2 table: message(id, name, content, channel_number) // channel_number is foreign key channel(number, name) // number is primary key i use hibernate to map 2 table java class public class Message { private Integer id; private String name; private String content; private Channel channel; } public class Channel { priv...

how can I integrate formBean to my Spring MVC?

My application is using Spring MVC. On the way from the Controller to the view we are taking adventage of this framwork by creating a bean of the model that is used to display the relevant properties through the JSP. On the way back however, meaning after submitting a form back to the controller, it is using a raw HTTPRequest instead o...

Harcoding view names in the controller alternative?

I am using Java EE with Spring framework. I have been setting up a test project (everything is working so far) and I currently have the following line in the controller to simply load up a view called index.jsp: return new ModelAndView("index"); This is just a test project so I'm not worried about syntax or anything like that. I am ...

Is it possible to return the output (html) of a particular controller's action?

Using spring 3.0 MVC: Is it possible to programatically execute a controller's action, and return the generated output (the html)? I want to take that output and store it in the database. ...

Logging response body (HTML) from HttpServletResponse using Spring MVC HandlerInterceptorAdapter

I am trying to log (just to console write now for simplicity sake) the final rendered HTML that will be returned by the HttpServletResponse. (i.e. the body) To this end, I am using the HandlerInterceptorAdapter from Spring MVC like so: public class VxmlResponseInterceptor extends HandlerInterceptorAdapter { @Override public void...

Reusing a template page in Spring MVC

What is the best and easiest technology from the followings? Tiles, velocity or freemaker? Thank you. ...

How do I prevent Spring 3.0 MVC @ModelAttribute variables from appearing in URL?

Using Spring MVC 3.0.0.RELEASE, I have the following Controller: @Controller @RequestMapping("/addIntake.htm") public class AddIntakeController{ private final Collection<String> users; public AddIntakeController(){ users = new ArrayList<String>(); users.add("user1"); users.add("user2"); // ... users.add("userN"...