• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

sending parameter from one controller to other

 
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody,

in my application, the student will login with one StudentID, (here --- login-controller), after he has to enroll with courses (here --- EnrollCourseController...) In enrollcontroller, i have course details only..
for submitting these requests , i need to have studentID.... How to store/send loginId from one controller to other ?

any help would be highly appreciated..
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

indu iyengar wrote:Hi everybody,

in my application, the student will login with one StudentID, (here --- login-controller), after he has to enroll with courses (here --- EnrollCourseController...) In enrollcontroller, i have course details only..
for submitting these requests , i need to have studentID.... How to store/send loginId from one controller to other ?

any help would be highly appreciated..



Well, you can place the StudentID into the HttpSession, there is also a nice Annotation @SessionAttribute you can use to have Spring go into the HttpSession and get that value out in the other controller.

Another approach is if you are using Spring Security, you can have the StudentID in the User object (UserDetails) which any Controller can get that User object through the SecurityContextUtils class as well as in Spring 3.0 use Spring Expression Language and use the "principal.xxxx" to evaluate to returning the studentId.

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic