JSP calling methods on a base servlet - how

Discussion in 'Java' started by Will, Aug 21, 2005.

  1. Will

    Will Guest

    I have a servlet called Register
    that extends a base servlet
    called BaseServlet (which is an
    EJB I think). Then in the Register
    servlet I can use methods from
    BaseServlet easily - because it
    extends it. My boss told
    me to use JSP and not servlets.
    But then my JSP cannot 'extend'
    BaseServlet. Neither can I use
    <jsp:useBean id="BaseServlet" class="common.servlet.BaseServlet" />
    because it returns an error.
    So how can I use BaseServlets methods
    if I cannot 'extend' it
    in the normal way.
    I can do <jsp:useBean id="myBean" class="java.lang.String"
    scope="session" /> OK but when I try my BaseServlet bean it returns 500
    Server error.
    Is it that one can't 'extend' other servlets from a jsp?
    Will, Aug 21, 2005
    #1
    1. Advertising

  2. Will wrote:
    > I have a servlet called Register
    > that extends a base servlet
    > called BaseServlet (which is an
    > EJB I think).


    It is very unlikely that your servlet is also an EJB.

    > Then in the Register
    > servlet I can use methods from
    > BaseServlet easily - because it
    > extends it. My boss told
    > me to use JSP and not servlets.


    Is your boss a technical boss or a manager? If he or she is a manager,
    you should explain which technology is right for the job. If he or she
    is a technical boss, then ask him or her to explain how to accomplish it.

    > But then my JSP cannot 'extend'
    > BaseServlet.


    There is a page attribute in JSP for specifying the base class, although
    its use is frowned upon.

    > Neither can I use
    > <jsp:useBean id="BaseServlet" class="common.servlet.BaseServlet" />
    > because it returns an error.
    > So how can I use BaseServlets methods
    > if I cannot 'extend' it
    > in the normal way.
    > I can do <jsp:useBean id="myBean" class="java.lang.String"
    > scope="session" /> OK but when I try my BaseServlet bean it returns 500
    > Server error.
    > Is it that one can't 'extend' other servlets from a jsp?
    >


    HTH,
    Ray

    --
    XML is the programmer's duct tape.
    Raymond DeCampo, Aug 21, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. circuit_breaker
    Replies:
    2
    Views:
    1,994
    Jack Jia
    Apr 4, 2004
  2. Jawahar
    Replies:
    1
    Views:
    538
    Simon Mieth
    Sep 23, 2003
  3. javadev
    Replies:
    5
    Views:
    12,901
    javadev
    Nov 16, 2006
  4. Replies:
    4
    Views:
    780
  5. vaneric

    calling a Servlet from a jsp

    vaneric, Dec 9, 2008, in forum: Java
    Replies:
    2
    Views:
    10,521
    vaneric
    Dec 9, 2008
Loading...

Share This Page