In terms of performance, little difference is caused by splitting
scriptlets (perhaps the extra print noted below.

However, this may be a typo on your part, but

  <%! String hostname;%>

declares an *instance* variable "hostname".
While this assignment:

  <%
    hostname    = request.getParameter("Host");
  %>

happens in the _jspService method. Essentially the hostname variable is not
thread safe. When accessing the hostname value, you will have a race
condition if the JSP does not implement SingleThreadModel.






[EMAIL PROTECTED] on 22/01/2001 18:31:49

Please respond to [EMAIL PROTECTED]; Please respond to
      [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:    (bcc: Ken X Horn)
Subject:  RE: Syntax and Performance



I think it will generate a out.print("\n"); that is unecesary.
Why don't you look at the generated code?

Bye,

Gaston


  ----- Original Message -----
  From: Hobson, Don
  To: '[EMAIL PROTECTED]'
  Sent: Monday, January 22, 2001 2:36 PM
  Subject: Syntax and Performance


   Is there any reason that I should not do this:

  <%! String hostname;%>
  <%
    hostname    = request.getParameter("Host");
  %>

  Does the compiler have to do any extra work? Should I combine them?
I think it will generate a out.print("\n"); that is unecesary.
Why don't you look at the generated code?
 
Bye,
 
Gaston
 
 
----- Original Message -----
Sent: Monday, January 22, 2001 2:36 PM
Subject: Syntax and Performance

 Is there any reason that I should not do this:
 
<%! String hostname;%>
<%
  hostname    = request.getParameter("Host");
%>
 
Does the compiler have to do any extra work? Should I combine them? 
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to