bean property

hi

i m using netbeans 5.0 to create my project in jsp

i have one bean which has property "age"

when i m using getProperty element of jsp to display the set value in age it is displaying the default value but not the changed value

also there is no error.

here i m pasting my code

////bean class////////

package testingjsp;

/**

*

* @author administrator

*/

public class AgeHandler

{

private int age;

/** Creates a new instance of AgeHandler */

public AgeHandler()

{

setAge(0);

}

public int getAge()

{

return age;

}

public void setAge(int age)

{

this.age = age;

}

}

///- jsp file--//////

<%@page contentType="text/html"%>

<%@page pageEncoding="UTF-8"%>

<%--

The taglib directive below imports the JSTL library. If you uncomment it,

you must also add the JSTL library to the project. The Add Library... action

on Libraries node in Projects view can be used to add the JSTL 1.1 library.

--%>

<%--

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Page</title>

</head>

<body>

<h1>JSP Page</h1>

<jsp:useBean id="agebean" scope="session" class="testingjsp.AgeHandler" />

<jsp:setProperty name="agebean" property="age" value="0" />

<jsp:getProperty name="agebean" property="age" />

</body>

</html>

and the index file

////-- index file-///

<%@page contentType="text/html"%>

<%@page pageEncoding="UTF-8"%>

<%--

The taglib directive below imports the JSTL library. If you uncomment it,

you must also add the JSTL library to the project. The Add Library... action

on Libraries node in Projects view can be used to add the JSTL 1.1 library.

--%>

<%--

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

--%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>JSP Page</title>

</head>

<body>

<h1>Age Form</h1>

<form name="Age Form" action="ageresponse.jsp">

Enter Age :<input type="text" name="txtage" value="0" />

<input type="submit" value="OK" name="btnok" />

</form>

</body>

</html>

when i click on OK button

it is displaying0as output

not the filled value

plz help me

[3088 byte] By [glimpsingjavaa] at [2007-11-27 5:12:03]
# 1
<jsp:setProperty name="agebean" property="age" value="0" />I see you setting the value of age to 0, but never to the submitted value. So yes it is going to be 0.
gimbal2a at 2007-7-12 10:32:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...