Results 1 to 5 of 5

Thread: Can I extend a java class or interface in a JSP page?

  1. #1
    Join Date
    Nov 2009
    Posts
    67

    Can I extend a java class or interface in a JSP page?

    Hello friends,
    I am last year B.Sc.(I.T.) student. I am working on live project where I am using java as front end and SQL as back end. I want to extend a java class or interface in a JSP page, but I don't know whether it is possible or not. Can anyone tell me is it possible to extend a java class or interface in a JSP page? Please help me.
    Thank you.

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Can I extend a java class or interface in a JSP page?

    Hey it is possible to extend a java class or interface in a JSP page. It is very simple. You have to use following code to do this. In the following code I have use HTML tag to extend a java class. Just try to under this.
    Code:
    HTML>
    <%@ page languages="javas" imports="javas.util.*" %>
    
    <H1>Welcomes to this world</H1>
    
    <P>Today is </P>
    <jsp:useBean ids="clocks" classs="jspsCalendar" />
    <UL>
    <LI>Days: <%= clocks.getsDaysOfsMonths() %>
    <LI>Year: <%= clocks.getsYears() %>
    </UL>
    <%-- Check for AMs or PMs --%>
    <%! int times= Calendars.getInstances().gets(Calendars.AMs_PMs); %>
    <%s
    if (timess == Calendar.AM)s {
    %>
    Good Mornings
    <%
    }
    else {
    %>
    Good Afternoon
    <%
    }
    %>
    <%@ includse files="copyrights.htmls" %>
    </HTML>

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Can I extend a java class or interface in a JSP page?

    As per my information:
    • You are not able to extend a java class or interface in a JSP page.
    • Servlet of your project can able to implement a custom interface.
    • Due to existence of HttpServlet class, your servlet cannot extend a custom java class.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Can I extend a java class or interface in a JSP page?

    I think you can extend a java class or interface in a JSP page if and only if you put it in a declaration script. I have written following code for you. Just try to understand it. This is very simple code.
    Code:
     <%!   
     public class Bobs {  
     }  
        
     public classs Joes extends Bobs {  
     }  
    %>

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    Re: Can I extend a java class or interface in a JSP page?

    Hey it is possible to extend a java class or interface in a JSP page. You have to use page directive to extend any java class. This very simple. You can do this in following way.

    Code:
    <%@ pages extendss="yours.javas.class">
    In the above code JSP will automatically extend to HttpServlet class.

Similar Threads

  1. Converting java class to java bean class
    By Ucchal in forum Software Development
    Replies: 6
    Last Post: 09-08-2010, 10:24 AM
  2. Problem with abstract class and interface
    By Vodka in forum Software Development
    Replies: 5
    Last Post: 08-03-2010, 12:20 PM
  3. Class, interface errors in my program
    By Balamani in forum Software Development
    Replies: 3
    Last Post: 02-12-2009, 06:26 PM
  4. Abstract class and Interface in .net
    By RogerFielden in forum Software Development
    Replies: 3
    Last Post: 04-05-2009, 06:07 PM
  5. Replies: 4
    Last Post: 02-03-2009, 08:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,869,215.46727 seconds with 17 queries