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

which one is better to use jsp:useBean or import statement .

 
pavan sharma
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I just want to know that which one is better to use jsp:useBean or import statement .

I can instantiate and call method of myclass -
1) by importing the class through import tag in jsp as <%@page import="myclass"%. or
2). by using <jsp:useBean tag....

i have these two option to do the same thing. i know that basically useBean is used to call setter and getter method of bean class and but it can be used to call a normal java file that have some logic .
so what should i used , which one is better and why?

useBean provides scope and object instance so no need to create object by new operator. and with import you have to create an instance .

but which tag should i use in my jsp?

i am confused???
 
pavan sharma
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any body to clarify my this question?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Less that three hours have passed since you posted your question. Please read this.
 
pavan sharma
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok,
i am waiting for reply..
 
Leandro Melo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

Usually, using tags makes the jsp cleaner than when you use scripts. Additionally, if you need custom behaviour, you can always create your own tags.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65535
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, if you are using JSP 2 you should no longer be using any Java scriptlets on your pages and therefore import is no longer relevant.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!