Java/JSP Global Variables

JSP

To set

application.setAttribute("key","hello");

To get

application.getAttribute("key").toString();

Java (you could do this in JSP actually)

Create a class with static variables.

public class GVariables() {
   public static String key="hello";

}

To use;

String sMode=new GVariables().key;
Advertisements

About Paul C

I am a Senior Java programmer/Web Technologies, Play in a band called Mandolin Monday, I have a cat and I live on a boat.

Posted on July 25, 2011, in Howto. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: