Questions tagged [modelattribute]

315 questions
2
votes
3 answers

Multiple modelattributes in a JSP with Spring

What I am trying to accomplish is using one single form, submit multiple modelattributes with Spring and JSP. With one I know how to do it, mapping the model with the tag form:form. But, if I want to get two modelAttributes in the controller method…
dgmora
  • 1,239
  • 11
  • 27
2
votes
2 answers

@Autowired for @ModelAttribute

I'm very new to Spring and I'm encountering the following problem. I've got the following Controller, in which the @Autowired works perfectly (tried debugging and it works fine). @Controller @RequestMapping(value =…
satoshi
  • 3,963
  • 6
  • 46
  • 57
2
votes
2 answers

Spring. Binding checkboxes to ModelAttribute

Unable to bind checkboxes to @ModelAttribute. HTML:

Alexander
  • 781
  • 2
  • 9
  • 21
2
votes
1 answer

Why am I getting this message in Spring? "Neither BindingResult nor plain target object for bean name 'removedTeam' available as request attribute"

This is a simple program I am writing to understand the @RequestMapping annotations and such. I have two controllers. The home controller is the home page and renders the home.jsp. The team controller handles the team.jsp. The home page has a remove…
captainduh
  • 81
  • 2
  • 11
2
votes
1 answer

@ModelAttribute formed model cannot be used in another Controller

My UserController.java @Controller @RequestMapping("/userRegistration") public class UserController{ @RequestMapping(method = RequestMethod.GET) public String showForm(ModelMap model) { User user = new User(); …
whitehat
  • 2,381
  • 8
  • 34
  • 47
2
votes
2 answers

Spring MVC 3.0 Model Attribute Inheritance

I'm not sure if this is possible in Spring MVC 3.0, but I'm trying to create an annotated Controller that extends another Controller and whose model attributes depend on a model attribute set by the parent. For example: @Controller public abstract…
andy
  • 2,953
  • 2
  • 24
  • 26
2
votes
2 answers

Spring MVC, Tiles, Multiple Controllers

I'm experimenting with Spring MVC for an upcoming project. I'll need some web pages in the application to render multiple reusable "components" and figured that Tiles should help me accomplish this? Each component would have it's own controller.…
JokeyDave
  • 103
  • 3
  • 11
2
votes
1 answer

Spring 3.0.5 - Adding @ModelAttribute to handler method signature results in JsonMappingException

I'm not sure whether this is a misconfiguration on my part, a misunderstanding of what can be accomplished via @ModelAttribute and automatic JSON content conversion, or a bug in either Spring or Jackson. If it turns out to be the latter, of course,…
Palpatim
  • 9,074
  • 35
  • 43
2
votes
1 answer

Spring using @ModelAttribute object is empty

POST request body json value : { "id" : 452312313231, "name" : "b2", "floor": 5 } code of Building class : @Entity @Table(name = "building") public class Building implements Serializable{ private static final long serialVersionUID…
Masood
  • 909
  • 7
  • 11
2
votes
1 answer

Error SpringInputGeneralFieldAttrProcessor when using @ModelAttribute in Spring project

I am trying to update username using form. Problem is that when I am using @ModelAttribute I am getting below error: Error during execution of processor 'org.thymeleaf.spring4.processor.attr.SpringInputGeneralFieldAttrProcessor' …
erni
  • 45
  • 1
  • 10
2
votes
3 answers

how to get form values to controller in spring mvc

I am trying to get form values from jsp to controller in spring mvc, but i am not able to get form data. This is my DTO (bean) public class LoginDTO implements Serializable { private Long id; private String username; private String password; //…
laxmi
  • 83
  • 2
  • 3
  • 10
2
votes
1 answer

Empty modelAttribute after submitting a form

I have two "form" classes : Login and Registration, Registration extends Login because they share emailAddress and password fields. When I submit login form everything works fine, I don't receive an empty Login object. For Registration form, my…
Aleks Ben Maza
  • 327
  • 3
  • 12
2
votes
0 answers

spring @modelattribute polymorphism

I have two concrete classes, Person1 and Person2 extending Person. I want a spring jsp form to create a Person1 or a Person2. public abstract class Person{ } public class Person1 extends Person{ } public class Person2 extends Person{ } I…
Dariush Jafari
  • 5,223
  • 7
  • 42
  • 71