• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Properties, Attributes and Parameters

 
Judy Collins
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Properties, Attributes and Parameters. More I read, more confused I am . Can anybody help me differenciate between Properties, Attributes and Parameters.

Thanks in advance.
 
Shiang Wang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question is very broad, I will try to make it short. A good book like "Head First Servlet and JSP" would be your best bet to understand these concepts completely.

Normally when we talk about properties in JSP, it is meant for properties in JavaBean that we use by specifying <jsp:useBean> action in JSP page. JavaBean is a java class where you must have a setter and a getter method for each member in the class and a non-argument constructor. The purpose of using JavaBean is to present data in JSP code with a much cleaner way.

Parameters are designed for passing arguments to servlet. It can be static (when you define initial parameters in deployment descriptor), dynamical (at runtime via browser) or programmatical (if you use dispatcher, or redirect to another resource). Parameters can only be type of String but you can have multiple values mapped to the same name.

Attributes are for sharing and storing information in servlet/jsp and among servlet/jsp. It has three scopes in servlet and four scopes in JSP. It can be used to store any type of object, but you can only map one value to one name in a given scope.

Shiang
Shiang
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic