Hi Rajarshi,
Thanks for your suggestion! However, the code works partially, that is, after
incorporating your suggestion, namely : the variable "name" is not able to
return the DEFAULT_NAME when the later is null - it works only when it is not
null(name!=null). Here is the revised code once again:
<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>
Amit might be right (??)
===========================================================================
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