Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   Use Of Bean In JSP (http://www.go4expert.com/forums/bean-jsp-t24990/)

angad_aks 16Feb2011 00:38

Use Of Bean In JSP
 
Code:

<html>
<head>
        <title>SimpleBean Test Page</title>
</head>
<body>

<%-- Creating JavaBeans --%>
<jsp:useBean id="simple" class="com.stardeveloper.bean.test.SimpleBean">
        <jsp:setProperty name="simple" property="name" value="Faisal Khan" />
        <jsp:setProperty name="simple" property="age" value="24" />
</jsp:useBean>

<%-- Displaying JavaBean property's value --%>
<p>Name retrieved from JavaBean has the value of :
        <b><jsp:getProperty name="simple" property="name" /></b>.<br>
Age retrieved from JavaBean has the value of :
        <b><jsp:getProperty name="simple" property="age" /></b> years.<br>
</p>

</body>
</html>



All times are GMT +5.5. The time now is 14:58.