get static variable from class into JSP tag scope

R

Robert Mark Bram

Hi All,

I have a static variable in a class that I wish to share with some of
my JSP code. Can I use the <jsp:useBean> (or any tag?) to get that map
into the scope of my JSP tags?

Thanks for any assistance,

Rob
:)
 
L

Lew

Robert said:
Hi All,

I have a static variable in a class that I wish to share with some of
my JSP code. Can I use the <jsp:useBean> (or any tag?) to get that map
into the scope of my JSP tags?

<jsp:useBean> requires that the bean be in scope, i.e., entered into the
context of the page, request, session or application, e.g., via
<http://java.sun.com/javaee/5/docs/a...Attribute(java.lang.String, java.lang.Object)>

You can also use Expression Language (EL) to access such beans.

You could also use scriptlet, but don't.

You could also use Java Server Faces (JSF), which has a way to directly
connect component attributes ('value', 'binding', 'action') to bean methods
and attributes. There is a learning curve involved there.
 
H

Hal Rosser

Robert Mark Bram said:
Hi All,

I have a static variable in a class that I wish to share with some of
my JSP code. Can I use the <jsp:useBean> (or any tag?) to get that map
into the scope of my JSP tags?

Thanks for any assistance,

Rob
:)

try
<%@ page import = "yourpackage.YourClass" %>
 
R

Robert Mark Bram

Hi Hal,
try
<%@ page import = "yourpackage.YourClass" %>

Sorry, I should have been more specific - I wanted to get the value
into the scope of my jsp tags, not a scriptlet. Thank you for your
response though. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top