spring-mvc

Spring root WebApplicationContext for Servlet

I have a webapp that uses SpringMVC DispatcherServlet to load a WebApplicationContext. The Spring reference documentation says: "each DispatcherServlet has its own WebApplicationContext, which inherits all the beans already defined in the root WebApplicationContext. These inherited beans can be overridden in the servlet-sp...

In Spring how do you get the current user whose credentials are not part of the current http request?

Is there a "getCurrentUser" method in Spring to access the user that is currently part of a request - even if that user's name is not being passed around as part of a web request? ...

Is request.getMethod().equalsIgnoreCase("post") a bad idea in a (pre-Spring-3.0) Spring blog app?

In Spring 3.0 annotations allow you to specify the blog post method as a url. But prior to that version of Spring, is this the best way to achieve it: @SuppressWarnings("unchecked") public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse arg1) throws Exception { ModelAndView mav = handleRequestInternal(reques...

spring mvc annotation - object missing values on post

I have a domain object with 5 property. I preload the object in my GET method and display just one of the property in the form. When the form gets submitted, the object contains only one property with value. How do I get the remaining properties and their values without putting a hidden variable for each property in my form. ...

spring mvc annotation - dummy form variable

I have a form with two select boxes that are used to move values from one box to another. I need to submit values only from second select box to my ModelAttribute. How do i prevent spring mvc from complaining about "unable to bind" on my first selectbox. ...

Controller that simulates spring:message tag?

I'm designing help/hint system for my webpage, I'd like to incoroporate jQuery based contextual help. My idea is that I would post request on event and show given repsonse in special div or so. I would like to get similiar behaviour as <spring:message> tag, post message code and get String representation on localized message. It woul...

Spring MVC @PathVariable getting truncated

I have a controller that provides RESTful access to information: @RequestMapping(method = RequestMethod.GET, value = Routes.BLAH_GET + "/{blahName}") public ModelAndView getBlah(@PathVariable String blahName, HttpServletRequest request, HttpServletResponse response) { The problem I am experiencing is that i...

Change all links on a page to point to login with Spring MVC

This is more of a discussion, rather than a real question... I'm building a site and I am struggling with how to force a user to login to the site to access certain areas and take certain actions. I'm using spring security and have it integrated fairly well, however, I also have some AJAX calls that need to be secured and when Spring Se...

Display sub-property in table tag (Spring Roo supplied tag library)

I am using Spring Roo. There is table:table and table:column tags. How to display sub-property of colections elements in table? In straightforward way it doesnt work: <table:table data="${knowledgebase.concepts}" id="l_domain_Concept" path="/concepts" z="user-managed"> <table:column id="c_domain_Concept_translations" property="defau...

Problems using this method in another class

Best of all, I am using IntelliJ 8.3 with Spring MVC, and I have a problem, my WelcomeController.java is my driver and I want to use the methods that are in CatalagFacadeImpl.java but will not let me, I do not know, please help Note: My WelcomeController, java is in HTML-> src-> package.web-> WelcomeController.java my controller. The v...

Jackson (JSON) throws JsonMappingException when Float is null

Hi I am using Spring (with Jackson) and jQuery to pass a form as an object. My pojo includes nullable floats. However, when the fields are empty, Jackson throws an Exeption: org.codehaus.jackson.map.JsonMappingException: Can not construct instance of java.lang.Float from String value '': not a valid double value What do I have to do ...

Spring MVC AbstractWizardFormController Question

I am using a controller implementation that is extending the Spring MVC AbstractWizardFormController This wizard controller will consist of 4 pages. The first 2 pages are used to collect information. The third page will show results based on what information is submitted on page 1 and 2. So to be a little more specific Page 1 the us...

No adapter for handler in Spring MVC

Hi, I have problem with simple spring mvc controller written in scala: @Controller class HelloWorldController { implicit def sessionFactory2Session(sf: SessionFactory) = sf.getCurrentSes @Autowired var sessionFactory: SessionFactory = null @Transactional @RequestMapping(value=Array("/hello.html"),method = Array(RequestMethod.GE...

Map multiple request parameters

Hi, i'm sending two parameters using GET (through URL) and woul like my request method to receive them like this ... @RequestMapping("/basketItems") public String basketItems( @RequestParam("fname") String firstName, @RequestParam("lname") String lastName, Model model) { Customer customer = customerManager.getCustomer...

Turkish Character Encoding Java Spring MVC

Hi all, i am working on an Spring MVC project and as always turkish characters cause a problem (I hate encoding =)) My DBMS is oracle express 10 g i use spring source tool as IDE -- i am not sure these are useful information The problem causes from a single 'ı' character for now. Pages show ı's as ?s. I checked out the database it is ...

AbstractWizardFormController: java.lang.NullPointerException at processFinish(...)

Hi, Could someone please help me understand that why am I getting this error at RegisterServiceProviderController.java when processFinish(...) method is called? java.lang.NullPointerException at com.inception.web.RegisterServiceProviderController.processFinish(RegisterServiceProviderController.java:66) at org.springframework.web.servl...

Asynchronously pull data from datastore and draw map

Hi, I have a Spring MVC 3 app (that uses JSP) running on Google App Engine and saving information on the Datastore. I'm using the Google Maps API v3 to project some of the data on maps by drawing shapes, colouring etc. My database will potentionally hold millions of entries. I was wondering what the best way is to keep pulling data fro...

(Question about 'final' and) How do I access the list object contents of 'myModels' from the Spring ModelMap in JSTL?

@RequestMapping(value = "/index", method = RequestMethod.GET) public final String index(final ModelMap model) { List myModels = ArrayList<MyModel>(getMyModels()); model.addAttribute("mymodel", myModels); return "index"; } In Spring I put the myModels list into the ModelMap to be passed to the "index" view. How do I t...

Spring: Proper way to make the Model available to the Controller?

Given the following controller, @Controller public class MyController { ... @RequestMapping("/data") public @RequestBody Data getData(@RequestParam String id) { return myCustomModel.queryForData(id); } } what is the proper way to configure it so that myCustomModel (something that is queried for Data) is ...

AbstractWizardFormController: teasing command object

Hi Could I use a non-persistent domain object as a command object in spring mvc and have an instance of a persistent(made persistent using @Entity annotation in the domain class) object in it and have its (persistent object) data made persistant in a database? I am using AbstractWizardFormController for my application and it shows the ...