Solved

URGENT: Spring mvc: create a session

Posted on 2009-05-18
2
1,901 Views
Last Modified: 2013-11-11

Hi,
i have a simple web application using Spring mvc and spring framework and everything is working just fine. I would like in the controller of the first page (login page), when a user successfully logs in to create a session in the onSubmit method, and pass a parameter (the user id) in that session. All of the following pages should be able to get that parameter user id to use it. How can i create that session?
Thank you
0
Comment
Question by:nick0306
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
Comment Utility
HttpSession session = request.getSession(true);
session.setAttribute("userId",userId);

0
 

Author Comment

by:nick0306
Comment Utility
thnx
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now