answersLogoWhite

0

You can't. Sessions are a server-side technology. To properly implement a session, you have to use a server-side language like PHP, ASP, or Ruby.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

Set and get session attributes syntax in servlets and java script?

Setting and getting session attributes is fairly easy. It is the same in both Servlets and JSPs with one exception. In a JSP, you already have access to the session object, and you do not have to declare it. In a Servlet, you must get the session like this: javax.servlet.http.HttpSession session = request.getSession(); Once you have done that, you can set a session object like this: session.setAttribute("name","value"); To retrieve the value, do this: String foo = (String) session.getAttribute("name"); A couple of things to keep in mind: * The second parameter in the setAttribute method is an Object, not a String. When you retrieve the value, you have to cast it. In the example above, I am casting it to a String. * If you try to perform a getAttribute on a session attribute that does not exist, or was not set, it will return a null. * Session attributes are not available using JavaScript. You can not set or get an attribute in JavaScript. * You do NOT need to do the 'session = request.getSession() in a JSP. It is only necessary in a Servlet.


What annotation do you use to declare a business interface as a local interface in a stateless session bean?

@Local


Java projects which does not use database?

JavaScript is a computer language that is mostly used in web browsers. An example of JavaScript project without a database is called a login session, this requires a lot of hard coding and requires a lot of multiple ID comparison.


How do you declare global variable in dot net?

I use the session .... Session["var"] = some value or object. Then you can call that variable any time for the users Session. EDIT: Make a public static variable outside of a method and just in the Class.


What are disadvantages of javascript?

In short: disabling JavaScript (and similar coding) in your browser will break the internet. A good section of the web uses JavaScript, either to enhance the experience of its users or to manage security (for instance, session control.) Some sites will have been built in a manner that "degrades gracefully" while others that rely on JavaScript simply won't function.


How can you declare the variable in PHP?

Variables in PHP do not need to be declared like some languages (e.g. JavaScript). This is all that needs to be done to assign a variable: $variable = "Value";


Is there any way to declare and use variables in HTML As in being able to type a number into a text box and having html calculate the answer?

No. You can use Javascript for client side calculations


What is a javascript tutorial?

A JavaScript tutorial contains instructions that will teach you how to code in JavaScript.


What languages can a browser understand?

HTML, CSS, & JavaScript.


What are built-in javascript classes?

Javascript does not have classes


How old is Javascript?

Javascript was created in 1995.


How do you sort in javascript?

Javascript can help in browseing