Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Can I inherit jsp page

  Asked By: Koila    Date: Jul 14    Category: Java    Views: 2310
  

Can I inherit jsp page . I have one jsp page which contain some
common functionality, can I made a parent jsp and then I will
inherit all jsp pages , so that I don't have to write in every jsp
page.

Right now I made a class and call that function in all jsp page but
if I can inhert all me jsp pages from a parent then I don't have to
write every where .

Share: 

 

6 Answers Found

 
Answer #1    Answered By: Brandi Ramirez     Answered On: Jul 14

You can write  the common jsp  page contain common functionality, and in the child page  use include tag to include the common jsp page.

 
Answer #2    Answered By: Archie Parker     Answered On: Jul 14

Using include tag you can you can do it not only for
any jsp  but also for any html pages!

 
Answer #3    Answered By: Hamdan Younis     Answered On: Jul 14

inheritance is not supported in web pages  but you can use include to have some common functionality  in your pages.It is simple. you include that common jsp  page.
but , in other way , you can write  a jsp tag lib with a java class  that have some common functionality , then you can write other tag libs with their classes that this classes inherit  your common java class.

 
Answer #4    Answered By: Laaibah Malik     Answered On: Jul 14

Inheritence is not supported in web pages, and including in jsp  pages really dosen't related to Inheritence concept, but including are the same and common part of jsp pages  that are included and pasred by application server as part of the main page.
I think it is better you look at Tiles. you can define your own Tiles Layout in your web app and in tiles-def extends it and also override it.

 
Answer #5    Answered By: Daw Boonliang     Answered On: Jul 14

it supports inheritance.
inheritance means "code reuse" and tiles directly does it for you.
[ if you wanna use something more easier and faster to learn, use
Struts template library. it's so easly useable. ]

 
Answer #6    Answered By: Christie Bradley     Answered On: Jul 14

I didn't mean inheriting in web page!
Some one wants to use some common jsp  pages in other
jsp pages  without writing them each time and I
recommend to using <jsp:include> tag or <%@ include
file="">, the message didn't want to use tag library.

 
Didn't find what you were looking for? Find more on Can I inherit jsp page Or get search suggestion and latest updates.




Tagged: