Discussions

Web tier: servlets, JSP, Web frameworks: need urgent help in jsp beans

  1. need urgent help in jsp beans (7 messages)

    Hello Friends,

    I am facing a problem in jsp.I am creating a jsp file name home.jsp which i put in public_html(currently i am using java webserver2.0).In that jsp file i am refering a bean name Omnistats with the scope session in the following way

    <jsp:useBean id="stats" class="omnijobs.Omnistats" scope="session" />

    my Omnistats file is in directory d:\javawebserver2.0\servlets\omnijobs.

    With this, the jsp file working good in my system.But when my move these files to my server it is giving Omnistats bean not found error.I am creating same directory structure and put the files in the same as in my machine.

    Why this error came? What's my mistake? If i did any thing wrong please correct me.

    Thanks and Regards,
    sreedhar garimella.

    Threaded Messages (7)

  2. Sreedhar,

       This sounds like either a type on your JSP (maybe you mispelt the classfile wrong), or a classpath error. Maybe you have to declare something in your JWS config files when deploying a bean?

       Also try moving your stats bean to whatever JWS uses as a "server classes" directory, as opposed to your servlet classes directory.

    hope this helps,

    Floyd
  3. Hi Floyd,

    Thanks once again for your reply. I create a directory beans in server "classes" directory and i gave like this

    <jsp:useBean id="stats" class="beans.Omnistats" scope="session" />

    Now the jsp file works fine.

    I have few more doughts

    1)
    Is it must to put jsp beans in one subdirectory of classes directory?

    2)
    Previous u mentioned i have to change configure files of webserver.If so in which file i have to change?

    3)what is the difference between these scopes in beans
    like page,request,session and application?I did not understand properly this scope parameter.please explain in detail in which situation i have to put a particular scope to my bean?

    Thanks and Regards,
    sreedhar garimella.




    sreedhar garimella.
  4. As I understand it, this is how the scopes work:

    1) page
       anything placed in the page scope is accessible only by JSP code within that page.


    2) request
       This is the most common scope level. Request level scope is where you place parameters/objects that need to be accessed by any servlets/jsp's used in the current request. For example, when you JSP:include your example servlet, all the parameters it accesses are in the "request". From your main JSP, you could add more objects to the request, and the example servlet and any other included servlets/jsp's would have access to those parameters. Once the page has been outputted to the client, these objects/parameters dissappear.

    3) session
       Session scope is for objects that are "specific to the particular user accessing the site", to be stored "across requests". So if a user logs in, you would store this in the session, and any time he wanted to go a restricted area of the site, you would check the session scope to see if he is logged in. Shopping carts are implemented by placing information in the session.

    4) application
       Application scope is for global variables, which can be accessed by any servlet/jsp in the application.

    hope this helps,

    Floyd
  5. need urgent help in jsp beans[ Go to top ]

    We have a situation here. We have to cache data into some place. This data is not changed frequently. Hence to avoid the db hits, the cache.
    Can anyone tell me which is the best place to cache data.
    We use JSP, EJP with weblogic 5.1
    The options which came to me are:
    storing in a bean with scope as application
    storing in the work spaces of weblogic
    storing in entity bean and referencing from stateful session bean.
    Can any one clarify the above and please explain each in detail and specify why the advised option is better than the others.
    Thanks,
    Nicklesh
  6. need urgent help in jsp beans[ Go to top ]

    Nicklesh,

       Set your WL beans to use dbIsShared, and isModified property, then the entity beans themselves will be your cache, and you won't have to do any programming.

    Floyd
  7. need urgent help in jsp beans[ Go to top ]

    I understand the use of ismodified and db-is-shared to be false to cache data. But this is the solution for one ejb server.
    Can you describe to me how to get this working with cluster of servers.
    Will be appreciated if you could explain in detail about the pros and cons for single server with the two parameters defined properly
    and the pros and cons for cluster of servers
    Thanks,
    n
  8. caching[ Go to top ]

    In the case of Entity beans we use isModified to check whether the data is changed.How do we do in case of Session beans?