Results 1 to 3 of 3
  1. #1
    Greg is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

    Unhappy How do I call a class in jsp page

    Forgive me for the simple question.
    I am not new to Java but I am brand new to JSP and I am having a hard time with some of the basics.
    I created a servlet "General" with a class in it called "RandomNumber" which returns an integer.
    How can I call this from a JSP page?
    Do I need to just create a class as opposed to a servlet?

    Thanks for reading and thanks for any help in advance.

    Edit:Added info

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    10

    Default

    Your RandomNumber class doesn't need to be inside the Servlet does it?
    There are several ways of displaying values in JSPs. A popular approach is to use a bean. Read all about it in Sun's JavaEE tutorial (freely downlodable from the internet)
    Just remember never to put Java code inside JSPs.

  3. #3
    Greg is offline Member
    Join Date
    Sep 2009
    Posts
    2
    Rep Power
    0

Similar Threads

  1. how to call servlet from the very first jsp page
    By R O C K Y in forum Advanced Java
    Replies: 6
    Last Post: 07-04-2012, 04:20 PM
  2. How to call a method from another class?
    By jboy in forum New To Java
    Replies: 8
    Last Post: 09-09-2009, 07:29 AM
  3. NTLM Authentication; cannot call aspx page from java
    By getstarted in forum Advanced Java
    Replies: 0
    Last Post: 04-14-2009, 06:39 PM
  4. How to call a class within a method
    By Manfizy in forum New To Java
    Replies: 3
    Last Post: 03-19-2009, 01:34 PM
  5. Can I call directly the *.class
    By doanhanam in forum New To Java
    Replies: 1
    Last Post: 11-16-2008, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •