Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Submitted Value is show as null

843836Apr 20 2005 — edited Apr 20 2005
Hai please help me..

The submitted form is not listing the submitted values. Its always showing null.

I am using Sun Java System Application Server 8 2005Q1 version.

I am submitting a student name through a web page index.jsp. The submit.jsp takes this name through index.jsp and displays this name by using the bean 'StudentBean'. This bean will be used to set and get the submiitted name.

I created a small bean 'StudentBean'
this is the code for StudentBean:
package MyPkg;
public class StudentBean{
public String studentName;
public void setStudentName(String studentName){
this.studentName=studentName;
}
public String getStudentName(){
return this.studentName;
}
}

After I created a submit.jsp page with the following code:
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head><title>Welcome Page</title></head>
<body bgcolor="white">
<jsp:useBean id="s" class="MyPkg.StudentBean">
<jsp:setProperty name="s" property="*" />
The Student Name u submitted is:
<B><jsp:getProperty name="s" property="studentName" />
</jsp:useBean>
</B>
</body>
</html>

The submit.jsp page will be accessed after submitting the index page (index.jsp). Following the code for index.jsp:

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head><title>Welcome Page</title></head>
<body bgcolor="white">
<form name="nameForm" action="submit.jsp" method="post">
<b>Key-in Your Name:</b>
<input type="text" name="studentName">
<input type="submit" name="Submit" value="Get Name">
</form>
</body>
</html>
</html>

Once I submit this page I am getting the following error:

The Student name u submitted is: null.
instead of showing the submitted student name.

What could be the reason..?
Is bean is not instantiating..?

Please help..?

Thanx,
Satish.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 18 2005
Added on Apr 20 2005
3 comments
83 views