• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can i have class in jsp file

 
Vasantha Prabha
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can any one tell me that
Can I have a class in jsp?
can I have a method in jsp?
Regards,
Sangeetha Prabindh
 
JavaHunk
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sangeetha,
You can always declare classes, member variables, static variable and
methods inside a JSP as you do with normal java files.
Here is the JSP example which has everything you have asked for.


Execute it as it is. You can see how it works and then go thru the code
too.
Regards
Goodieguy
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the reasons why you might want to do so are few and far between. Much better to have such Java processing off in beans and other classes that are far more maintainable, reusable, testable and whole lot of other good '-ables'.
bear
 
Vasantha Prabha
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot
regards,
sangeetha Prabindh
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!