Here's a guess. Close off the tag for the static string. For example: <%! private static final String DEFAULT_NAME = "World"; %>
Then put the rest of your code in <% // the rest of your code %> --- Bob Prah <[EMAIL PROTECTED]> wrote: > I can't get the following code to display the string variable "DEFAULT_NAME" > when variable "name" is null or empty. This appears unusual : > [ > > <HTML> > <HEAD><TITLE>Hello1</TITLE></HEAD> > <BODY> > <B> > Hello, <%= getName(request) %> > </B> > </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> > > ] > > Any suggestion will be much appreciated. > > -Bob > > ==========================================================================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 __________________________________________________ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.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