Questions tagged [modelattribute]

315 questions
0
votes
1 answer

Spring: ModelAttribute doesn't get called

I have a controller used to display a list of project, but I cannot find why a @ModelAttribute method doesn't get called. This is my controller: @Controller(value = "projectListController") @RequestMapping(value = "VIEW") public class…
0
votes
0 answers

Spring aop (custom param in ControllerAdvice & ModelAttribute)

I want to add custom param to ControllerAdvice and ModelAttribute method. Please see code below. @Target( { ElementType.METHOD}) @Retention(RetentionPolicy.RUNTIME) public @interface MyPage { String param(); } @Controller public class…
Alexey
  • 517
  • 2
  • 10
  • 21
0
votes
1 answer

how to set @modelattribute boolean value inside html

the code shows below the Users value from @Modelattribute is boolean an how to set this condition
Prasanth A R
  • 4,046
  • 9
  • 48
  • 76
0
votes
2 answers

JQuery AJAX strange behaviour with parameters (Spring's @ModelAttribute)

I'm trying to pass a Map< String, String> to Spring via Ajax using @ModelAttribute notation. With IntelliJ's REST client, I just have to add the "infos[KEY]" param with value "VALUE" to get the corresponding key/value couple populated in the…
user2137101
0
votes
2 answers

What is the Scope of Bean declared in @ModelAttribute annotation

I have a table having 40 columns and one bean corresponding to that table. But on page I am displaying only 10 fields. When the page is rendered, by debugging, I can see the bean is getting populated by all fields from the table and I am adding it…
Jaikrat
  • 1,124
  • 3
  • 24
  • 45
0
votes
1 answer

Unable to populate modelAttribute in spring

I am unable to get the ModelAttribute for second request. My first request is initForm() method I prepared Command object and able to display the command in jsp. Through initForm() I am populating command and that command I want in editForm when I…
Shoaib Chikate
  • 8,665
  • 12
  • 47
  • 70
0
votes
1 answer

@ModelAttribute has no value when using with @RequestParam

I have a controller class which has below mapping and I'm trying to call this with ajax. @RequestMapping(value = "/jobs", method = RequestMethod.POST, headers = "Accept=*/*") @ResponseBody public String associate(@ModelAttribute ("job") Job job,…
Coder
  • 417
  • 5
  • 18
0
votes
2 answers

How to handle data from form in Spring MVC

I have jsp that show all posts in blog
${post.id} ${post.text}
Constantine Gladky
  • 1,245
  • 6
  • 27
  • 45
0
votes
2 answers

Spring: ModelAttribute values get lost after returning ModelAndView in

I am facing the problem, that some ModelAttribute values get lost after returning ModelAndView. Example: Here are all statistic items properly filled. I can see each correct value in debug mode. Everything seem to be fine: ModelAndView mav = new…
Tunguska
  • 1,205
  • 3
  • 18
  • 37
0
votes
2 answers

Spring Form post does not send ModelAttribute to controller

I'm still a beginner user with spring and web programming. I'm trying to create a small form that would send a modelAttribute to another page but the modelAttribute is always null. FileUploadForm.java public class FileUploadForm { …
Yan
  • 11
  • 1
  • 2
0
votes
1 answer

request and session attribute value returns null in @ModelAttribute method

Am using spring mvc i want to access an request attribute inside @ModelAttribute method but its giving only null @RequestMapping(value = "/abc", method = RequestMethod.GET, params = "data") public ModelAndView aaaa() { …
Monicka Akilan
  • 1,501
  • 5
  • 19
  • 42
0
votes
1 answer

Spring MVC @ModelAttribute @SessionAttributes - Why does a model attribute need a @ModelAttribute annotated method?

This is how it all looks now: @SessionAttributes("shoppingCart") public class ItemController { @ModelAttribute public ShoppingCart createShoppingCart() { return new ShoppingCart(); } …
akcasoy
  • 6,497
  • 13
  • 56
  • 100
0
votes
1 answer

how to hide the key in url,but not the values using Get method in Spring

I am getting the Model Attribute Object's, Key and value pair in the url,I have to hide those key-value pair or else it should be values alone. Ex:consider the following…
user2507974
  • 122
  • 1
  • 2
  • 15
0
votes
1 answer

ModelAttribute not mapping application/x-www-form-urlencoded

I have a somewhat simplistic controller configured as thus: @RequestMapping(value = "user/savearticle", method = RequestMethod.POST) public @ResponseBody Object saveArticle(@ModelAttribute("article")RawArticle rawArticle); Using snippets of code…
Cid Immacula
  • 213
  • 7
  • 18
0
votes
2 answers

Spring ModelAttribute show old value after logout

I am developing an application using Spring. I have a trouble about login and logout. I logged in application using a login credentials(e.g. userName:john, pass: doe) and go to Admin page and than I logged out from application. But this time I used…
vtokmak
  • 1,496
  • 6
  • 35
  • 66