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