Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Getting a Property value in jsp 
 

To reduce the the scriplet code with jsp, there is an easier way of accessing properties of bean by using getProperty tag which automatically sends the result of the method.

 

Getting a Property value in jsp

                         

This section illustrates you how to use <jsp:getProperty> tag.

To reduce the the scriplet code with jsp, there is an easier way of accessing properties of bean by using getProperty tag which automatically sends the result of the method. The tag <jsp:getProperty> has two attributes, name and property. Name attribute refers to the id of the bean and property attribute refers to the method of the bean. Here we are providing you an example which illustrates you the use of <jsp:getProperty> tag.

Here is the code of getProperty.jsp

<HTML>
<HEAD>
<TITLE>Getting a Property Value</TITLE>
</HEAD>
<BODY>
<H1>Getting a Property Value</H1>
<jsp:useBean id="bean" class="form.GetProperties" />
The text is: <jsp:getProperty name="bean" property="text" /> 
</BODY>
</HTML>

Here is the bean GetProperties.java

package form;
public class GetProperties
{
private String text="Hello World";
public String getText()
{
return text;
}
public GetProperties()
{}
}

In the above example, we are using bean with <jsp:useBean> tag. <jsp:getProperty> tag calls the bean  and its method 'text' with its attributes id and property.

Here is the output

Download Source code

                         

» View all related tutorials
Related Tags: c debugging exception error jsp ide orm process form debug io stack method format print get page trace vi trac

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.