Hi,
Is this right?
In Java API, I found some useful information.
"There is one context per "web application" per Java Virtual Machine. (A "web
application" is a collection of servlets and content installed under a specific subset
of the server's URL namespace such as /catalog and possibly installed via a .war
file.) "
I also test it with Tomcat 3.2.3.I create two webapps.one is 'test1',the other is
'test2'.In "test1", there is a javabean with "scope=application".All jsps in "test1"
can get the value of the javabean.But got nothing in "test2".
If I am wrong, please info me.
<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">
<title>
Jsp1
</title>
</head>
<jsp:useBean id="Jsp1BeanId" scope="application" class="eim_domainadmin.Jsp1Bean" />
<jsp:setProperty name="Jsp1BeanId" property="*" />
<body>
<h1>
JBuilder Generated JSP
</h1>
<form method="post">
<br>Enter new value : <input name="sample"><br>
<br><br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset">
<br>
Value of Bean property is :<jsp:getProperty name="Jsp1BeanId" property="sample" />
</form>
</body>
</html>
Regards
Gang Liu
----- Original Message -----
From: "Christof Soehngen" <[EMAIL PROTECTED]>
To: "catalin" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, September 27, 2001 4:29 PM
Subject: Re: communicating between 2 diffrent sessions
> The context is a container like a session, only that it's valid for the
> lifetime of the tomcat process and is accessible by all webpages.
> In JSP you refer to it as the "application"
>
> You could say in your Servlet:
>
> -----------------------------------------
>
> public class TestServlet extends HttpServlet {
>
> ServletContext context = null;
>
> public void init (ServletConfig config) {
> context = config.getServletContext();
> }
>
> public void doPost (HttpServletRequest request, HttpServletResponse
> response) {
>
> String parameter = (String) context.getAttribute("parameter_name");
>
> if (parameter==null) {
> parameter = "Some standard value for the parameter"
> context.setAttribute("parameter_name", parameter);
> }
> }
> }
>
> -----------------------------------------
>
> Now, in your JSP, you should be able to access the parameter as a bean with
> scope = "application"
>
> Hope there are no typos, and it helps, this could be one way to solve your
> problem.
>
> Christof
>
> ----- Original Message -----
> From: catalin <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 27, 2001 9:01 AM
> Subject: communicating between 2 diffrent sessions
>
>
> > Hello,
> >
> > I have 2 apps (one in "/webapps/myapp1"-with jsp and other
> > "webapps/root/myapp2"-with servlets) on a "jakarta-tomcat-3.3-m4" on a
> win98 OS.
> > My problem is that I need parameters that are in session of myapp2 to
> > transmmit in session of myapp1.
> > Can I do that?
> > It is possible to set the same session for both apps?
> > Thanks!
> >
> >
> >
> > --
> > Best regards,
> > catalin mailto:[EMAIL PROTECTED]
> >
>
>