Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

What is the difference between <@ include> & <%jsp:include%>

  Asked By: Gin    Date: Jul 10    Category: Java    Views: 2147
  

1)What is the difference between
<@ include> & <%jsp:include%>

2)In two ways we can crete thread
1.Runnable interface
2.Thread class
which one is better & WHY ?
3)what is the difference between GEnericservlet &
HttpServlet ?

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Hababah Younis     Answered On: Jul 10

> 1)What is the difference  between
> <@ include> & <%jsp:include%>

<@ include> Includes the file at translation (compilation) time,
inserting it into the file as it is built. It becomes part of the
servlet code.

<jsp:include> Includes the OUTPUT of the included file at request
time, and so amounts to being some inserted HTML code.

> 2)In two ways we can crete thread
> 1.Runnable interface
> 2.Thread class
> which one is better & WHY ?

Don't know.
> 3)what is the difference between GEnericservlet &
> HttpServlet ?

HttpServlet is a subclass of GenericServlet and adds the doPost and
doGet methods to handle http requests.

 
Answer #2    Answered By: Edfu Massri     Answered On: Jul 10

1. the first include is a static include (ie it always includes the same
file) the second is dynamic (ie you can change what gets included at
runtime - say by evaluating some condition to determion which file you
want to include)

2. much the same really - you would use the interface if your class
already extended something else (interfaces are java's way of doing
mutiple inheritance of a sort)

3. HttpServlet adds Http specific stuff - it's what you would use most
of the time.

 




Tagged: