Re: stupid question

2003-02-18 Thread Vikramjit Singh
Rather this is a very interesting question but not related to jsp
specifically.
In one simple word the answer is yes you can lock a static variable.
First, any member variable that you wish to make thread safe must be
declared private. Consider the following code:

public class MyPoint
{
public int x;
public int y;

public int getX()
{
return x;
}
public int getY()
{
return y;
}
public synchronized setX(int x)
{
this.x = x;
}
public synchronized getY(int y)
{
this.y = y;
}
}
If this were an ideal world, everyone would set x and y by calling setX()
and setY(), respectively. However, we all know that someone will come along
and set x or y directly, since we defined the members as public. And since
we defined x and y as public, it is reasonable for someone to come along and
access the variables directly. If we didn't want someone to access the
members directly, we shouldn't have declared them as public in the first
place! The only way to guarantee that threads will access x and y safely is
to declare them as private and provide synchronized access.
Nothing changes when you declare a member static. If you don't want some
thread to come along and bypass your careful synchronization, don't declare
the member public or protected.
Now, the question remains: how do we lock the member? Sometimes I think that
part of the confusion around synchronization stems from a misunderstanding
of what actually happens when you call synchronized(some_object). Calling
synchronized on some_object does not prevent access to some_object. Instead,
you must think of synchronized as a request to open a lock around some piece
of code for your thread. some_object is the lock that you wish to have
access to. Only one thread may hold a specific lock at any one time.
Making a static member thread safe is fairly simple once you understand what
really happens when you call synchronized. Here is a template to follow
(there are many more ways to do it, though):

class Safe {
... other class definitions ...
private static  var;

public final synchronized static setVar( val)
{
var = val;
}
}
As a second option, you can also synchronize within the method. Which
approach you take will depend upon your code. However, in this example,
either way is equivalent, since a synchronized static method grabs the lock
on the class. You would use the second option if you were doing a lot of
processing inside of the method. That way you only synchronize when you have
to -- thus improving performance.
You would need to use synchronization within the method if you didn't want
to declare setVar() static. A nonstatic method declared as synchronized
locks on the instance, not the class. So, if you had more than one instance,
the member would no longer be thread safe.

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of ROLDAN, Gabriel raul
Sent: Monday, February 17, 2003 6:59 PM
To: [EMAIL PROTECTED]
Subject: stupid question


excuse this stupid and out of topic question, but.. ¿are static methods and
fields synchronized?

=
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: Production Server.

2003-02-18 Thread Vikramjit Singh
This is one question i just gave the answer to recently.. Yes tomcat 4.x is
quite stable and you can use it in a produdction env. I have deployed my
site in tc and till now no problems as such.
You could integrate TC with IIS on NT or with Apache.
You can check the following sites:

http://webperformanceinc.com/library/ServletReport/
http://www.sdtimes.com/news/063/story2.htm

cheers!
vikram.

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Omer Tariq
Sent: Tuesday, February 18, 2003 12:12 PM
To: [EMAIL PROTECTED]
Subject: Production Server.


Hi there.
I'm new to servlets and JSP and would like to know whether Tomcat is a good
production server. The application is an Internet Accounts and Management
System for hotels to enable them to charge guests according the the amount
of time the connection was enabled for them (Switches shall be accessed via
an SNMP API). No. of users would be 5- 10 (max).

Thanks and regards,
Omer


_
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: database connection problem

2003-02-18 Thread Raju BSN
Hi,
To configure the connections , thr is basically to steps.

1. Create a Connection pool by giving the details of ur database and driver.
2. Create a Data Source with a JNDI name.
In ur Java class just use the JNDI name od the Data Source u have configured
to lookup
u can find the sample code in weblogic examples

all the best
Raju BSN
- Original Message -
From: "Shivan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 18, 2003 11:18 AM
Subject: Re: database connection problem


> hi
> i am using bea weblogic for servlets and jsp. i have successfully
installed
> mysql and driver from web.
> I have installed the connectorJ driver and added it's jar to the
classpath.
> Anyone, working with this bea weblogic server in particular? where to
> mention mySQL db connections and what? i don't know how to see the
> connections of database-driver are successful with weblogic. please help!
> thanks
>
> -Original Message-
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Partha Ranjan Das
> Sent: Sunday, February 16, 2003 9:03 PM
> To: [EMAIL PROTECTED]
> Subject: Re: database connection problem
>
>
> Hi,
> Why are you returning Connection in the finally block? return it as usual
> outside the finally block. And also throw the Exception from catch block
so
> that you are aware that exception has really occured. Then handle it
> accordingly in the client.
> regards,
> Partha
>
> -Original Message-
> From: Deepak [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 17, 2003 10:22 AM
> To: [EMAIL PROTECTED]
> Subject: database connection problem
>
>
> Hi
>
> I am facing a frustrating problem here.
> I am having a login screen. When users enter username and pwd they are
> validated against a database (mysql). Everything is working perfectly.
> but some times users get a null pointer exception when they are logging
in.
> I suspect that the connection object being returned is null sometimes.
> but why is it occuring only some times ? other times eeverything is
working
> fine.
> I am using a class to connect to the db.
> Please read the code for the class belwo
>
> ***
> import java.sql.*;
> public class DBConnector{
> public Connection conn;
> public  Connection connect() throws java.sql.SQLException{
> try{
> Class.forName("org.gjt.mm.mysql.Driver");
>
>
conn=DriverManager.getConnection("jdbc:mysql://192.168.0.4/WEBDB","test","te
> s
> t");
> }catch(Exception e){
> System.out.println(e.toString());
> }finally{
> return conn;
> }
> }
> }
> *
>
> In my login validation jsp page I use this line of code to connect to the
db
> DBConnector dbc=new DBConnector();
> conn=dbc.connect();
> SQL="select UserCode from t_users where
> Password=password(?)";
> pstmt=conn.prepareStatement(SQL);
>
> approximatley 200 users access my web application.
>
> Can you please explain whats wrong in my approach? Its kinda critical to
me.
> Any help wud be invaluable
> Thanx in advance
> Deepak
>
>
===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com
> *
> Disclaimer: The information in this e-mail and any attachments is
> confidential / privileged. It is intended solely for the addressee or
> addressees. If you are not the addressee indicated in this message, you
may
> not copy or deliver this message to anyone. In such case, you should
destroy
> this message and kindly notify the sender by reply email. Please advise
> immediately if you or your employer does not consent to Internet email for
> messages of this kind.
> *
>
>
===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com
>
>
===
> To unsubscribe: mailto [EMAIL PROTECTED] 

[no subject]

2003-02-18 Thread Snehal Pandya
Hi Gurus,
I am new be in the Beans Programming with JSP.
I want to use the Beans in my application .
I have to retrieve the Group code and then from the group no get the Items
from the Item Master.
How I can use beans for this  purpose? If I will pass the result set I got
the array of the Items .
But it will occupy the Resources on the server.
What is the feasible solution for this Problem ?
How to do this ?
Please help me  and show me the path.
Thanks in Advance..

Snehal



-

The secret of getting ahead is getting started.
The secret of getting start is
breaking your complex overwhelming
tasks into small manageable tasks,
and then starting on the first one.

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: stupid question

2003-02-18 Thread Amit Ghaste
vikramjit, I think he meant it in relevance to JSP.

correct me if I am wrong Roldan, but did u mean declaring static variables
and/or static methods declared in a jsp page...

if so no, you will need to implement synchronization... consider performance
and benefits of the approach as well.

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Vikramjit Singh
Sent: Tuesday, February 18, 2003 12:13 AM
To: [EMAIL PROTECTED]
Subject: Re: stupid question


Rather this is a very interesting question but not related to jsp
specifically.
In one simple word the answer is yes you can lock a static variable.
First, any member variable that you wish to make thread safe must be
declared private. Consider the following code:

public class MyPoint
{
public int x;
public int y;

public int getX()
{
return x;
}
public int getY()
{
return y;
}
public synchronized setX(int x)
{
this.x = x;
}
public synchronized getY(int y)
{
this.y = y;
}
}
If this were an ideal world, everyone would set x and y by calling setX()
and setY(), respectively. However, we all know that someone will come along
and set x or y directly, since we defined the members as public. And since
we defined x and y as public, it is reasonable for someone to come along and
access the variables directly. If we didn't want someone to access the
members directly, we shouldn't have declared them as public in the first
place! The only way to guarantee that threads will access x and y safely is
to declare them as private and provide synchronized access.
Nothing changes when you declare a member static. If you don't want some
thread to come along and bypass your careful synchronization, don't declare
the member public or protected.
Now, the question remains: how do we lock the member? Sometimes I think that
part of the confusion around synchronization stems from a misunderstanding
of what actually happens when you call synchronized(some_object). Calling
synchronized on some_object does not prevent access to some_object. Instead,
you must think of synchronized as a request to open a lock around some piece
of code for your thread. some_object is the lock that you wish to have
access to. Only one thread may hold a specific lock at any one time.
Making a static member thread safe is fairly simple once you understand what
really happens when you call synchronized. Here is a template to follow
(there are many more ways to do it, though):

class Safe {
... other class definitions ...
private static  var;

public final synchronized static setVar( val)
{
var = val;
}
}
As a second option, you can also synchronize within the method. Which
approach you take will depend upon your code. However, in this example,
either way is equivalent, since a synchronized static method grabs the lock
on the class. You would use the second option if you were doing a lot of
processing inside of the method. That way you only synchronize when you have
to -- thus improving performance.
You would need to use synchronization within the method if you didn't want
to declare setVar() static. A nonstatic method declared as synchronized
locks on the instance, not the class. So, if you had more than one instance,
the member would no longer be thread safe.

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of ROLDAN, Gabriel raul
Sent: Monday, February 17, 2003 6:59 PM
To: [EMAIL PROTECTED]
Subject: stupid question


excuse this stupid and out of topic question, but.. ¿are static methods and
fields synchronized?

=
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



[no subject]

2003-02-18 Thread Raju BSN
Hi Snehal,
can u put ur question a lil bit clear?
what do u mean by beans?
EJB or normal Java Bean for Business Process?

Regards
Raju BSn
- Original Message -
From: "Snehal Pandya" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 18, 2003 4:38 PM


> Hi Gurus,
> I am new be in the Beans Programming with JSP.
> I want to use the Beans in my application .
> I have to retrieve the Group code and then from the group no get the Items
> from the Item Master.
> How I can use beans for this  purpose? If I will pass the result set I got
> the array of the Items .
> But it will occupy the Resources on the server.
> What is the feasible solution for this Problem ?
> How to do this ?
> Please help me  and show me the path.
> Thanks in Advance..
>
> Snehal
>
>
>
> --
---
>
> The secret of getting ahead is getting started.
> The secret of getting start is
> breaking your complex overwhelming
> tasks into small manageable tasks,
> and then starting on the first one.
>
>
===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: stupid question

2003-02-18 Thread Vikramjit Singh
> -Original Message-
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Amit Ghaste
> Sent: Saturday, March 15, 2003 5:02 PM
> To: [EMAIL PROTECTED]
> Subject: Re: stupid question
>
>
> vikramjit, I think he meant it in relevance to JSP.

Did he? Coz i thought he said static variables and methods. Oops. But why in
jsp, put in bean, makes life much easier and follow the steps mentioned
below.

>
> correct me if I am wrong Roldan, but did u mean declaring static variables
> and/or static methods declared in a jsp page...
>
> if so no, you will need to implement synchronization... consider
> performance
> and benefits of the approach as well.

Yups thats true.. Since jsp's are not thread safe and many users can access
them.
>
> -Original Message-
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Vikramjit Singh
> Sent: Tuesday, February 18, 2003 12:13 AM
> To: [EMAIL PROTECTED]
> Subject: Re: stupid question
>
>
> Rather this is a very interesting question but not related to jsp
> specifically.
> In one simple word the answer is yes you can lock a static variable.
> First, any member variable that you wish to make thread safe must be
> declared private. Consider the following code:
>
> public class MyPoint
> {
> public int x;
> public int y;
>
> public int getX()
> {
> return x;
> }
> public int getY()
> {
> return y;
> }
> public synchronized setX(int x)
> {
> this.x = x;
> }
> public synchronized getY(int y)
> {
> this.y = y;
> }
> }
> If this were an ideal world, everyone would set x and y by calling setX()
> and setY(), respectively. However, we all know that someone will
> come along
> and set x or y directly, since we defined the members as public. And since
> we defined x and y as public, it is reasonable for someone to
> come along and
> access the variables directly. If we didn't want someone to access the
> members directly, we shouldn't have declared them as public in the first
> place! The only way to guarantee that threads will access x and y
> safely is
> to declare them as private and provide synchronized access.
> Nothing changes when you declare a member static. If you don't want some
> thread to come along and bypass your careful synchronization,
> don't declare
> the member public or protected.
> Now, the question remains: how do we lock the member? Sometimes I
> think that
> part of the confusion around synchronization stems from a misunderstanding
> of what actually happens when you call synchronized(some_object). Calling
> synchronized on some_object does not prevent access to
> some_object. Instead,
> you must think of synchronized as a request to open a lock around
> some piece
> of code for your thread. some_object is the lock that you wish to have
> access to. Only one thread may hold a specific lock at any one time.
> Making a static member thread safe is fairly simple once you
> understand what
> really happens when you call synchronized. Here is a template to follow
> (there are many more ways to do it, though):
>
> class Safe {
> ... other class definitions ...
> private static  var;
>
> public final synchronized static setVar( val)
> {
> var = val;
> }
> }
> As a second option, you can also synchronize within the method. Which
> approach you take will depend upon your code. However, in this example,
> either way is equivalent, since a synchronized static method
> grabs the lock
> on the class. You would use the second option if you were doing a lot of
> processing inside of the method. That way you only synchronize
> when you have
> to -- thus improving performance.
> You would need to use synchronization within the method if you didn't want
> to declare setVar() static. A nonstatic method declared as synchronized
> locks on the instance, not the class. So, if you had more than
> one instance,
> the member would no longer be thread safe.
>
> -Original Message-
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of ROLDAN, Gabriel raul
> Sent: Monday, February 17, 2003 6:59 PM
> To: [EMAIL PROTECTED]
> Subject: stupid question
>
>
> excuse this stupid and out of topic question, but.. ¿are static
> methods and
> fields synchronized?
>
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com
>
> ==
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
>

JDBC Driver for Form Based Authentication

2003-02-18 Thread Omer Tariq
Hi Again,
Thanks for the info on using Tomcat as production server Vikramjit.
Another question:
I want to be able to use form-based authentication using JDBCRealm and I
have a doubt regarding setting Tomcat for it.
The documentation says I should
"place the JDBC driver in CATALINE_HOME/common/lib... Note that only JAR
files are recognized."
My question is how do I obtain a JDBC driver jar file?

Thanks in advance,
Omer


_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



Re: stupid question

2003-02-18 Thread ROLDAN, Gabriel raul
I mean in general, beans for example.
the source of this question is my confussion about
the internals of reentrant functions and synchronization


-Mensaje original-
De: Amit Ghaste [mailto:[EMAIL PROTECTED]]
Enviado el: sábado, 15 de marzo de 2003 12:32
Para: [EMAIL PROTECTED]
Asunto: Re: stupid question


vikramjit, I think he meant it in relevance to JSP.

correct me if I am wrong Roldan, but did u mean declaring static variables
and/or static methods declared in a jsp page...

if so no, you will need to implement synchronization... consider performance
and benefits of the approach as well.

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Vikramjit Singh
Sent: Tuesday, February 18, 2003 12:13 AM
To: [EMAIL PROTECTED]
Subject: Re: stupid question


Rather this is a very interesting question but not related to jsp
specifically.
In one simple word the answer is yes you can lock a static variable.
First, any member variable that you wish to make thread safe must be
declared private. Consider the following code:

public class MyPoint
{
public int x;
public int y;

public int getX()
{
return x;
}
public int getY()
{
return y;
}
public synchronized setX(int x)
{
this.x = x;
}
public synchronized getY(int y)
{
this.y = y;
}
}
If this were an ideal world, everyone would set x and y by calling setX()
and setY(), respectively. However, we all know that someone will come along
and set x or y directly, since we defined the members as public. And since
we defined x and y as public, it is reasonable for someone to come along and
access the variables directly. If we didn't want someone to access the
members directly, we shouldn't have declared them as public in the first
place! The only way to guarantee that threads will access x and y safely is
to declare them as private and provide synchronized access.
Nothing changes when you declare a member static. If you don't want some
thread to come along and bypass your careful synchronization, don't declare
the member public or protected.
Now, the question remains: how do we lock the member? Sometimes I think that
part of the confusion around synchronization stems from a misunderstanding
of what actually happens when you call synchronized(some_object). Calling
synchronized on some_object does not prevent access to some_object. Instead,
you must think of synchronized as a request to open a lock around some piece
of code for your thread. some_object is the lock that you wish to have
access to. Only one thread may hold a specific lock at any one time.
Making a static member thread safe is fairly simple once you understand what
really happens when you call synchronized. Here is a template to follow
(there are many more ways to do it, though):

class Safe {
... other class definitions ...
private static  var;

public final synchronized static setVar( val)
{
var = val;
}
}
As a second option, you can also synchronize within the method. Which
approach you take will depend upon your code. However, in this example,
either way is equivalent, since a synchronized static method grabs the lock
on the class. You would use the second option if you were doing a lot of
processing inside of the method. That way you only synchronize when you have
to -- thus improving performance.
You would need to use synchronization within the method if you didn't want
to declare setVar() static. A nonstatic method declared as synchronized
locks on the instance, not the class. So, if you had more than one instance,
the member would no longer be thread safe.

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of ROLDAN, Gabriel raul
Sent: Monday, February 17, 2003 6:59 PM
To: [EMAIL PROTECTED]
Subject: stupid question


excuse this stupid and out of topic question, but.. ¿are static methods and
fields synchronized?

=
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
D

Applet Image Issue

2003-02-18 Thread karthikeyan.balasubramanian
Hi,

  I want to show an image on top of an applet but i couldnt.  Can sombody
help
me here.  I tried everything : z-index, iframe etc.

  Heres my sample code

~``

  
Test


  img.x
  {
position:absolute;
left:0;
top:0;
z-index:1;
  }

  applet.x
  {
position:absolute;
left:0;
top:0;
z-index:-1;
  }


  
  

   HI Applet 
  
  
  
  
  
  

  

~~`

Regards,

Karthikeyan B

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: JDBC Driver for Form Based Authentication

2003-02-18 Thread Vikramjit Singh
> -Original Message-
> From: A mailing list about Java Server Pages specification and reference
> [mailto:[EMAIL PROTECTED]]On Behalf Of Omer Tariq
> Sent: Tuesday, February 18, 2003 6:22 PM
> To: [EMAIL PROTECTED]
> Subject: JDBC Driver for Form Based Authentication
>
>
> Hi Again,
> Thanks for the info on using Tomcat as production server Vikramjit.

You are welcome. Here i give you one more link
Many web administrators (admins) enable servlets on their sites by
establishing
a connection between Apache and Tomcat by using an Apache module called
"mod_jk," whose usage is growing very rapidly, as shown on this page:

http://www.securityspace.com/s_survey/data/man.200205/apachemods.html?mod=bW
9kX2pr

This rapid growth strongly suggests that Tomcat installations are also
increasing rapidly. Of course, this data does not include those
installations that use mod_webapp or mod_jk2 (for use with Apache 2.0),
which can also be used to establish a connection between Apache and Tomcat.
I do not know where to find data on the deployment of these two modules.
Furthermore, some web admins use Tomcat as a web server (as well as a
servlet container), and there is probably no data on those installations,
either.

 You might want to investigate this page, too:
http://www.securityspace.com/s_survey/data/man.200205/apachemods.html
> Another question:
> I want to be able to use form-based authentication using JDBCRealm and I
> have a doubt regarding setting Tomcat for it.
> The documentation says I should
> "place the JDBC driver in CATALINE_HOME/common/lib... Note that only JAR
> files are recognized."
> My question is how do I obtain a JDBC driver jar file?

Simple. rename the zip file of oracle(which i know gives as zip file) to jar
file.
Or if that does not work, extract the files and then make the jar file
again.

>
> Thanks in advance,
> Omer
>
>
> _
> STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> http://join.msn.com/?page=features/junkmail
>
> ==
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Oracle-JDBC Driver For Linux platform

2003-02-18 Thread S Senthil Raja
sir/madam,
  I'm working in Linux platform.I want to connect Oracle driver in this
platform.I need to know where Oracle driver is available to connect Oracle
Db using JAVA.
  -thanks.


_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



Wesley Choate/LWSI is out of the office.

2003-02-18 Thread Wesley Choate
I will be out of the office starting  02/17/2003 and will not return until
02/24/2003.

If you need assistance, please e-mail [EMAIL PROTECTED]
TTYL,
Wesley

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



music site in jsp

2003-02-18 Thread shik shikha bhatia
hi friends,
 i am new to jsp and i have to make music site in jsp
through which user will log on and have the facility to buy misic
cd's and cassettes.will u pls gide me in this and can u tell how
it would be possible that the user(client) can listen to the songs
whose cd he or she is buying.its my proj work and my marks r
dependent on to it.could u pls tewll me what can i do to make it
better so that i could get better marks
 really need help
shikha bhatia

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



Replacing JSP with PHP?

2003-02-18 Thread Jiann-Ming Su
Is it possible to replace JSP and use PHP to encapsulate our page rendering
code?  We're running a java servlet that needs to be integrated with a PHP
front end.  I've given up on trying to run php as a java servlet.  I know
this is a strange request, but thanks for any tips.

--
Jiann-Ming Su  [EMAIL PROTECTED]  404-712-2603
Development Team Systems Administrator
General Libraries Systems Division

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: Using JSP to display blob as video

2003-02-18 Thread Peter Dolukhanov
I think the original question refers to a video rather than an image.

All I believe is required is to:

i) Set the content header to the appropriate type - find out the
relevant one for mpg/avi/rm etc.
ii) Then just stream it to the OutputStream of the HttpServletResponse
object.

To the browser it will seem like just a normal video file and it can
deal with it appropriately.

Regards,
Peter

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]] On Behalf Of Martin
Sent: 25 August 2002 02:54
To: [EMAIL PROTECTED]
Subject: Re: Using JSP to display blob as video

Deepak-
assuming you already have a DB connection-
1)you retrieve the image from the db  into a file on the server and
display
the image in a servlet using hte tag, OR
2)Use a servlet for displaying the image  by setting
response.setContentType("image/gif") and then
open the connection to DB
read the blob
display the image
-Martin


- Original Message -
From: "Deepak D Uzagare" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 18, 2003 12:41 AM
Subject: Using JSP to display blob as video


> My BLOB object is a video file .Please suggest me a way to display
this
video file using jsp
>
>

===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com
>


===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: Replacing JSP with PHP?

2003-02-18 Thread Shivan
what are advantages of PHP over JSP?

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Jiann-Ming Su
Sent: Tuesday, February 18, 2003 11:29 AM
To: [EMAIL PROTECTED]
Subject: Replacing JSP with PHP?


Is it possible to replace JSP and use PHP to encapsulate our page rendering
code?  We're running a java servlet that needs to be integrated with a PHP
front end.  I've given up on trying to run php as a java servlet.  I know
this is a strange request, but thanks for any tips.

--
Jiann-Ming Su  [EMAIL PROTECTED]  404-712-2603
Development Team Systems Administrator
General Libraries Systems Division

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: Replacing JSP with PHP?

2003-02-18 Thread Todd Whitten
PHP has no advantages over JSP. Maybe this is something you could have
posted to the PHP mailing list? ; )

-Original Message-
From: Shivan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 18, 2003 3:15 PM
To: [EMAIL PROTECTED]
Subject: Re: Replacing JSP with PHP?


what are advantages of PHP over JSP?

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Jiann-Ming Su
Sent: Tuesday, February 18, 2003 11:29 AM
To: [EMAIL PROTECTED]
Subject: Replacing JSP with PHP?


Is it possible to replace JSP and use PHP to encapsulate our page rendering
code?  We're running a java servlet that needs to be integrated with a PHP
front end.  I've given up on trying to run php as a java servlet.  I know
this is a strange request, but thanks for any tips.

--
Jiann-Ming Su  [EMAIL PROTECTED]  404-712-2603
Development Team Systems Administrator
General Libraries Systems Division

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: Oracle-JDBC Driver For Linux platform

2003-02-18 Thread Amit Ghaste
u can fing one at www.oracle.com

-Original Message-
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of S Senthil Raja
Sent: Tuesday, February 18, 2003 7:00 AM
To: [EMAIL PROTECTED]
Subject: Oracle-JDBC Driver For Linux platform


sir/madam,
   I'm working in Linux platform.I want to connect Oracle driver in this
platform.I need to know where Oracle driver is available to connect Oracle
Db using JAVA.
   -thanks.


_
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: Replacing JSP with PHP?

2003-02-18 Thread Jiann-Ming Su
On Tue, 18 Feb 2003, Shivan wrote:

> what are advantages of PHP over JSP?
>

I don't think there is any.  For us, we just happened to have stumbled
onto a PHP front end and a java back end.  Perhaps a better question for
this group would be, is there a servlet based portal software like
PostNuke?  If there is, then my problem may be solved.

--
Jiann-Ming Su  [EMAIL PROTECTED]  404-712-2603
Development Team Systems Administrator
General Libraries Systems Division

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: Replacing JSP with PHP?

2003-02-18 Thread Martin
Su

check out http://www.stachanov.com/~alvin/lab/phpvsservlet/
in which all of the tests for PHP script ran faster than commensurate
servlet
Keep this in mind:
1)PHP is weakly typed (tries to covert datatypes for you) VS Servlet which
has Strongly typed datatypes
2)PHP will require a PHP interpreter on your path
3)Graphics Rendering Packages which are readily available for Java will
support PHP only as a last result.
4)Ability to build reusable components such as beans are strictly limited
5)Inheritance Polymorphism and Encapsulation rules cannot apply to non OO
Language such as PHP
(Architect may not allow PHP implementation for these reasons)

-Martin
- Original Message -
From: "Jiann-Ming Su" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, February 18, 2003 4:33 PM
Subject: Re: Replacing JSP with PHP?


> On Tue, 18 Feb 2003, Shivan wrote:
>
> > what are advantages of PHP over JSP?
> >
>
> I don't think there is any.  For us, we just happened to have stumbled
> onto a PHP front end and a java back end.  Perhaps a better question for
> this group would be, is there a servlet based portal software like
> PostNuke?  If there is, then my problem may be solved.
>
> --
> Jiann-Ming Su  [EMAIL PROTECTED]  404-712-2603
> Development Team Systems Administrator
> General Libraries Systems Division
>
>
===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com
>

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



(struts in action ) looking for the artimus sql file

2003-02-18 Thread sufi malak
Hi, I just bought the book "Struts in Action" where can I find the sql file
to create the database and tables for artimus application.
thanks





_
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



JSTL and Vector

2003-02-18 Thread Murali Mohan
Hi I am quite new to taglibs.  I want to print values in vector or
Iterator.
If I use the following code it is not displaying any thing please help
me.

Thanks,
Murali

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>



<%!
  java.util.Vector v = new java.util.Vector();
%>
<%
  v.addElement("Garre");
  v.addElement("Rama");
  v.addElement("Murali");
  v.addElement("Mohan");
%>









===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: JSTL and Vector

2003-02-18 Thread Hans Bergsten
Murali Mohan wrote:

Hi I am quite new to taglibs.  I want to print values in vector or
Iterator.
If I use the following code it is not displaying any thing please help
me.

Thanks,
Murali

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>



<%!
  java.util.Vector v = new java.util.Vector();
%>
<%
  v.addElement("Garre");
  v.addElement("Rama");
  v.addElement("Murali");
  v.addElement("Mohan");
%>










You need to make the Vector visible to the JSTL EL as well; scripting
variables are only visible to other scripting code, not to actions
such as the  action or the EL. To make it visible, save a
reference in one of the JSP scopes, e.g. like this:

  <% pageContext.setAttribute("v", v); %>

to save the reference in the page scope.

Hans
--
Hans Bergsten<[EMAIL PROTECTED]>
Gefion Software   
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



SERACH ENGINE

2003-02-18 Thread shik shikha bhatia
hi friends,
 i am new to jsp and i have to make music site in
jsp
through which user will log on and have the facility to buy
misic
cd's and cassettes.
  THX FOR UR PREVOIUS HELP BUT COULD U PLS TELL ME
WHAT ELSE I COULD INCLUDE TO MAKE IT BETTER SO THAT I COULD GET
GOOD MARKS.THE CLIENT CAN ALSO SEARCH THE CD'S ON BASIS OF SINGER
NAME ETC.SO HOW COULD I IMPLEMENT A SEARCH ENGINE THROUGH JSP.THE
CLIENT CAN ALSO PERSONALIZE THE SITE ACCORDING TO HIS CHOICE LIKE
BACKGROUND COLOR ETC.
  PLS HELP
 really need help
shikha bhatia

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



Re: JSTL and Vector

2003-02-18 Thread Murali Mohan
Thanks to your reply. It is working.
But  If I have 10 vectors to display data , Should I put  10 in session(or some
scope) before displaying data??

Can't I use set tag   to make it visible?
like.



 
 


Thanks,
Murali

Hans Bergsten wrote:

> Murali Mohan wrote:
> > Hi I am quite new to taglibs.  I want to print values in vector or
> > Iterator.
> > If I use the following code it is not displaying any thing please help
> > me.
> >
> > Thanks,
> > Murali
> >
> > <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>
> > 
> > 
> >
> > <%!
> >   java.util.Vector v = new java.util.Vector();
> > %>
> > <%
> >   v.addElement("Garre");
> >   v.addElement("Rama");
> >   v.addElement("Murali");
> >   v.addElement("Mohan");
> > %>
> >
> > 
> > 
> > 
> > 
> >
> > 
> > 
>
> You need to make the Vector visible to the JSTL EL as well; scripting
> variables are only visible to other scripting code, not to actions
> such as the  action or the EL. To make it visible, save a
> reference in one of the JSP scopes, e.g. like this:
>
><% pageContext.setAttribute("v", v); %>
>
> to save the reference in the page scope.
>
> Hans
> --
> Hans Bergsten<[EMAIL PROTECTED]>
> Gefion Software   
> Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
> Details at
>
> ===
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
>
> Some relevant archives, FAQs and Forums on JSPs can be found at:
>
>  http://java.sun.com/products/jsp
>  http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



[no subject]

2003-02-18 Thread Teerapong Hempruchayakul
I'm invoke Dialog in Applet environment. Can remove status bar from the Dialog? How?

==To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com



Re: JSTL and Vector

2003-02-18 Thread Hans Bergsten
Murali Mohan wrote:

Thanks to your reply. It is working.
But  If I have 10 vectors to display data , Should I put  10 in session(or some
scope) before displaying data??


Which scope you select depends on the data, for instance if it rarely
changes and is the same for all users, the application scope may be
the best, if it's different per user but stays the same throughout the
session, use the session scope, etc.


Can't I use set tag   to make it visible?
like.



 
 



If you use servlets for the business logic and JSP pages only for
the user interface, the servlets typically put items like this in
the appropriate scope. If you only use JSP pages, a custom action
("tag") that creates the data could also save it directly in a scope.

For the simple example you provided, where the data is created as a
Vector in a scriptlet, you must also use a scriptlet to save the
reference; there's no way any action (standard or custom) can get
hold of the value of a scripting variable and do anything with it.
For instance, above you have just moved the problem to the 
action instead of the  action: ${v} can only be resolved
if "v" is a variable (reference) in one of the JSP scopes.

I describe this in much more detail in my book. See the signature at
the end for more info.

Hans


Hans Bergsten wrote:



Murali Mohan wrote:


Hi I am quite new to taglibs.  I want to print values in vector or
Iterator.
If I use the following code it is not displaying any thing please help
me.

Thanks,
Murali

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"; %>



<%!
 java.util.Vector v = new java.util.Vector();
%>
<%
 v.addElement("Garre");
 v.addElement("Rama");
 v.addElement("Murali");
 v.addElement("Mohan");
%>


   
   






You need to make the Vector visible to the JSTL EL as well; scripting
variables are only visible to other scripting code, not to actions
such as the  action or the EL. To make it visible, save a
reference in one of the JSP scopes, e.g. like this:

  <% pageContext.setAttribute("v", v); %>

to save the reference in the page scope.

Hans
--
Hans Bergsten<[EMAIL PROTECTED]>
Gefion Software   
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com



===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com




--
Hans Bergsten<[EMAIL PROTECTED]>
Gefion Software   
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

http://java.sun.com/products/jsp
http://archives.java.sun.com/jsp-interest.html
http://forums.java.sun.com
http://www.jspinsider.com