Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Spring
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Liutauras Vilda
Paul Clapham
Sheriffs:
paul wheaton
Tim Cooke
Henry Wong
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Piet Souris
Bartenders:
Mike London
Forum:
Spring
Having problem in ModelAttribute and Pathvariable Annotation
Anupam Dee
Ranch Hand
Posts: 42
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
@RequestMapping(value="/viewdata/{id}") public String getData(@ModelAttribute("data") String s, @PathVariable int id){ String path="reply"; if(id==1) s="abcde"; else s="fghhi"; System.out.print(id); return path; }
now when in my browser i type
http://localhost:8080/Temp1/viewdata/1
i get a blank page
my reply.jsp has following contents
<body>
${data}
</body>
Is there a problem with ModelAttribute or Pathvariable?
Please help
Mark Spritzler
ranger
Posts: 17347
11
I like...
posted 10 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
If debug symbols are in your code, the @PathVariable should work. But even with it, I always state the path variable name like
@PathVariable("id")
Also if you connect your remote debugger you can set a break point and step through it to see what the values are being set to.
Also when you page does get rendered. Look in the view source to see if there is something there that just the browser isn't displaying (maybe)
Mark
Perfect World Programming, LLC
-
iOS Apps
How to Ask Questions the Smart Way FAQ
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
?
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Problem with RequestMapping
List Binding -- form:checkboxes
spring mvc form submitting and many-to-one relation
Spring model attribute is not populating values
New value is inserted into db in @ManyToOne relation instead of update
More...