spring-mvc

Sping-Hibernate question

I have been handed a large Spring-Hibernate project and have been told to go through the code and figure out how it works. I have been able to run the project in JBoss and access pages locally, but I have no idea how to figure out how the program is layed out, as I have no web programming experience. I have been told that it is "pretty...

Spring @Controller and Transactionmanager

I'm having a basic Spring Controller package org.foo; @Controller public class HelloWorldController implements IHelloWorldController { @RequestMapping(value = "/b/c/", method = RequestMethod.GET) public void doCriticalStuff(HttpServletRequest request, HttpServletResponse response){ //... } } Tested via curl -X GET htt...

Spring @Controller Unittest @RequestMapping

Having a basic Spring Contoller i'd like to Unittest the Request Mapping (not the Method itself), if the doCriticalStuff Method is indeed called package org.foo; @Controller public class HelloWorldController implements IHelloWorldController { @RequestMapping(value = "/b/c/", method = RequestMethod.GET) public void doCriticalStuff...

How to avoid hard linking Frontend assets In Spring MVC

I am new to spring MVC coming with experience using PHP MVC frameworks and ROR. I am having a hard time finding the appropriate way to organize and include front end assets into the view templates. Here is the default code Roo produces for the default style sheet: <spring:theme code="styleSheet" var="roo_css"/> <spring:url value="/${r...

Having Multiple forms on spring MVC

Hi All, I have this question about Spring MVC 2.5. Oftentimes, I am only using one form in all my JSP. Now I need to add another form into the same JSP. My question is, will spring mvc still support the same lifecycle method whichever form I submit? I mean, the same databinding, validation, errorhandling, form controller etc? <div>...

Help need to get spring mvc going with IntelliJ

So I downloaded a trial of idea ultimate, and I want to get spring mvc going with tomcat. So I setup a new project, configured it to use sun jdk. I chose a spring application, and it created and downloaded the following: I don't see any spring-mvc libraries, are they included in there or do I have to do something about that? Can so...

Why can't I use Spring:url in an href?

I have seen several examples using <a href="<spring:url value='/about/' />" >About </a> I try this and get an error from Jetty Caused by: org.apache.jasper.JasperException: /WEB-INF/views/footer.jspx(6,22) The value of attribute "href" associated with an element type "null" must not contain the '<' character. Is there some encodi...

Spring form:option

Is there any way to mark an option as selected by default, much like the selected attribute in the HTML option tag like <option value="value1" selected>? ...

when setting up a web app in IDEA, can someone help me with Facets/Modules and Artifacts.

using IDEA ultimate, how would I start a project and have the following layout: /src/ /src/main/java/com/example/myapp /src/main/resources /src/main/webapp /src/main/webapp/META-INF /src/main/webapp/WEB-INF /src/main/webapp/WEB-INF/jsp /src/main/webapp/WEB-INF/lib /src/main/webapp/WEB-INF/myapp-servlet.xml /src/main/webapp/WEB-INF/web.x...

Spring MVC AJAX and JSON using Custom View Resolver, and Custom View

custom view: public class MyView extends AbstractView { .... awesome stuff ... } controller: @RequestMapping(value="mylocation") public ModelAndView dosomething() { ... modelAndView.setView( new MyView() ); return modelAndView; } For some reason this doesn't work... The only view resolver I have is the following: <bean cl...

spring exception

Hi, I am following this tutorial http://static.springsource.org/docs/Spring-MVC-step-by-step/part4.html to try and learn Spring. Everything worked fine but when i got to part4 and made the changes at section 4.3 i get a runtime exception SEVERE: Context initialization failed org.springframework.beans.factory.CannotLo...

How to do the model part in a Spring MVC?

Hi, I am working on a tutorial problem using Spring MVC, with another teammate for an internship. I'm not familiar with Spring (that's why I'm learning it) We first wrote the code without any framework support, plain old hand-written MVC We are using Spring 2.5, and integrated Hibernate, used the Autowire, Controller, Repository annota...

SavedRequest problem ?

greetings all i have a strange problem with SavedRequest SavedRequest savedRequest = requestCache.getRequest(request, response); String targetUrl = savedRequest.getRedirectUrl(); i have a submit form and when the user try to post and user session is over he goes to the login page then after successful login he passes on a handler in t...

First steps with freemarker with spring mvc

So I have Index action in my HomeController.java class. I have my freemarker templates in: /web-inf/ftl/test.ftl How can I load the template? I have this in my appname-servlet.xml: <bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="suffix"> ...

When using .jsp's view spring mvc, and passing ModelAndView, how to output model?

If I have a modelandView like: ModelAndView mav = new ModelAndView(); mav.setViewName("index"); mav.addObject("message", "hello, world"); return mav; In index.jsp, how do I output the value of "message"? And what if I passed in: mav.addObject("user", currentUser); It seems the docs jump straight into forms handling. ...

A wizard with spring MVC

I'm developping a web application with Spring MVC, and i need to develop a new model as a wizard; first i have to load a file and extract informations from this file, after i have to edit these informations, and doing other operations, and i have to finish the process by doing other traitement. I'm looking on internet i found AbstractWiz...

Using Spring and Jackson to Render JSON without affecting all Views

http://stackoverflow.com/questions/3121252/spring-mvc-ajax-and-json-using-custom-view-resolver-and-custom-view Here I've gotten a view to display JSON by adding ".json" to the end of a URL, but using this method a visitor to the site can just put .json at the end of any URL they please and often it will result in an exception that gives...

How to create two instances of the same spring controller, each with a different base @requestMapping

I have a spring controller (MyController) which servers data as json. With a few configuration changes, I will be able to reuse the same controller and have it serve the same data, but as xml, not json. I'd love to be able to create myControllerInstanceA, and configure it to use /json as a base url, then create myControllerInstanceB an...

Creating your own custom helpers with Freemarker?

From my controller I set my Model and view like: ModelAndView mav = new ModelAndView(); mav.setView("index"); mav.addObject("user", user); mav.addObject("someCollection", someCollection); return mav; Now I want to create a helper type object that will take the someCollection and the user object as parameters. My helper function wi...

Freemarker with spring mvc, so what will my action look like?

In my appname-servlet.xml I have: <!-- freemarker config --> <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> <property name="templateLoaderPath" value="/WEB-INF/freemarker/"/> </bean> <!-- View resolvers can also be configured with ResourceBundles or XML files. If you need...