the <script runat=server> makes the code into server side JavaScript I don't think u can combine java and server side java script...
and u can remove the <script runat=server> line from ghosh's example... it serves no purpose there as he is encapsulating the code into a initialization scriptlet. Hope that helps. Amit -----Original Message----- From: A mailing list about Java Server Pages specification and reference [mailto:[EMAIL PROTECTED]]On Behalf Of Rajarshi Ghosh Sent: Tuesday, February 11, 2003 9:29 PM To: [EMAIL PROTECTED] Subject: Re: An unusual JSP behaviour Hi Bob, This works... <HTML> <HEAD><TITLE>Hello1</TITLE></HEAD> <BODY> <H1> Hello, <%= getName(request) %> </H1> </BODY> </HTML> <SCRIPT RUNAT="server"> <%! private static final String DEFAULT_NAME = "World"; private String getName(HttpServletRequest req) { String name = req.getParameter("name"); if (name == null) return DEFAULT_NAME; else return name; } %> </SCRIPT> ----------LOVE IS GOD--------- Rajarshi Ghosh =========================================================================== 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