• Post Reply Bookmark Topic Watch Topic
  • New Topic

useBean  RSS feed

 
amarkirt saroay
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we have request.setAttribute("emp",e);

and In <jsp:useBean id="emp" scope="request" class="com.example.Employee" >
which of the following are correct to have ?
<jsp:setProperty name="emp" property="name" value="kt"/>
or <jsp:setProperty name="e" property="name" value="kt"/>

Which one is correct value for name attribute of setProperty and same way for getProperty also?

<jsp:getProperty name="emp" property="name"/>

or <jsp:getProperty name="e" property="name"/>
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The name of the getProperty/setProperty must match the id of the bean. In your case, the id is "emp".
You can check this kind of thing in the JSP specification.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!