Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > PHP/MySQL/Scripting

  • Print
  • + Share This
This chapter is from the book

Using <jsp:getProperty>

One of the primary reasons for using JavaBeans is to return dynamic information. The <jsp:getProperty> action returns information from a bean as a String object. There are only two attributes in this action:

  • name—Specifies the name of the bean instance from which you want to obtain the data. This must be the name of a valid bean that was instantiated by using the <jsp:useBean> action.

  • property—Specifies the property within the specified bean that you want to output.

So, using the instantiated today bean, you can return the current month and date by using the following JSP code:

<jsp:getProperty name="today" property="month" />
/
<jsp:getProperty name="today" property="date" />

If today is the 17th of February, this example outputs the information 2/17.

  • + Share This
  • 🔖 Save To Your Account