Hi All
i am new to JSP programming
could somebody tell me what is the problem with the above code.
when the jsp is called first time it should display login page
and then
after that it should disllay welcom <username>
it is throwing following exception
_____________________________________________________________
Unhandled error! You might want to consider having an error page
to
report such
errors more gracefully
com.sun.jsp.JspException: getProperty(try): cant find method to
read {1}
at
com.sun.jsp.compiler.GetPropertyGenerator.generate(GetPropertyGenerat
or.java:84)
at
com.sun.jsp.compiler.Jsp1_0ParseEventListener$GeneratorWrapper.genera
te(Jsp1_0ParseEventListener.java:675)
at
com.sun.jsp.compiler.Jsp1_0ParseEventListener.generateAll(Jsp1_0Parse
EventListener.java:143)
at
com.sun.jsp.compiler.Jsp1_0ParseEventListener.endPageProcessing(Jsp1_
0ParseEventListener.java:114)
at com.sun.jsp.compiler.Main.compile(Main.java:284)
at
com.sun.jsp.runtime.JspLoader.loadJSP(JspLoader.java:135)
at
com.sun.jsp.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspS
ervlet.java:77)
at
com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.j
ava:87)
at
com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:218)
at
com.sun.jsp.runtime.JspServlet.service(JspServlet.java:294)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
at
com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:155
)
at
com.sun.web.core.Context.handleRequest(Context.java:414)
at
com.sun.web.server.ConnectionHandler.run(ConnectionHandler.java:139)
________________________________________________________________
the bean and jsp code are attached with the document
thanx,
_________
JSP File
_________
<!--
Number Guess Game
Written by Jason Hunter <[EMAIL PROTECTED]>, CTO, K&A Software
Copyright 1999, K&A Software, distributed by Sun with permission
-->
<%@ page import = "TryBean" %>
<jsp:useBean id="try" class="TryBean" scope="session"/>
<jsp:setProperty name="try" property="*"/>
<html>
<head><title>Number Guess Game</title></head>
<body bgcolor="white">
<font size=4>
<% if (try.getStatus()) { %>
<form action="">
Enter your username and password
UserName :<input type="text" name="username">
Password :<input type="text" name="password">
<% } else { %>
Welcome to the Number Guess game.<p>
Your username <jsp:getProperty name="username" name="try"/>
Your Passowrd <jsp:getProperty name="password" name="try"/>
<% } %>
</body>
</html>
_________
Bean File
_________
public class TryBean
{
public String username;
public String password;
public boolean firstTime=true;
TryBean()
{
username="";
password="";
}
public void setUsername(String username)
{
this.username=username;
firstTime=false;
}
public void setPassword(String password)
{
this.password=password;
firstTime=false;
}
public String getPassword()
{
return password;
}
public String getUsername()
{
return username;
}
public boolean getStatus()
{
return firstTime;
}
}
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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