Re: basic question

2003-03-12 Thread William W. Nelson
It makes no difference what the name of the bean member variable is.  It is the method 
name that counts.

Fyi, your friends might be thinking of the field name of a request parameter.  The 
following uses the default param mechanism:

 

and would automatically use the value of a request parameter named "identity" as the 
value passed to the setIdentity() method.


-
Hi all,

I have a basic question to ask,
If i have a java bean class as

package vikram;
public class MyBean{
   private String strIdentity;
   private String strName;

   // the method name is diff. i.e from the variable name.
   public void setIdentity(String strIdentity){
   this.strIdentity = strIdentity;
   }
   public String getIdentity(){
   return this.strIdentity;
   }
}

and in my jsp i shall call from A.jsp page:




Will this work or not. Some guys were saying it will not work since the
method name should be the same as the variable name
i.e. public void setStrIdentity(){}


Regards,
Vikram.

===
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


basic question

2003-03-12 Thread Vikramjit Singh
Hi all,

I have a basic question to ask,
If i have a java bean class as

package vikram;
public class MyBean{
private String strIdentity;
private String strName;

// the method name is diff. i.e from the variable name.
public void setIdentity(String strIdentity){
this.strIdentity = strIdentity;
}
public String getIdentity(){
return this.strIdentity;
}
}

and in my jsp i shall call from A.jsp page:




Will this work or not. Some guys were saying it will not work since the
method name should be the same as the variable name
i.e. public void setStrIdentity(){}


Regards,
Vikram.

===
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: Basic question: repeating code in JSP pages?

2002-08-17 Thread Dmitry Namiot

See also Protected form taglib from Coldtags suite:

http://www.servletsuite.com/jsp.htm
http://www.servletsuite.com/servlets/pformtag.htm

--
Coldbeans Software - server-side Java (tm) components
http://www.servletsuite.com



__
Your favorite stores, helpful shopping tools and great gift ideas. Experience the 
convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-16 Thread Brian P Bohnet

Thanks, that helps!

Zerbe John W wrote:

> There are actually several ways that the same user can access the same
> session object concurrently.
> Examples that I can think of are:
> 1) the easiest was is when web application uses a frameset in the browser.
> multiple frames can invoke servlets or jsps concurrently to fill in their
> respective "frames".
> 2) the end user gets impatient with response time (this never happens in my
> apps :) and hits the stop button and the refresh. In this case the first
> servlet request will most likely eventually get an io error trying to write
> the response.
>
> -Original Message-
> From: Brian P Bohnet [mailto:[EMAIL PROTECTED]]
> Sent: Friday, August 16, 2002 10:28 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Basic question: repeating code in JSP pages?
>
> I'm a little confused about sychronization of session. If each user has
> their own
> session object, where/what else would be modifying a particular session
> object?
> Perhaps an explanation of the scenario where synchronization is necessary is
> in
> order? Could you explain?
>
> thanks
> Brian
>
> Rafal Smyka wrote:
>
> > From: "Adrian Janssen" <[EMAIL PROTECTED]>
> > > returning arrays and objects that you create inside your function is
> fine,
> > > but if you must modify arrays / objects that you pass in you will have
> to
> > > syncronize on those objects before you modify them. Alternatively in the
> >
> > I would say all the object with life scope limited to request are thread
> > safe.
> > Synchronization is necessary only for modifications of shared ones, in
> > particular the ones from session.
> >
> > --
> > Regards,
> > Rafal
> >
> >
> ===
> > 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://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  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 FAQs on JSP/Servlets can be found at:
>
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
> *
> DISCLAIMER:   The information contained in this e-mail may be confidential
> and is intended solely for the use of the named addressee.  Access, copying
> or re-use of the e-mail or any information contained therein by any other
> person is not authorized.  If you are not the intended recipient please
> notify us immediately by returning the e-mail to the originator.
>
> ===
> 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://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  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 FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-16 Thread Robert S. Sfeir

> 2) the end user gets impatient with response time (this never happens
> in my
> apps :) and hits the stop button and the refresh. In this case the
> first
> servlet request will most likely eventually get an io error trying to
> write
> the response.

You can of course prevent against this one with EventHanler, and put in
a token to prevent both reload and back and resubmit.  The "Advanced
JavaServer Pages" book as a very good example how to handle that.

R

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-16 Thread Zerbe John W

There are actually several ways that the same user can access the same
session object concurrently.
Examples that I can think of are:
1) the easiest was is when web application uses a frameset in the browser.
multiple frames can invoke servlets or jsps concurrently to fill in their
respective "frames".
2) the end user gets impatient with response time (this never happens in my
apps :) and hits the stop button and the refresh. In this case the first
servlet request will most likely eventually get an io error trying to write
the response.

-Original Message-
From: Brian P Bohnet [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 10:28 AM
To: [EMAIL PROTECTED]
Subject: Re: Basic question: repeating code in JSP pages?


I'm a little confused about sychronization of session. If each user has
their own
session object, where/what else would be modifying a particular session
object?
Perhaps an explanation of the scenario where synchronization is necessary is
in
order? Could you explain?

thanks
Brian

Rafal Smyka wrote:

> From: "Adrian Janssen" <[EMAIL PROTECTED]>
> > returning arrays and objects that you create inside your function is
fine,
> > but if you must modify arrays / objects that you pass in you will have
to
> > syncronize on those objects before you modify them. Alternatively in the
>
> I would say all the object with life scope limited to request are thread
> safe.
> Synchronization is necessary only for modifications of shared ones, in
> particular the ones from session.
>
> --
> Regards,
> Rafal
>
>
===
> 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://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  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 FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com
*
DISCLAIMER:   The information contained in this e-mail may be confidential
and is intended solely for the use of the named addressee.  Access, copying
or re-use of the e-mail or any information contained therein by any other
person is not authorized.  If you are not the intended recipient please
notify us immediately by returning the e-mail to the originator.

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-16 Thread Brian P Bohnet

I'm a little confused about sychronization of session. If each user has their own
session object, where/what else would be modifying a particular session object?
Perhaps an explanation of the scenario where synchronization is necessary is in
order? Could you explain?

thanks
Brian

Rafal Smyka wrote:

> From: "Adrian Janssen" <[EMAIL PROTECTED]>
> > returning arrays and objects that you create inside your function is fine,
> > but if you must modify arrays / objects that you pass in you will have to
> > syncronize on those objects before you modify them. Alternatively in the
>
> I would say all the object with life scope limited to request are thread
> safe.
> Synchronization is necessary only for modifications of shared ones, in
> particular the ones from session.
>
> --
> Regards,
> Rafal
>
> ===
> 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://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  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 FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-15 Thread Rafal Smyka

From: "Adrian Janssen" <[EMAIL PROTECTED]>
> returning arrays and objects that you create inside your function is fine,
> but if you must modify arrays / objects that you pass in you will have to
> syncronize on those objects before you modify them. Alternatively in the

I would say all the object with life scope limited to request are thread
safe.
Synchronization is necessary only for modifications of shared ones, in
particular the ones from session.

--
Regards,
Rafal

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-15 Thread Adrian Janssen

returning arrays and objects that you create inside your function is fine,
but if you must modify arrays / objects that you pass in you will have to
syncronize on those objects before you modify them. Alternatively in the
case of objects consider making methods in them which will do the
modification inside the object and syncronize on whatever it is they are
modifying inside them for slightly better effeciancy (for primatives use
delagate objects).

Try to avoid this, syncronisation is very tricky, and causes major
performace issues. Also note that is normally a subject dealt with over many
chapters in ADVANCED java books, so these few emails are NOT going to
prepare you to do it properly.

> -Original Message-
> From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> Sent: 15 August 2002 10:22
> To:   [EMAIL PROTECTED]
> Subject:  Re: Basic question: repeating code in JSP pages?
>
> so whatz ypur advice when I need to pass and modify arrays and objects?
>
> -Original Message-
> From: Adrian Janssen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 15, 2002 10:59 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Basic question: repeating code in JSP pages?
>
>
> if you are only using local variables the method is inherently thread safe
> as each thread that executes the mehtod will allocate its own local
> varaibles of the heap.
>
> Beware though of your calling parameters. If you pass objects / arrays in
> and modify those then there *may* be concurrecy issues, depending on where
> /
> how those objects / arrays were created.
>
> > -Original Message-
> > From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> > Sent: 15 August 2002 09:56
> > To:   [EMAIL PROTECTED]
> > Subject:  Re: Basic question: repeating code in JSP pages?
> >
> > Are u saying that I do not need to synchronize my methods so long as I'm
> > not
> > using instance variables?  What then happens when I call such methods
> > concurrently?
> >
> > -Original Message-----
> > From: Adrian Janssen [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, August 15, 2002 10:40 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: Basic question: repeating code in JSP pages?
> >
> >
> > If you are using instance variables, you would need to syncronize.
> However
> > rather try not to use instance variables. As you have pointed out, Java
> > can
> > only return a single value, but that could be an array or an object
> > containing many values, see if that can be used to solve your problem.
> >
> > Try to avoid syncronisation - it slows things down and is also a rich
> > source
> > of difficult to fix bugs.
> >
> > > -Original Message-
> > > From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> > > Sent: 15 August 2002 09:15
> > > To:   [EMAIL PROTECTED]
> > > Subject:  Re: Basic question: repeating code in JSP pages?
> > >
> > > Hans wrote:
> > > >If you promise to move the code to a servlet/bean/action later, I
> tell
> > > >you how ;-) You can use a JSP declaration to declare a method:
> > > >
> > > >   <%!
> > > > private String createColumnClause(String column, String value) {
> > > >   ...
> > > >   return clause;
> > > > }
> > > >   %>
> > > >
> > > >Note that the method has access to only instance variables (which
> > should
> > > >be avoided for thread-safety reasons) so you have to pass it all data
> > > >it need as parameters.
> > > >
> > > >You can then call it from a scriptlet:
> > > >
> > > >   <%
> > > > String clause = createColumnClause("email", email);
> > > >   %>
> > > >
> > > >Hope this helps,
> > > >Hans
> > >
> > >
> > > Is it necessary to synchronize methods in JSP so as to make them
> thread
> > > safe?  When do I need to synchronize them?  Again, if for instance my
> > > method
> > > need to return multiple values, in which case I'm forced to use
> instance
> > > variables since Java can only return a value.  How can I make the JSP
> > > thread
> > > safe?
> > >
> > >
> >
> ==
> > > =
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > > DIGEST".

Re: Basic question: repeating code in JSP pages?

2002-08-15 Thread Emmanuel Eze

so whatz ypur advice when I need to pass and modify arrays and objects?

-Original Message-
From: Adrian Janssen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 10:59 AM
To: [EMAIL PROTECTED]
Subject: Re: Basic question: repeating code in JSP pages?


if you are only using local variables the method is inherently thread safe
as each thread that executes the mehtod will allocate its own local
varaibles of the heap.

Beware though of your calling parameters. If you pass objects / arrays in
and modify those then there *may* be concurrecy issues, depending on where /
how those objects / arrays were created.

> -Original Message-
> From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> Sent: 15 August 2002 09:56
> To:   [EMAIL PROTECTED]
> Subject:  Re: Basic question: repeating code in JSP pages?
>
> Are u saying that I do not need to synchronize my methods so long as I'm
> not
> using instance variables?  What then happens when I call such methods
> concurrently?
>
> -Original Message-
> From: Adrian Janssen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 15, 2002 10:40 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Basic question: repeating code in JSP pages?
>
>
> If you are using instance variables, you would need to syncronize. However
> rather try not to use instance variables. As you have pointed out, Java
> can
> only return a single value, but that could be an array or an object
> containing many values, see if that can be used to solve your problem.
>
> Try to avoid syncronisation - it slows things down and is also a rich
> source
> of difficult to fix bugs.
>
> > -Original Message-
> > From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> > Sent: 15 August 2002 09:15
> > To:   [EMAIL PROTECTED]
> > Subject:  Re: Basic question: repeating code in JSP pages?
> >
> > Hans wrote:
> > >If you promise to move the code to a servlet/bean/action later, I tell
> > >you how ;-) You can use a JSP declaration to declare a method:
> > >
> > >   <%!
> > > private String createColumnClause(String column, String value) {
> > >   ...
> > >   return clause;
> > > }
> > >   %>
> > >
> > >Note that the method has access to only instance variables (which
> should
> > >be avoided for thread-safety reasons) so you have to pass it all data
> > >it need as parameters.
> > >
> > >You can then call it from a scriptlet:
> > >
> > >   <%
> > > String clause = createColumnClause("email", email);
> > >   %>
> > >
> > >Hope this helps,
> > >Hans
> >
> >
> > Is it necessary to synchronize methods in JSP so as to make them thread
> > safe?  When do I need to synchronize them?  Again, if for instance my
> > method
> > need to return multiple values, in which case I'm forced to use instance
> > variables since Java can only return a value.  How can I make the JSP
> > thread
> > safe?
> >
> >
> ==
> > =
> > 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://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
> --
>
> It is the strict policy of Truworths that its e-mail facility and all
> e-mail communications emanating therefrom, should be utilised for
> business purposes only and should conform to high professional and
> business standards.   Truworths has stipulated certain regulations in
> terms whereof strict guidelines relating to the use and content of
> e-mail communications are laid down. The use of the Truworths e-mail
> facility is not permitted for the distribution of chain letters or
> offensive mail of any nature whatsoever.   Truworths hereby distances
> itself from and accepts no liability in respect of the unauthorised
> use of its e-mail facility or the sending of e-mail communications
> for other than strictly business purposes.   Truworths furthermore
> disclaims liability for any  unauthorised instruction for  which
> permission was not granted.Truworths Limited accepts no liability
> for any consequences arising from or as a result of reliance on this
> message unless it is in respect of bona 

Re: Basic question: repeating code in JSP pages?

2002-08-15 Thread Adrian Janssen

if you are only using local variables the method is inherently thread safe
as each thread that executes the mehtod will allocate its own local
varaibles of the heap.

Beware though of your calling parameters. If you pass objects / arrays in
and modify those then there *may* be concurrecy issues, depending on where /
how those objects / arrays were created.

> -Original Message-
> From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> Sent: 15 August 2002 09:56
> To:   [EMAIL PROTECTED]
> Subject:  Re: Basic question: repeating code in JSP pages?
>
> Are u saying that I do not need to synchronize my methods so long as I'm
> not
> using instance variables?  What then happens when I call such methods
> concurrently?
>
> -Original Message-
> From: Adrian Janssen [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, August 15, 2002 10:40 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Basic question: repeating code in JSP pages?
>
>
> If you are using instance variables, you would need to syncronize. However
> rather try not to use instance variables. As you have pointed out, Java
> can
> only return a single value, but that could be an array or an object
> containing many values, see if that can be used to solve your problem.
>
> Try to avoid syncronisation - it slows things down and is also a rich
> source
> of difficult to fix bugs.
>
> > -Original Message-
> > From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> > Sent: 15 August 2002 09:15
> > To:   [EMAIL PROTECTED]
> > Subject:  Re: Basic question: repeating code in JSP pages?
> >
> > Hans wrote:
> > >If you promise to move the code to a servlet/bean/action later, I tell
> > >you how ;-) You can use a JSP declaration to declare a method:
> > >
> > >   <%!
> > > private String createColumnClause(String column, String value) {
> > >   ...
> > >   return clause;
> > > }
> > >   %>
> > >
> > >Note that the method has access to only instance variables (which
> should
> > >be avoided for thread-safety reasons) so you have to pass it all data
> > >it need as parameters.
> > >
> > >You can then call it from a scriptlet:
> > >
> > >   <%
> > > String clause = createColumnClause("email", email);
> > >   %>
> > >
> > >Hope this helps,
> > >Hans
> >
> >
> > Is it necessary to synchronize methods in JSP so as to make them thread
> > safe?  When do I need to synchronize them?  Again, if for instance my
> > method
> > need to return multiple values, in which case I'm forced to use instance
> > variables since Java can only return a value.  How can I make the JSP
> > thread
> > safe?
> >
> >
> ==
> > =
> > 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://archives.java.sun.com/jsp-interest.html
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.jsp
> >  http://www.jguru.com/faq/index.jsp
> >  http://www.jspinsider.com
> --
>
> It is the strict policy of Truworths that its e-mail facility and all
> e-mail communications emanating therefrom, should be utilised for
> business purposes only and should conform to high professional and
> business standards.   Truworths has stipulated certain regulations in
> terms whereof strict guidelines relating to the use and content of
> e-mail communications are laid down. The use of the Truworths e-mail
> facility is not permitted for the distribution of chain letters or
> offensive mail of any nature whatsoever.   Truworths hereby distances
> itself from and accepts no liability in respect of the unauthorised
> use of its e-mail facility or the sending of e-mail communications
> for other than strictly business purposes.   Truworths furthermore
> disclaims liability for any  unauthorised instruction for  which
> permission was not granted.Truworths Limited accepts no liability
> for any consequences arising from or as a result of reliance on this
> message unless it is in respect of bona fide Truworths business for
> which proper authorisation has been granted.
>
> Any recipient of an unacceptable communication, a chain letter or
> offensive material of any nature is requested to notify the Truworths
> e-mail administrator ([EMAIL PROT

Re: Basic question: repeating code in JSP pages?

2002-08-15 Thread Emmanuel Eze

Are u saying that I do not need to synchronize my methods so long as I'm not
using instance variables?  What then happens when I call such methods
concurrently?

-Original Message-
From: Adrian Janssen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 10:40 AM
To: [EMAIL PROTECTED]
Subject: Re: Basic question: repeating code in JSP pages?


If you are using instance variables, you would need to syncronize. However
rather try not to use instance variables. As you have pointed out, Java can
only return a single value, but that could be an array or an object
containing many values, see if that can be used to solve your problem.

Try to avoid syncronisation - it slows things down and is also a rich source
of difficult to fix bugs.

> -Original Message-
> From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> Sent: 15 August 2002 09:15
> To:   [EMAIL PROTECTED]
> Subject:  Re: Basic question: repeating code in JSP pages?
>
> Hans wrote:
> >If you promise to move the code to a servlet/bean/action later, I tell
> >you how ;-) You can use a JSP declaration to declare a method:
> >
> >   <%!
> > private String createColumnClause(String column, String value) {
> >   ...
> >   return clause;
> > }
> >   %>
> >
> >Note that the method has access to only instance variables (which should
> >be avoided for thread-safety reasons) so you have to pass it all data
> >it need as parameters.
> >
> >You can then call it from a scriptlet:
> >
> >   <%
> > String clause = createColumnClause("email", email);
> >   %>
> >
> >Hope this helps,
> >Hans
>
>
> Is it necessary to synchronize methods in JSP so as to make them thread
> safe?  When do I need to synchronize them?  Again, if for instance my
> method
> need to return multiple values, in which case I'm forced to use instance
> variables since Java can only return a value.  How can I make the JSP
> thread
> safe?
>
> ==
> =
> 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://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
--

It is the strict policy of Truworths that its e-mail facility and all
e-mail communications emanating therefrom, should be utilised for
business purposes only and should conform to high professional and
business standards.   Truworths has stipulated certain regulations in
terms whereof strict guidelines relating to the use and content of
e-mail communications are laid down. The use of the Truworths e-mail
facility is not permitted for the distribution of chain letters or
offensive mail of any nature whatsoever.   Truworths hereby distances
itself from and accepts no liability in respect of the unauthorised
use of its e-mail facility or the sending of e-mail communications
for other than strictly business purposes.   Truworths furthermore
disclaims liability for any  unauthorised instruction for  which
permission was not granted.Truworths Limited accepts no liability
for any consequences arising from or as a result of reliance on this
message unless it is in respect of bona fide Truworths business for
which proper authorisation has been granted.

Any recipient of an unacceptable communication, a chain letter or
offensive material of any nature is requested to notify the Truworths
e-mail administrator ([EMAIL PROTECTED]) immediately in order that
appropriate action can be taken against the individual concerned.

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 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 FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-15 Thread Adrian Janssen

If you are using instance variables, you would need to syncronize. However
rather try not to use instance variables. As you have pointed out, Java can
only return a single value, but that could be an array or an object
containing many values, see if that can be used to solve your problem.

Try to avoid syncronisation - it slows things down and is also a rich source
of difficult to fix bugs.

> -Original Message-
> From: Emmanuel Eze [SMTP:[EMAIL PROTECTED]]
> Sent: 15 August 2002 09:15
> To:   [EMAIL PROTECTED]
> Subject:  Re: Basic question: repeating code in JSP pages?
>
> Hans wrote:
> >If you promise to move the code to a servlet/bean/action later, I tell
> >you how ;-) You can use a JSP declaration to declare a method:
> >
> >   <%!
> > private String createColumnClause(String column, String value) {
> >   ...
> >   return clause;
> > }
> >   %>
> >
> >Note that the method has access to only instance variables (which should
> >be avoided for thread-safety reasons) so you have to pass it all data
> >it need as parameters.
> >
> >You can then call it from a scriptlet:
> >
> >   <%
> > String clause = createColumnClause("email", email);
> >   %>
> >
> >Hope this helps,
> >Hans
>
>
> Is it necessary to synchronize methods in JSP so as to make them thread
> safe?  When do I need to synchronize them?  Again, if for instance my
> method
> need to return multiple values, in which case I'm forced to use instance
> variables since Java can only return a value.  How can I make the JSP
> thread
> safe?
>
> ==
> =
> 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://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com
--

It is the strict policy of Truworths that its e-mail facility and all
e-mail communications emanating therefrom, should be utilised for
business purposes only and should conform to high professional and
business standards.   Truworths has stipulated certain regulations in
terms whereof strict guidelines relating to the use and content of
e-mail communications are laid down. The use of the Truworths e-mail
facility is not permitted for the distribution of chain letters or
offensive mail of any nature whatsoever.   Truworths hereby distances
itself from and accepts no liability in respect of the unauthorised
use of its e-mail facility or the sending of e-mail communications
for other than strictly business purposes.   Truworths furthermore
disclaims liability for any  unauthorised instruction for  which
permission was not granted.Truworths Limited accepts no liability
for any consequences arising from or as a result of reliance on this
message unless it is in respect of bona fide Truworths business for
which proper authorisation has been granted.

Any recipient of an unacceptable communication, a chain letter or
offensive material of any nature is requested to notify the Truworths
e-mail administrator ([EMAIL PROTECTED]) immediately in order that
appropriate action can be taken against the individual concerned.

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-15 Thread Emmanuel Eze

Hans wrote:
>If you promise to move the code to a servlet/bean/action later, I tell
>you how ;-) You can use a JSP declaration to declare a method:
>
>   <%!
> private String createColumnClause(String column, String value) {
>   ...
>   return clause;
> }
>   %>
>
>Note that the method has access to only instance variables (which should
>be avoided for thread-safety reasons) so you have to pass it all data
>it need as parameters.
>
>You can then call it from a scriptlet:
>
>   <%
> String clause = createColumnClause("email", email);
>   %>
>
>Hope this helps,
>Hans


Is it necessary to synchronize methods in JSP so as to make them thread
safe?  When do I need to synchronize them?  Again, if for instance my method
need to return multiple values, in which case I'm forced to use instance
variables since Java can only return a value.  How can I make the JSP thread
safe?

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question: repeating code in JSP pages?

2002-08-14 Thread Martin Gainty

Why not write a function called WhereClause():<%!public String WhereClause(){Vector email = (Vector)session.getAttribute("rep_email"); if (email != null) {   if (email.size() > 0)  {   if (!firstClause)   {  query += " AND ";  firstClause = false;   }  query += "(email = '" + email.elementAt(0) + "'"; 

 for (int i=1; i> query += " OR email = '" + email.elementAt(i) + "'";  {  query += ") ";   } }}} %>Hope this helps,






Martin Gainty



__

Disclaimer and confidentiality note

Everything in this e-mail and any attachments relating to the official business of Laconia Data Systems (LDS) is proprietary to the company. It is confidential, legally privileged and protected by law. LDS does not own and endorse any other content. Views and opinions are those of the sender unless clearly stated as being that of LDS. 

The person addressed in the e-mail is the sole authorised recipient. Please notify the sender immediately if it has unintentionally reached you and do not read, disclose or use the content in any way.



LDS can not assure that the integrity of this communication has been maintained nor that it is free of errors, virus, interception or interference.

 ___

 











>From: David Castro <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED]
>Subject: Basic question: repeating code in JSP pages?
>Date: Wed, 14 Aug 2002 05:55:06 -0700
>MIME-Version: 1.0
>Received: from hotmail.com ([65.54.237.28]) by hotmail.com with Microsoft SMTPSVC(5.0.2195.4905); Wed, 14 Aug 2002 06:00:57 -0700
>Received: from swjscmail2.java.sun.com ([192.18.99.108]) by hotmail.com with Microsoft SMTPSVC(5.0.2195.4905); Wed, 14 Aug 2002 05:56:13 -0700
>Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by swjscmail2.java.sun.com (Postfix) with ESMTPid D4D3022E8D; Wed, 14 Aug 2002 06:52:49 -0600 (MDT)
>Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8d) with spool id 2420948 for [EMAIL PROTECTED]; Wed, 14 Aug 2002 06:51:03 -0600
>Received: from web10005.mail.yahoo.com (web10005.mail.yahoo.com [216.136.130.41]) by swjscmail1.java.sun.com (Postfix) with SMTP id 99F434835 for <[EMAIL PROTECTED]>; Wed, 14 Aug 2002 06:51:02 -0600 (MDT)
>Received: from [24.74.213.228] by web10005.mail.yahoo.com via HTTP; Wed, 14 Aug 2002 05:55:06 PDT
>Delivered-To: [EMAIL PROTECTED]
>Message-ID: <[EMAIL PROTECTED]>
>Sender: A mailing list about Java Server Pages specification and reference <[EMAIL PROTECTED]>
>In-Reply-To: <[EMAIL PROTECTED]>
>Return-Path: [EMAIL PROTECTED]
>X-OriginalArrivalTime: 14 Aug 2002 12:56:14.0206 (UTC) FILETIME=[F8BA19E0:01C24391]
>
>I am creating a JSP application that generates a custom SQL query, based on the
>columns and rows that the user wants to see. As such, I have a whole bunch of
>repeated code in the page:
>
>Vector email = (Vector)session.getAttribute("rep_email");
>if (email != null) {
> if (email.size() > 0) {
> if (!firstClause) {
> query += " AND ";
> firstClause = false;
> }
> query += "(email = '" + email.elementAt(0) + "'";
> for (int i=1; i> query += " OR email = '" + email.elementAt(i) + "'";
> }
> query += ") ";
> }
>}
>
>This code is repeated for every clause added to the WHERE part of the query. I
>realize that I could extract this code into a JavaBean or other servlet, and
>call that, but I'd like to keep the code within the page, to make debugging
>faster (and maybe move it to an external .class file later). Is there a way
>with JSP to create a function within the page, which I could call for each
>column?
>
>-David Castro
> email[at]davidcastro[dot]com
> http://jsp.davidcastro.com
>
>__
>Do You Yahoo!?
>HotJobs - Search Thousands of New Jobs
>http://www.hotjobs.com
>
>===
>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://archives.java.sun.com/jsp-interest.html
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.jsp
> http://www.jguru.com/faq/index.jsp
> http://www.jspinsider.com
Chat with friends online, try MSN Messenger: Click Here

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com


Re: Basic question: repeating code in JSP pages?

2002-08-14 Thread Hans Bergsten

David Castro wrote:
> I am creating a JSP application that generates a custom SQL query, based on the
> columns and rows that the user wants to see. As such, I have a whole bunch of
> repeated code in the page:
>
> Vector email = (Vector)session.getAttribute("rep_email");
> if (email != null) {
>   if (email.size() > 0) {
> if (!firstClause) {
>   query += " AND ";
>   firstClause = false;
> }
> query += "(email = '" + email.elementAt(0) + "'";
> for (int i=1; i   query += " OR email = '" + email.elementAt(i) + "'";
> }
> query += ") ";
>   }
> }
>
> This code is repeated for every clause added to the WHERE part of the query. I
> realize that I could extract this code into a JavaBean or other servlet, and
> call that, but I'd like to keep the code within the page, to make debugging
> faster (and maybe move it to an external .class file later). Is there a way
> with JSP to create a function within the page, which I could call for each
> column?

If you promise to move the code to a servlet/bean/action later, I tell
you how ;-) You can use a JSP declaration to declare a method:

   <%!
 private String createColumnClause(String column, String value) {
   ...
   return clause;
 }
   %>

Note that the method has access to only instance variables (which should
be avoided for thread-safety reasons) so you have to pass it all data
it need as parameters.

You can then call it from a scriptlet:

   <%
 String clause = createColumnClause("email", email);
   %>

Hope this helps,
Hans
--
Hans Bergsten   [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
JavaServer Pageshttp://TheJSPBook.com

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Basic question: repeating code in JSP pages?

2002-08-14 Thread David Castro

I am creating a JSP application that generates a custom SQL query, based on the
columns and rows that the user wants to see. As such, I have a whole bunch of
repeated code in the page:

Vector email = (Vector)session.getAttribute("rep_email");
if (email != null) {
  if (email.size() > 0) {
if (!firstClause) {
  query += " AND ";
  firstClause = false;
}
query += "(email = '" + email.elementAt(0) + "'";
for (int i=1; ihttp://jsp.davidcastro.com

__
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

===
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://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com



Re: Basic question about web.xml

2001-04-23 Thread chris brown

Thanks for responding.

I have the default "web.xml" file in my tomcat/conf folder.  I copied this
into a the WEB-INF folder of a new context, which I successfully added using
the "context" directives of "server.xml".  Things only started going wrong
*after* I copied this file ; the context worked fine otherwise.

I didn't change "web.xml" initially ; I just tried to see if Tomcat accepted
it as a basis for making webapp-specific changes.  I guessed this should be
okay after reading the "web.xml" part of the Tomcat user guide, which stated
that Tomcat's "general" web.xml is a "feature", and that it's okay to
override its parameters.  But apparently, this isn't the case, as overriding
the definition of the JSP and Invoker servlets causes both of these servlets
to be refused (see my second posting "--more info", for details of log
files).

So you can consider that the "web.xml" file for my webapp is the standard
default one.  I subsequently changed it, removing everything except the
session-config bit, and then it worked okay.

-Chris

- Original Message -
From: "Dennis Leary" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 23, 2001 3:51 PM
Subject: Re: Basic question about web.xml


> Difficult to say what the problem is but it sounds like something in your
web.xml file. I recommend replying with your web.xml contents in your
message.
>
> >>> chris brown <[EMAIL PROTECTED]> 04/23/01 09:12AM >>>
> I'm trying to create my own web.xml file for use in Tomcat.  I've read the
> doc, but I need help to understand what's going on exactly...
>
> I created a new document folder, and added the context mapping in
> server.xml.  I put a simple HTML file and a simple JSP file in the folder,
> and started up Tomcat.  The JSP compiled fine, and both it and the HTML
file
> displayed as intended in the navigator.
>
> I then copied the standard web.xml file from tomcat/conf into my new
> folder... but after restarting Tomcat, I got "HTTP 404 Not Found" errors
for
> the JSP only (although the JSP *does* appear in the directory listing).
If
> I rename "web.xml" as "_web.xml" (and restart Tomcat), no more problem
(but
> obviously, I can no longer configure the web app!), or if I comment out
all
> the default servlet mappings, it runs fine too.
>
> What is the problem?  As I say, I'm using nothing but copies of the
standard
> files, and none of the possible causes of an HTTP 404 error given in
> Tomcat's documentation correspond to my case.  Incidentally, I'm using
> Tomcat 3.1 on top of JDK1.3 on Windows NT4.
>
> Thanks in advance,
> Chris Brown
>
>
===
> 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

===
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



Re: Basic question about web.xml

2001-04-23 Thread Dennis Leary

Difficult to say what the problem is but it sounds like something in your web.xml 
file. I recommend replying with your web.xml contents in your message.

>>> chris brown <[EMAIL PROTECTED]> 04/23/01 09:12AM >>>
I'm trying to create my own web.xml file for use in Tomcat.  I've read the
doc, but I need help to understand what's going on exactly...

I created a new document folder, and added the context mapping in
server.xml.  I put a simple HTML file and a simple JSP file in the folder,
and started up Tomcat.  The JSP compiled fine, and both it and the HTML file
displayed as intended in the navigator.

I then copied the standard web.xml file from tomcat/conf into my new
folder... but after restarting Tomcat, I got "HTTP 404 Not Found" errors for
the JSP only (although the JSP *does* appear in the directory listing).  If
I rename "web.xml" as "_web.xml" (and restart Tomcat), no more problem (but
obviously, I can no longer configure the web app!), or if I comment out all
the default servlet mappings, it runs fine too.

What is the problem?  As I say, I'm using nothing but copies of the standard
files, and none of the possible causes of an HTTP 404 error given in
Tomcat's documentation correspond to my case.  Incidentally, I'm using
Tomcat 3.1 on top of JDK1.3 on Windows NT4.

Thanks in advance,
Chris Brown

===
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



Basic question about web.xml --- more info

2001-04-23 Thread chris brown

For more information, here is STDOUT :

Starting tomcat. Check logs/tomcat.log for error messages
No apps in webapps/
cannot load servlet name: jsp
cannot load servlet name: default

...and here is STDERR :

2001-04-23 03:20:05 - ContextManager: Adding context Ctx(  )
2001-04-23 03:20:05 - Ctx(  ): Removing duplicate servlet jsp
jsp(org.apache.jasper.runtime.JspServlet/null)
2001-04-23 03:20:05 - Ctx(  ): Removing duplicate *.jsp ->
jsp(org.apache.jasper.servlet.JspServlet/null)
2001-04-23 03:20:05 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
8007
2001-04-23 03:20:05 - PoolTcpConnector: Starting Ajp13ConnectionHandler on
8009

No "tomcat.log" file was generated.  I have no webapps in the "webapps"
folder, I just use one context which maps to "/".

Does having the same mapping in /conf/web.xml and any other
"web.xml" cause the mapping to be discarded altogether?  This seems to be
what is happening here, but I don't understand WHY!

I thought that by providing a servlet mapping (JSP or any other) in web.xml
just overrode the default settings within the particular webapp ; as such, I
would have expected that copying the default web.xml would be harmless
(indeed, very useful in some cases, in order to provide different JSP
behaviour for different webapps under the same server..!).

Please explain !

Many thanks,
Chris




- Original Message -
From: "chris brown" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 23, 2001 3:12 PM
Subject: Basic question about web.xml


> I'm trying to create my own web.xml file for use in Tomcat.  I've read the
> doc, but I need help to understand what's going on exactly...
>
> I created a new document folder, and added the context mapping in
> server.xml.  I put a simple HTML file and a simple JSP file in the folder,
> and started up Tomcat.  The JSP compiled fine, and both it and the HTML
file
> displayed as intended in the navigator.
>
> I then copied the standard web.xml file from tomcat/conf into my new
> folder... but after restarting Tomcat, I got "HTTP 404 Not Found" errors
for
> the JSP only (although the JSP *does* appear in the directory listing).
If
> I rename "web.xml" as "_web.xml" (and restart Tomcat), no more problem
(but
> obviously, I can no longer configure the web app!), or if I comment out
all
> the default servlet mappings, it runs fine too.
>
> What is the problem?  As I say, I'm using nothing but copies of the
standard
> files, and none of the possible causes of an HTTP 404 error given in
> Tomcat's documentation correspond to my case.  Incidentally, I'm using
> Tomcat 3.1 on top of JDK1.3 on Windows NT4.
>
> Thanks in advance,
> Chris Brown
>
>
===
> 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



Basic question about web.xml

2001-04-23 Thread chris brown

I'm trying to create my own web.xml file for use in Tomcat.  I've read the
doc, but I need help to understand what's going on exactly...

I created a new document folder, and added the context mapping in
server.xml.  I put a simple HTML file and a simple JSP file in the folder,
and started up Tomcat.  The JSP compiled fine, and both it and the HTML file
displayed as intended in the navigator.

I then copied the standard web.xml file from tomcat/conf into my new
folder... but after restarting Tomcat, I got "HTTP 404 Not Found" errors for
the JSP only (although the JSP *does* appear in the directory listing).  If
I rename "web.xml" as "_web.xml" (and restart Tomcat), no more problem (but
obviously, I can no longer configure the web app!), or if I comment out all
the default servlet mappings, it runs fine too.

What is the problem?  As I say, I'm using nothing but copies of the standard
files, and none of the possible causes of an HTTP 404 error given in
Tomcat's documentation correspond to my case.  Incidentally, I'm using
Tomcat 3.1 on top of JDK1.3 on Windows NT4.

Thanks in advance,
Chris Brown

===
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



Re: Basic Question

1999-10-27 Thread Sachin S. Khanna



Legros,
    try 
deleting the .class file of your servlet & recompile the changed servlet 
source file.
Hope this helps.
As regards to the caching mechanism it depends on 
the directory  in which your class file is as well as which class loader is 
being used to load this class file.
Have a nice day.With regards,Sachin S. 
Khanna.


Basic Question

1999-10-25 Thread Legros, Bertrand

Hi,

I am new to JSP / Servlet.  I have just installed Java Web Server 2 on my
machine.
I have made a servlet , S1 for example.  I have compiled it in a directory.
I have moved the S1.class to the /servlet directory of JWS and add the
servlet with the administration tool.
At this point, I can call the servlet from my browser.

If I change S1 code, recompile it and move the new version to /servlet
directory, I still have the old version of my servlet in my browser. I have
tried to unload and reload the servlet in JWS and clear browser cache, but I
am not able to get the new version.

Could someone explain me what is the caching mechanism involved here ?

Thanks.
Bertrand

===
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html