Hello friends,
Help me out.
This is my Bean file stored in classes folder of JavaWebServer
package mypack;
public class MyBean
{
String usern="";
public void setMessage(String str)
{
usern=str;
}
public String getMessage()
{
return usern;
}
}
This is my .jsp file stored in jsp folder of JavaWebServer.
<jsp: useBean id="obj" class="MyBean" scope="page"/>
<html>
<body bgcolor=orange>
<h1> This is gurus JSP with Bean </h1> <br>
<% String s=request.getParameter("t1");
obj.setMessage(s);
String a= obj.getMessage();
out.println(a);
%>
</body>
</html>
And this is my HTML file
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="#FFCCFF" text=blue>
<FORM ACTION="http://localhost:8080/examples/jsp/MyBeanPara.jsp">
Enter any Name : <INPUT TYPE="text" NAME="t1" size=25>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
And this is the error I am getting when I press the SUBMIT button in HTML file.
Error getting compiled page
C:\JAVAWEBSERVER2.0\BIN\..\tmpdir\default\pagecompile\jsp\_examples\_jsp\_MyBeanPara.java:33: Undefined variable or class name: obj
obj.setMessage(s);
^
C:\JAVAWEBSERVER2.0\BIN\..\tmpdir\default\pagecompile\jsp\_examples\_jsp\_MyBeanPara.java:34: Undefined variable or class name: obj
String a= obj.getMessage();
^
2 errors
NOW CAN ANYONE PLEASE EXPLAIN ME WHERE I AM WRONG.
THANKING YOU IN ANTICIPATION.
Regards
Tejas
Help me out.
This is my Bean file stored in classes folder of JavaWebServer
package mypack;
public class MyBean
{
String usern="";
public void setMessage(String str)
{
usern=str;
}
public String getMessage()
{
return usern;
}
}
This is my .jsp file stored in jsp folder of JavaWebServer.
<jsp: useBean id="obj" class="MyBean" scope="page"/>
<html>
<body bgcolor=orange>
<h1> This is gurus JSP with Bean </h1> <br>
<% String s=request.getParameter("t1");
obj.setMessage(s);
String a= obj.getMessage();
out.println(a);
%>
</body>
</html>
And this is my HTML file
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY BGCOLOR="#FFCCFF" text=blue>
<FORM ACTION="http://localhost:8080/examples/jsp/MyBeanPara.jsp">
Enter any Name : <INPUT TYPE="text" NAME="t1" size=25>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
And this is the error I am getting when I press the SUBMIT button in HTML file.
Error getting compiled page
C:\JAVAWEBSERVER2.0\BIN\..\tmpdir\default\pagecompile\jsp\_examples\_jsp\_MyBeanPara.java:33: Undefined variable or class name: obj
obj.setMessage(s);
^
C:\JAVAWEBSERVER2.0\BIN\..\tmpdir\default\pagecompile\jsp\_examples\_jsp\_MyBeanPara.java:34: Undefined variable or class name: obj
String a= obj.getMessage();
^
2 errors
NOW CAN ANYONE PLEASE EXPLAIN ME WHERE I AM WRONG.
THANKING YOU IN ANTICIPATION.
Regards
Tejas