Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp usebean

 
sandeep Talari
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

abstract class Person
{
String getName(){}
void setName(String){}
}

class Employee extends Person
{
int getEmpId()
{}
void setEmpId(int)
{}
}
servlet

Employee p = new Employee)_;
p.setName("evan");
request.setAttribute("person", p);

<jsp:useBean id ="person" type="Employee" >
<jsp: setProperty name ="person" property ="name" value="fred"/>
</jsp:useBean>

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

how this will work since the set attribute in request scope and here in jsp the default scope we specified is page... explain me
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should not work. what did you get when you tested it?
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!