spring-mvc

Parsing json into java objects in spring-mvc

I'm familiar with how to return json from my @Controller methods using the @ResponseBody annotation. Now I'm trying to read some json arguments into my controller, but haven't had luck so far. Here's my controller's signature: @RequestMapping(value = "/ajax/search/sync") public ModelAndView sync(@RequestParam("json") @RequestBody Searc...

Spring2.5 WebMVC Servlets | Can interceptor based state information be stored in handlers for each request?

We have an interceptor that checks for an allowed (mobile) user-agent. We're using an internal database for recognizing them. So I've setup an interceptor that first recognizes the user-agent and creates a Phone object keeping all its capabilities for later or redirect to an error page if we don't like the agent. The interceptor's preHan...

User Granted Authorities are always : ROLE_ANONYMOUS ??

i am using the following method to make a programmatic login after registration private void autoLogin(User user, HttpServletRequest request) { GrantedAuthority[] grantedAuthorities = new GrantedAuthority[] { new GrantedAuthorityImpl( "ROLE_ADMIN") }; UsernamePasswordAuthenticationToken token =...

How to write tag in my spring project?

I want to write my tag (extends TagSupport) in my spring framework. In my tag class, will use some service which should auto inject by spring. But I always get null, seems spring can't inject service instance in my tag class. The code is like the following: public class FetchTagNameTag extends TagSupport { @Autowired private Tas...

ModelandView 404 Problem

I can't realize why do I have 404 error while trying to access /liginform.dlp through POST method I have the following web.xml mapping: <servlet-name>doolloop</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> ...

If you learn Spring MVC 3.0, what would you need to know to get a job working with an earlier version of Spring?

I've been learning Spring 3.0 MVC. However, from the few Spring 2.x examples I have seen, there are significant differences in earlier versions of Spring. I have two questions about getting a job working with Spring: If I am reasonably confident with Spring MVC 3.0, what would I need to learn to get a job working with a version of Sp...

Spring dropped support for ExtJS, alternatives?

I've seen that Spring has dropped support for ExtJS for some time now and they went for dojo instead. So, is it still worth using ExtJS? And if so, which controller technology do you use when writing ExtJS+Java-based apps? I've heard some people saying DWR but I don't like that it autogenerates the JS code. Thanks ...

How to catch an exception and email information about it in liferay portlet

I have a custom portlet made for liferay and sometimes it throws an exception. Why it throws exceptions is irrelevant. How to catch exceptions thrown by portlet handler methods in order to email information about them? I know I could do try catching on every handler method but it would be a much more elegant and cleaner solution to catc...

How to use more than one custom filter invoked after each other ?

hi all i am using spring security 3.0.2 and i have one custom filter and its order is last and i want to add another filter after that filter, is the following config right ? <custom-filter position="LAST" ref="filter1"/> <custom-filter after="LAST" ref="filter2"/> ...

Is it possible to access Spring MVC annotated session vars across multiple controllers?

I have a web app running Spring 3.0 and using Spring-MVC. I have a few controllers set up like this: @Controller @RequestMapping("/admin") @SessionAttributes({"clientLogin", "selectTab", "user", "redirectUrl"}) public class AdminController { ... } @Controller @SessionAttributes({"clientLogin", "selectTab", "user", "redirectUrl"}) publi...

Spring MVC urls without .something extension

Hi all, First off, if this is a duplicate, I apologize. I did quite a bit of searching but couldn't find much and I suspect I wasn't using the right terms... I'm building a site with Spring MVC and using the annotation-driven configuration. What I'd like to do is have urls that do not have any extension at the end (.html, .do, etc). ...

HTTP 500 Response with Body?

Hi, I have a RESTEasy service that returns a HTTP 500 when a server side error occurs. I manage to attach a body to the HTTP response in order to give more details about the error. So the response that comes out of the service looks something like this HTTP/1.1 500 Internal Server Error Server: Apache-Coyote/1.1 Content-Type: applicat...

is jersey a better choice for ExtJS than Spring MVC?

What are the advantages/disadvantages of using Jersey with ExtJS than to use Spring MVC? Any of you using this combination of frameworks? Please share some insights. Thanks. ...

Spring MVC Multiaction Controller getParameter returning null

I am new to Spring MVC, need guidance My jsp is like : <form:form name="form1" method="post" action="input.htm?method=getHealth"> ....... <td > <form:select path="envList"> <form:options items="${envList}"/> </form:select> </td> My .java is like: public class InputController extends MultiActionController { public ModelAndView ge...

SpringMVC MultiactionController :How to fetch values from drop down in .java

I am new to Spring MVC, need guidance My jsp is like : ....... <form:select path="envList"> <form:options items="${envList}"/> My .java is like: public class InputController extends MultiActionController{ public ModelAndView getHealth(HttpServletRequest request,HttpServletResponse response) { ....................... ...

Recommended data model and data source for a Spring MVC website administration / configuration page?

I am interested in having a web configuration/admin page for a website. Is it more common to store a websites configuration in a database, xml, or .properties files? What does the data model (classes) usually look like? If stored in a file, is concurrent access typically handled and how? Are there any good examples for a generic site a...

Spring: Is default-init-method inherited from parent application contexts to child contexts?

<beans default-init-method="init"> //... </beans> If I define default-init-method in the parent application context will it be inherited by the child contexts such as a web application context? Or do I need to define default-init-method in each context XML? ...

How to obtain model attribute or spring's bean in sitemesh decorator?

Hi, I am using Spring 3 with sitemesh. I would like to refer to spring context bean in decorator page defined in sitemesh. The problem is that SiteMesh filter is working outside the Spring context, so request object on sitemesh decorator jsp page is native HttpServletRequest and not wrapper with useful functions to access context and e...

Unable to locate Spring NameSpaceHandler - Spring's mvc-basic in equinox using MANIFEST.MF similar to web-console Spring DM sample webapp

Trying to deploy Spring's mvc-basic in Equinox container. Brief error (full below): org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context] Offending resource: ServletContext resou...

Spring MVC - command object binding question

Hi, I'm using a domain object as a command object in the web layer. In one case, this command object is backing a form that represents a partial update of the domain object. @RequestMapping( value = "/club/edit", method = RequestMethod.GET ) public String setupEditClubForm( ModelMap model, @RequestParam( "clubId" ) Long clubId ) { C...