Hi All,I have a static variable in a class that I wish to share with some ofmy JSP code. Can I use the <jsp:useBean> (or any tag?) to get that mapinto the scope of my JSP tags?Thanks for any assistance,Rob:)
|
|
0
|
|
|
|
Reply
|
Robert
|
1/22/2008 11:06:29 PM |
|
Robert Mark Bram wrote:> 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/api/javax/servlet/ServletRequest.html#setAttribute(java.lang.String,%20java.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.-- Lew
|
|
0
|
|
|
|
Reply
|
Lew
|
1/23/2008 1:21:34 AM
|
|
"Robert Mark Bram" <robertmarkbram@gmail.com> wrote in message news:c322a79f-7b5a-4af2-8a02-dbe0abea6c84@s13g2000prd.googlegroups.com...> 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" %>
|
|
0
|
|
|
|
Reply
|
Hal
|
1/23/2008 5:59:28 AM
|
|
Hal Rosser wrote:> "Robert Mark Bram" <robertmarkbram@gmail.com> wrote in message > news:c322a79f-7b5a-4af2-8a02-dbe0abea6c84@s13g2000prd.googlegroups.com...>> 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" %>> > > And after that:<%= YourClass.VALUE %>-- Regards,Jonatan KazmierczakSCJP SCJD TC_rated_member Linux_userAsm86 Bash C/C++ Java JavaScript Pascal Perl PHP Ruby TCL VB VBS XSLT
|
|
0
|
|
|
|
Reply
|
Jonatan
|
1/23/2008 5:45:04 PM
|
|
Hi Hal,> try> <%@ page import = "yourpackage.YourClass" %>Sorry, I should have been more specific - I wanted to get the valueinto the scope of my jsp tags, not a scriptlet. Thank you for yourresponse though. :)
|
|
0
|
|
|
|
Reply
|
Robert
|
1/23/2008 10:30:07 PM
|
|
Thank you Lew,> > 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/api/javax/servlet/ServletRequest.ht...)>This supports the MVC pattern quite strongly, so I am not asdisgruntled as I was at first - now I see a reason for it. :)
|
|
0
|
|
|
|
Reply
|
Robert
|
1/23/2008 10:32:24 PM
|
|
|
5 Replies
578 Views
(page loaded in 0.103 seconds)
|