My controller's action looks like:
@RequestMapping(value = "/tp/{userid}")
public ModelAndView TestParams(@PathVariable("userid") String userId) {
ModelAndView mv = new ModelAndView("testparams");
mv.addObject("userid", userId);
return mv;
}
My Jsp simply is suppose to output the {userid} value in ...
First I have a Spring 3.0 controller with a method similar to the following.
I'm passing the view an object named "message" and hoping to print that message via the view if it has been set by the "doStuff" method.
@RequestMapping("/index")
public ModelAndView doStuff() {
ModelAndView mav = new ModelAndView();
Map<String, String...
i configure my messageconverter as Jackson's then
class Foo{int x; int y}
and in controller
@ResponseBody
public Foo method(){
return new Foo(3,4)
}
from that i m expecting to return a JSON string {x:'3',y:'4'} from server without any other configuration. but getting 404 error response to my ajax request
If the method is an...
I have two class definitions in my Spring MVC web application named Class and Object respectively:
public Class {
//instance variables
int classId;
int className;
}
public Object {
//instance variables
int objectId;
int objectName;
}
I also have a service that that returns a list of Class and Object defined as follows.
pack...
I have a simple Spring web flow application created. When the application starts, I get the following error on my Tomcat server:
SEVERE: Servlet.service() for servlet dispatcher threw exception java.lang.NoSuchFieldError: WEB_APPLICATION_CONTEXT_ATTRIBUTE
at org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(Servle...
Hi,
I'm trying to get started with JAVA/Eclipse/Spring MVC but can't seem to find a "dummies" or "step-by-step" guide for setting everything up and creating the simplest proof-of-concept application.
I found http://static.springsource.org/docs/...-step-by-step/ but there seem to be differences between Spring 2.5 and Spring 3 so i'm loo...
I get three errors in 2 of my .jsp pages namely:
Line 1:
<%@ taglib prefix="spring" uri="/spring" %>
Errror message: Can not find the tag library descriptor for "/spring"
Line 2:
<%@ taglib uri="http://displaytag.sourceforge.net/" prefix="display" %>
Error message:
Multiple annotations found at this line:
- Can not find the t...
I realise my handler "methodHandlerName" has an argument HttpSession session which is why my spring mvc application throws the error:
Pre-existing session required for handler method "methodHandlerName"
But where in my application would I have to set a session. I presume there's no session in my application is it's set to false by defau...
Hi!
I am trying to get request parameters on freemarker page. But I can't figure out how to setup implicit variables like RequestParameters or so.
Here is a thread http://forum.springsource.org/showthread.php?t=32846 but I don't where he setup that RequestParameters object.
The only thing I found in docs (more in source code), that ...
I have a Spring MVC web application that is generating a report on the server, once the report is generated, I need to enable a button that allows the user to download it. I am not sure how to go about doing this.
I figured that I will have to spawn off a thread that will just keep checking for the existence of the file and use javascr...
I'm trying to enable Spring Security 2.5 in my spring app but am running into configuration problems. I've followed a few examples and have done what they are doing, but I think something else I have configured is causing problems.
Here is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XML...
Hi, Is there a way to bind beans properties for another type of bean using the spring's form.select.
Example:
I have a bean that needs to be updated in the view with a property called BeanB:
public class BeanA {
private BeanB bean;
private int id;
private void setId(int id){
this.id = id;
}
private int getId(){
...
Hello everybody.
Consider the following simple example:
One team has many players and a player may only belong to one team.
@Entity
public class Team {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "team")
@Cascade({ org.hibernate.annotations.CascadeType.ALL,
org.hibernate.annotations.CascadeType.DELETE_ORP...
I am trying to use AbstractExcelView to serve an XLS document that I create on a server. Is there a way I can use this with an already constructed workbook? I tried the following but it doesn't work:
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import ja...
I would like to use the @RequestParam annotation like so:
@RequestMapping
public void handleRequest( @RequestParam("page") int page ) {
...
}
However, I want to show page 1 if the user fiddles with the URL parameters and tries to go to page "abz" or something non-numerical. Right now, the best I can get Spring to do is return a 50...
Hi,
I want to use multiple view resolvers in my web app based on spring mvc
Can anyone tell me how do I achieve that.
I want to use both JSP and freemarker in my app.
Please suggest some approaches or links or examples..
All help is appreciated.
Adhir
...
Hi
I have a Spring sample application. In the controller,I'm having a
ModelMap map = new ModelMap();
map.put("samplebean", sampleBean);
Where samplebean is a bean .
I have a tag which has an attribute name. and the name is actually the bean name.
In jsp if I access alert('${samplebean.value}'), then it alerts the correct value. But th...
I am using Java with Spring framework. Given the following url:
www.mydomain.com/contentitem/234
I need to map all requests that come to /contentitem/{numeric value} mapped to a given controller with the "numeric value" passed as a parameter to the controller.
Right now in my servlet container xml I have simple mappings similar to t...
I use SecurityContextHolder and a custom UserDetailsService to obtain UserDetails from SecurityContextHolder:
Object o = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserDetailsDTO user = (UserDetailsDTO) o;
I left out the null checks, etc., but that's the idea. I'm using this in an @Around pointcut of an @A...
I am trying to create a RESTful controller using Spring 3.0. The controller is for a management API for a portal application. The operations I want to perform are:
GET /api/portals to list all the portals
POST /api/portals to create a new portal
GET /api/portals/{id} to retrieve an existing portal
PUT /api/portals/{id} to update an exi...