Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling init()  RSS feed

 
vikasids sharma
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
Please let me know can we call init method of servlet from jsp. Here the servlet is one generated from jsp at translation.

Can we pass arguement while creating instance of bean using UseBean tag from jsp?

Thankz
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
init() is called by the container.
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't create bean with constructor since it always calls the no-arg constructor.

You call the parametrized constructor in side the no-arg constructor in your bean.

Regards
 
vikasids sharma
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how do i get parameter in bean to be passed from no -arguement constructor?
Originally posted by Sarath Mohan:
You can't create bean with constructor since it always calls the no-arg constructor.

You call the parametrized constructor in side the no-arg constructor in your bean.

Regards
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vikasids sharma:
But how do i get parameter in bean to be passed from no -arguement constructor?


As far as I know, Can not.
You can alternatively set properties after getting it instantiated.
[ April 06, 2005: Message edited by: Adeel Ansari ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!