This was my first thought, but how do I get the value from within a JavaBean without
passing the Servlet class to the bean. I need this because one value is how often do
they have to change their password. I have a function isPasswordExpired that is part
of the User class.
Gerry Scheetz
Web Application Development
Global Information Technology Division
TRW - S&ITG
Helena, Montana, USA
[EMAIL PROTECTED]
(406) 594-1878
>>> [EMAIL PROTECTED] Friday, May 04, 2001 9:10:15 AM >>>
I recommend storing these values in the attributes hash in the ServletContext object.
In JSP this is accessed through the implicit application object:
String thisString = (String)application.getAttribute("myString");
For servlets you would use:
String thisString = (String)getServletContext().getAttribute("myString");
To set these values I would recommend using the Deployment Descriptor so that at
deploy time these values are set. You can also set these in a Global.jsa file in many
app servers. I would stay away from this as it, to the best of my knowledge, not
present in the JSP spec (not 100% sure on that).
Gerry Scheetz wrote:
> Hello group,
>
> I am coding a web application using the MVC design. My controller is a servlet. My
>model are some JavaBeans and a couple Java classes to access the database. My view
>is JSP files. I have a couple values that are constant throughout the application
>like application title and length of time before a password expires. These values
>are accessed within JavaBeans and within JSP files. I can think of about 3 ways I
>can code this,
> 1) JavaBean put in the application scope (tough to retrieve in another JavaBean)
> 2) Singleton class (trying to minimize code in JSP and this takes a couple of
>lines)
> 3) class with all static variables and functions (just unfamiliar with this, I
>guess)
>
> Anyway in this whole development effort, I am also setting up standards for our team
>to code to in the future, so I want to do this right the first time. Advise on which
>of my options to pursue or is there a better option?
>
> Thanks,
>
> Gerry Scheetz
> Web Application Development
> Global Information Technology Division
> TRW - S&ITG
> Helena, Montana, USA
> [EMAIL PROTECTED]
> (406) 594-1878
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
--
Erik I Morton
Software Developer
------------------
CommerceHub
http://www.commercehub.com
518-886-0704
21 Corporate Drive
Clifton Park, NY 12065
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets