Results 1 to 4 of 4

Thread: Objects in JSP and JavaBeans

  1. #1
    Join Date
    Mar 2010
    Posts
    372

    Objects in JSP and JavaBeans

    Hello,
    Can I utilize a java class in jsp page using JavaBeans. I run the jsp page for the first time, all goes well, but the problem is if I launch a second jsp page in the same window, the method class do not work. Another note, if I close the window and I launched the jsp it works correctly. Any more help will be great. Thank you for your replies.

  2. #2
    Join Date
    Nov 2009
    Posts
    446

    Re: Objects in JSP and JavaBeans

    You define your object in request scope (for the application until the end of the total treatment) or page scope for the sole assessment of the jsp. You can find a good information on this on the sun's official web site. So, I recommend you to visit the sun's web site for documentation.
    See if this thread can help you
    What are the implicit objects in JSP?

  3. #3
    Join Date
    Mar 2010
    Posts
    372

    Re: Objects in JSP and JavaBeans

    Here is the code
    Code:
    <% @ Page import = "bd .*"%> 
    <% @ Include fl = "par.jsp"%> 
    <jsp:useBean id="cm" class="bd.CombinParametre" scope="session"> </ jsp: useBean> 
    <% 
    cm.methode (); 
    %>
    And here is a sample java class
    Code:
    package db; 
    import java.sql .*; 
    (public class CombinParametre 
    public int x; 
    public int d; 
    public void method () 
    ( 
    / / Source code 
    ) 
    I do not know if the class implements Serializable must 
    )

  4. #4
    Join Date
    Dec 2009
    Posts
    296

    Re: Objects in JSP and JavaBeans

    Your bean is in session scope which means that the first time it is instantiated and the second it is reused. We must realize that you can spirit will be one bean of this type for any user session. To start, are you sure your method is re-entrant? because if it works at first call and not the second could be the problem.

Similar Threads

  1. Animated objects in Oil Rush
    By Chitti's in forum Video Games
    Replies: 4
    Last Post: 01-02-2012, 07:51 AM
  2. What are objects and classes in C++?
    By Tionontati in forum Software Development
    Replies: 3
    Last Post: 28-12-2010, 08:46 AM
  3. Objects in VBScript
    By Ananika in forum Software Development
    Replies: 5
    Last Post: 27-11-2010, 09:13 PM
  4. What are the PHP Data Objects?
    By Jacques25 in forum Software Development
    Replies: 5
    Last Post: 07-03-2010, 05:13 AM
  5. What are the implicit objects in JSP?
    By Coffee in forum Software Development
    Replies: 3
    Last Post: 07-08-2009, 05:27 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,714,212,800.60787 seconds with 17 queries