Sharing a bean btwn two JSP's

Hi all
I have a bean that I want to use in two JSP's. When I use it the first time it works fine but for the second JSP it returns a NullPointerException. I have my scope as "application".
In my JSP I am calling the bean as such:
<jsp:useBean id="abc" scope="application" class="ABC" />
<%
ABC bean = (ABC)session.getAttribute("abc");
%>
Please assist me with this.
Thanx

I thought <jsp:useBean id="abc" scope="session" class="ABC" />and<%
ABC abc = (ABC)session.getAttribute("abc");
%>do the same thing...!!!!! Am I wrong..?
Getting back to the problem. One reason, I can think about, causing a NullPointerException may be because the session attribute is not set previously. Do you have piece of code somewhere in the servlet or before which sets the attribute in the session.?
Some thing like session.setAttribute("abc", new ABC());

Similar Messages

  • Sharing a bean information through jsp pages

    Morning,
    I want to use a java bean in two jsp pages, so is it possible to share it (to set its properties in the 1st page and retrieve them in the 2nd)?
    If not, what should I do? Could I use forward and set param?
    Here is my 1st jsp
    ==================
    <%@page language="java" %>
    <jsp:useBean id="doctorConn" scope="session" class="beans.DoctorBean" >
         <jsp:setProperty name="doctorConn" property="*" />
    </jsp:useBean>
    <%
    if(doctorConn.getUserId().equals("") ||doctorConn.getPassword().equals(""))
         response.sendRedirect("notAuthorised.jsp");
    System.out.println("user id : " + doctorConn.getUserId()+ " password : " +doctorConn.getPassword());
    if(doctorConn.isAuthorised(doctorConn.getUserId(), doctorConn.getPassword())) {
    %>
         <jsp:forward page="doctorApp.jsp" />
    <%
    else response.sendRedirect("notAuthorised.jsp");
    %>
    ==================
    my second
    =================
    <%@page language="java" %>
    <%@page import ="java.sql.*" %>
    <%@page import ="java.lang.Exception"%>
    <jsp:useBean id="doctorConn" scope="session" class="beans.DoctorBean" />
    <jsp:useBean id="appointment" scope="session" class="beans.Appointment" >
         <jsp:setProperty name="appointment" property="*" />
    </jsp:useBean>
    ...etc
    ===========================
    I am using Tomcat 4 and in the 2nd page I am getting an error about doctorConn
    Thank you,

    Yes ofcorse. You can do it in many ways.
    Firstly, declare properties of your bean as static that you want to share between pages and create new instance of bean on each page.
    Secondly you can store the same instance of the bean in you session. On th other page, you can retrive same instance of the bean whenever needed.
    Otherwise, you can create a gateway class that maitain static reference of you bean class.

  • Two managed beans in same jsp page

    Hello
    First this could be a stupid question, but i just can't find a solutions on this problem.
    I wondering that could it be a two managed beans in same jsp page, here is a example:
    index.jsp
    <t:commandLink disabled="#{listBean.currentPage == 1}" id="previous2" type="button" immediate="true" style="font-size:small" action="#{listBean.previousPage}">
    <h:outputText value="Edellinen" id="prev"/>
    </t:commandLink>
    <t:commandLink disabled="#{listBean.currentPage == listBean.totalPages}" id="next2" type="button" immediate="true" style="font-size:small;" action="#{listBean.nextPage}">
    <h:outputText value="Seuraava" id="next"/>
    </t:commandLink>
    then i have a dataTable like this:
    <t:dataTable value="#{customerListBean.customerBeans}"
    binding="#{customerListBean.dataTable}" preserveDataModel="true" style="text-align:left">
    My problem is that when i push a commandLink it doesn't refresh a dataTable. Does anyone know a solution here or is this just a impossible way to do it?
    Thanks for help.

    when i push nextPage (commandLink) it's call action
    and count a new range of dataset and after that it's
    calls a method which is declared on subClass and that
    method get a new data of database on given params.
    and put it on DataTable.
    So listBean is upper class and customerListBean
    extends on ListBeanNo, it doesn't work that way as you expected. You have created two independent instances. They doesn't communicate automatically with each other or so. Just use one CustomerListBean instance and call the inherited methods of ListBean on the #{customerListBean} managed bean instance.

  • Stateful Session Bean accesed by two JSPs.

    Hi there,
    We are having quite an issue; we have an application that stores session
    state in an stateful session bean. And we have noticed some parts of the
    application create a situation where is possible that two frames -and so two
    jsp- access the session bean at the same time. And, of course, it´s going to
    be the same instance of the session bean..... what will be the behaviour in
    this case?. Will the requests be serialized, an exception will be thrown or
    the EJB will be destroyed?. Not very sure of what would happen. I suppose
    there could be some problems with this-. I would appreciate any help.
    Many thanks. Best regards.

    Hrm. EJB spec is quite clear on what will happen (RemoteException thrown) if
    the second client attempts to use Stateful Session bean which is already in
    use (and the bean will not be destroyed - container will simply throw an
    exception after failing to acquire a lock on the bean instance without waiting
    (allow-concurrent-calls option in WebLogic allows client call to wait to acquire
    lock - this was probably added as a convinience feature for applications which
    use frames)).
    So, normally your application has to ensure that no 2 clients are able to use
    the same stateful session bean concurrently, or use allow-concurrent-calls option,
    which will do that for you, but the application will become non portable.
    Dimitri
    PS: Thanks. Maine Coon cats are the best. Ours is a 22-pound giant ;-)
    Pinklon Thomas <[email protected]> wrote:
    Hi Dimitri,
    Thnaks a lot for the help:one thing that I do not know if it´s an issue is
    that calls come from different JSPs; the strategy I have seen in another Web
    application servers is trying to activate the EJB in the middle of another
    transaction... In this situation, the container cannot activate the EJB,
    roolback the transaction and destroys the EJB.... Would Weblogic feature
    avoid this?. I will investigate on my part....
    Many many thnaks. Nice cats.
    "Dimitri Rakitine" <[email protected]> wrote in message
    news:[email protected]...
    In 6.1 you can set allow-concurrent-calls to true in this situation:
    <!--
    The allow-concurrent-calls specifies whether a stateful session bean
    instance will allow concurrent method calls. The value of this
    element may be either "True" or "False". The default value is
    "False". When a stateful session bean instance is currently in a
    method call and another (concurrent) method call arrives on the
    server, the EJB specification requires that the server throw a
    RemoteException. By default, allow-concurrent-calls is false, and the
    EJB container will follow the EJB specification. When this value is
    set to true, the EJB container will block the concurrent method call
    and allow it to proceed when the previous call has completed.
    Used in: stateful-session-descriptor
    -->
    Pinklon Thomas <[email protected]> wrote:
    Hi there,
    We are having quite an issue; we have an application that stores
    session
    state in an stateful session bean. And we have noticed some parts of the
    application create a situation where is possible that two frames -and sotwo
    jsp- access the session bean at the same time. And, of course, it´sgoing to
    be the same instance of the session bean..... what will be the behaviourin
    this case?. Will the requests be serialized, an exception will be thrownor
    the EJB will be destroyed?. Not very sure of what would happen. Isuppose
    there could be some problems with this-. I would appreciate any help.
    Many thanks. Best regards.--
    Dimitri

  • Using two beans in a jsp

    what's the syntax for declaring two different beans in a JSP ?
    can we have two <jsp:useBean...> tags ??
    <jsp:useBean id="view" type="org.ab.GenericView" scope="request"></jsp:useBean>

    You can have include many <jsp:useBean> tags. Use different id/scope combinations.
    e.g.
    <jsp:useBean id="view" type="org.ab.GenericView" scope="request"></jsp:useBean>
    <jsp:useBean id="anotherview" type="some class" scope="request"></jsp:useBean>
    <jsp:useBean id="thirdid" type="some class" scope="session"></jsp:useBean>

  • "Sharing" a stateful session bean between two servlets, beans

    Hello!
    I just started to learn some java ee programming and was wondering how i would share one stateful session bean between two servlets.
    I created the bean with @Stateful.
    I tried to inject the stateful bean in both servlets by @EJB and i can manipulate the object, but each servlet seems to have its own object.
    The bean has a remote interface that it implements.
    What i also tried was to add the mappedName to the @Stateful expression. Something like: @Stateful(mappedName="name") and to use the bean by @EJB(mappedName="name") but it had no effect.
    Im using glassfish 2.1 with netbeans 6.7.1 as my environment (standard settings)
    dummy question, but i googled like hours and couldnt find anything : \
    hope someone can help and sorry for my bad english
    greets and thanks

    Hi there!
    I think you are searching for something like an application wide singleton. There is the possibility to define such one in the Glassfish admin console.
    Hope this helps!

  • Sharing data between a bean and a jsp

    I have a bean that is being used as a helper class for a jsp page. I can call functions in the bean and display what is returned but I can't test the state of the bean in the jsp page. Is this possible?
    my code is below:
    jsp: a form posts info to this page
    <HTML>
    <BODY>
    <jsp:useBean id='portal' class='portal.portal'/>
    <%-- set the username and password --%>
    <jsp:setProperty name="portal" property="*" />
    <jsp:getProperty name="portal" property="dbconnection"/>
    <Center>
    <H1>Welcome to the Portal
    <jsp:getProperty name="portal" property="firstName"/>
    </H1>
    <br>
    <table border="0">
    <%-- while loop grabs all the services --%>
    <%-- case tests for special services (links) --%>
    <%
    String url = "";
    int ServiceID = 0;
    //I CAN'T PULL THE VALUES FOR THESE VARIABLES SO THE WHOLE WHILE LOOP IS SKIPPED!
    while (url.length() != 0)
    switch (ServiceID)
    case 69:
    %>
    <tr valign="top" height="45">
    <td>
    <center>
    " TARGET="new_window"><IMG SRC="images\MEDS TAPE LOG.gif" BORDER=white></A><br>
    </center>
    </td>
    </tr>
    <%
    break;
    case 41:
    %>
    <tr valign="top" height="45">
    <td>
    <center>
    <A HREF="<jsp:getProperty name="portal" property="url"/>" TARGET="new_window"><IMG SRC="images\Lan Support Website.gif" BORDER=white></A><br>
    </center>
    </td>
    </tr>
    <%
    break;
    case 1:
    %>
    <tr valign="top">
    <td>
    <center>
    <form name="loginfrm" action="http://204.104.185.139/pls/WLOG/login.ValidateUser" method="post" target=_parent>
    <INPUT TYPE=hidden NAME=TXTUSERNAME VALUE="<jsp:getProperty name="portal" property="name"/>">
    <INPUT TYPE=hidden NAME="TXTPASSWORD" VALUE="<jsp:getProperty name="portal" property="password"/>">
    <input TYPE="submit" VALUE="<jsp:getProperty name="portal" property="serviceName"/>" style="width: 120px;" >
    <input type="reset" name="reset" value="">
    </Form>
    </center>
    </td>
    </tr>
    <%
    break;
    default:
    %>
    <tr valign="top">
    <td>
    <center>
    <Form method='post' action='<jsp:getProperty name="portal" property="url"/>' name='loginfrm'>
    <INPUT TYPE=hidden NAME="TXTPASSWORD" VALUE="<jsp:getProperty name="portal" property="password"/>">
    <INPUT TYPE=hidden NAME="TXTUSERNAME" VALUE="<jsp:getProperty name="portal" property="name"/>">
    <INPUT TYPE=hidden NAME="firstname" VALUE="<jsp:getProperty name="portal" property="firstName"/>">
    <INPUT TYPE=hidden NAME="lastname" VALUE="<jsp:getProperty name="portal" property="lastName"/>">
    <INPUT TYPE=hidden NAME="id" VALUE="<jsp:getProperty name="portal" property="userID"/>">
    <INPUT TYPE=hidden NAME="role" VALUE="<jsp:getProperty name="portal" property="roleID"/>">
    <input type='submit' name='submit' value='<jsp:getProperty name="portal" property="serviceName"/>'>
    </Form>
    </center>
    </td>
    </tr>
    <%
    break;
    %>
    <jsp:getProperty name="portal" property="nextForm"/>
    <%
    %>
    </table>
    </Center>
    </Body>
    </Html>
    here is the bean:
    //bean for portal
    package portal;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.util.Enumeration;
    import java.sql.*;
    import java.util.*;
    public class portal {
    private ResultSet userInfo;
    private Statement stmt;
    private String pw;//password from the database
    private String FirstName;
    private String LastName;
    private String UserName=""; //network login name
    private String UserPassword="";//password supplied by the form
    private int UserID; // temp variable while pulling the services from the databases
    private int RoleID; // temp variable while pulling the services from the databases
    private String ServiceName=""; //temp variable while pulling the services from the database
    private int ServiceID;
    private String url ="";
    //String Message=""; //testing
    private String Message2=""; //string that sends the correct html back to the jsp
    public int getServiceID(){
    return ServiceID;
    public void setName(String Name){
    UserName = Name;
    public String getName(){
    return UserName;
    public void setPassword(String Password){
    UserPassword = Password;
    public String getPassword(){
    return UserPassword;
    public String getFirstName(){
    return FirstName;
    public String getLastName(){
    return LastName;
    public String getUrl(){
    return url;
    public int getUserID(){
    return UserID;
    public int getRoleID(){
    return RoleID;
    public String getServiceName(){
    return ServiceName;
    public String getDbconnection() {
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    DriverManager.setLoginTimeout(60);//time out after 1 min.
    Connection con = DriverManager.getConnection("jdbc:odbc:Portal");
    stmt = con.createStatement();
    String query = "SELECT EMP_TABLE.EMP_PASS, MGR_SERVICES.SERVICE_ID,";
    query = query +" MGR_SERVICES.DEFAULT_URL, EMP_TABLE.EMP_USER_ID, *";
    query = query +"FROM (EMP_TABLE LEFT JOIN MGR_USER_SERVICES ON";
    query = query +" EMP_TABLE.EMP_USER_ID = MGR_USER_SERVICES.USER_ID)";
    query = query +" LEFT JOIN MGR_SERVICES ON MGR_USER_SERVICES.SERVICE_ID =";
    query = query +" MGR_SERVICES.SERVICE_ID WHERE (((EMP_TABLE.EMP_LAN_ID)='" + UserName+ "'))";
    //String query = "SELECT EMP_TABLE.EMP_PASS, MGR_SERVICES.SERVICE_ID,";
    //query = query +" MGR_SERVICES.DEFAULT_URL, EMP_TABLE.EMP_USER_ID, *";
    //query = query +"FROM (EMP_TABLE LEFT JOIN MGR_USER_SERVICES ON";
    //query = query +" EMP_TABLE.EMP_USER_ID = MGR_USER_SERVICES.USER_ID)";
    //query = query +" LEFT JOIN MGR_SERVICES ON MGR_USER_SERVICES.SERVICE_ID =";
    //query = query +" MGR_SERVICES.SERVICE_ID WHERE (((EMP_TABLE.EMP_LAN_ID)='landwla'))";
    //String query = "SELECT * FROM EMP_TABLE WHERE EMP_LAN_ID ='landwla'";
    userInfo = stmt.executeQuery(query);
    if(userInfo.next())
    pw = userInfo.getString("EMP_PASS");
    if (UserPassword.equals(pw))
    //Message = "Your logged in";
    //Message = Message + "Luke you sly devil";
    FirstName = userInfo.getString("EMP_FIRST");
    LastName = userInfo.getString("EMP_LAST");
    UserID = userInfo.getInt("EMP_USER_ID");
    RoleID = userInfo.getInt("ROLE_ID");
    url=userInfo.getString("DEFAULT_URL");
    ServiceName = userInfo.getString("SERVICE_NAME");
    ServiceID = userInfo.getInt("Service_ID");
    else
    Message2 = "<Script Language=JavaScript>";
    Message2 = Message2 + "alert('Your Password Information is incorrect');";
    Message2 = Message2 + "window.location.href = 'Login.html'";
    Message2 = Message2 + "</Script>";
    else
    Message2 = "<Script Language=JavaScript>";
    Message2 = Message2 + "alert('Your Login Information is incorrect');";
    Message2 = Message2 + "window.location.href = 'Login.html'";
    Message2 = Message2 + "</Script>";
    catch (InstantiationException i)
    {return (i.toString());}
    catch (ClassNotFoundException c)
    {return (c.toString());}
    catch (SQLException sql)
    {return (sql.toString());}
    catch (Exception e)
    {return (e.toString());}
    return Message2;
    public String getNextForm() {
    try
    url="";
    ServiceName="";
    if(userInfo.next())
    url=userInfo.getString("DEFAULT_URL");
    ServiceName = userInfo.getString("SERVICE_NAME");
    RoleID = userInfo.getInt("ROLE_ID");
    ServiceID = userInfo.getInt("Service_ID");
    catch (SQLException sql)
    {return (sql.toString());}
    return Message2;

    Of course you can.
    <%
    String url = protal.getUrl();
    %>

  • How to limit sharing apps to only two devices? because i have an iPod touch and an iPad. i just want to limit the sharing of apps to those two.

    how to limit sharing apps to only two devices? because i have an iPod touch and an iPad. i just want to limit the sharing of apps to those two. because my brother is using my apple id too on his ipod. i want to limit it to mine only. tnx!

    You can go into settings and turn sharing off in the programs on the device you don't want to share too.

  • How to use a SAME form between two JSP ?

    Hi,
    I have a JSP called jsp1 that use a form called form1.
    I use the next line in jsp1 to tell this :
    <jsp:useBean id="form1" class="Form" scope="request"/>
    In struts-config :
    <form-beans>
    <form-bean name="form1" type="Form"/>
    </form-beans>
    <action path="/jsp" type="Action" name="Form" scope="request">
    <forward name="success" path="jsp2.jsp"/>
    </action>
    In the action linked to this form, I populate my form.
    Next, I would like, in the second JSP jsp2, to USE THE SAME FORM form1, so that I can use some datas I have inserted in it after I have called the action of jsp1.
    I hope you will understand my BAD english :)
    HELP ME PLEASE, it is very urgent !

    Maybe it is not very clear... I am going to explain it in another way :
    I have one form that I use in JSP (init.jsp) thanks to this line :
    <jsp:useBean id=3D"Form" class=3D"com.form.MyForm" scope=3D"request"/>
    In my struts-config.xml :
    <action path=3D"/fastsearch"
         type=3D"com.action.MyAction"
         name=3D"Form"
         scope=3D"request">
         <forward name=3D"success" path=3D"success.jsp"/>
    </action>
    Thanks to MyAction, I populate the fields of my form. I can access to =
    this fields in success.jsp.
    Here the perform method of MyAction :=20
    public ActionForward perform(ActionMapping mapping,
                        ActionForm form,
                             HttpServletRequest req,
                             HttpServletResponse res) {
         (MyForm)form.populate();=09
         req.setAttribute("TempForm", ((MyForm)form));
         return mapping.findForward("success");
    Now, I would like that when I click on a link in success.jsp to go to =
    another JSP page (last.jsp), I can access to my populated form !=20
    At this moment, I have=20
    <jsp:useBean id=3D"TempForm" class=3D"com.form.MyForm" =
    scope=3D"request"/> at the beginning of last.jsp, but it does not =
    work...
    I hope you understand what I want to say ;)

  • Hello, I have two questions on time capsule  I can only have it on my external hd files and free up my internal memory to my mac  I can use an external hard drive, in my case a lacie rugged as shared memory for my two computers

    Hello, I have two questions on time capsule  I can only have it on my external hd files and free up my internal memory to my mac  I can use an external hard drive, in my case a lacie rugged as shared memory for my two computers

    I have a mackbook pro and an iMac if I buy a time capsule 2tb airport, I can use it with time machine and what would be the best way to use it.
    There is no particular setup required for TM.. both computers will create their own backup sparsebundle which is like a virtual disk.. Pondini explains the whole thing if you read the reference I gave you.
    and how to use time capsule airport whit other external hd to use my old lacie airport with the new time capsule
    Up to you.. you can plug the external drive into the TC and enjoy really slow file transfers or you can plug it into your computer and use it as external drive.. which is faster than the TC.. and TM can include it in the backup.
    Again everything is explained in the reference.. you are not reading it.

  • Database access by Bean, error in JSP(view)

    Hello,
    I have a web application. All my database connection logic, execution of query is done in my bean. I have verified that the code in my bean is fine and so I have not posted that code.
    My jsp code is as follows:
    <%@ page import="java.util.*" %>
    <%@ page import="java.sql.*" %>
    <html>
    <head><title>Trial JSP Page</title>
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-STORE">
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="PRIVATE">
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    </head>
    <jsp:useBean id="data" class="com.bean.samples.ConnectionBean"/>
    <jsp:setProperty name="data" property="drivername" value="oracle.jdbc.driver.OracleDriver"/>
    <jsp:setProperty name="data" property="url" value="jdbc:oracle:thin:@someurl"/>
    <jsp:setProperty name="data" property="username" value="name"/>
    <jsp:setProperty name="data" property="password" value="passwd"/>
    <jsp:setProperty name="data" property="query" value="SELECT * FROM tablename"/>
    <%
    data.processQuery();
    ResultSet rs = data.getRs();
    ResultSetMetaData rsmd = data.getRsmd();
    %>
    <body text="black">
    The table has <jsp:getProperty name="data" property="count"/> columns and <jsp:getProperty name="data" property="rowcnt"/>
    rows in it.
    The first column name is <%= rsmd.getColumnLabel(1) %>.
    The current row is <%= rs.getRow() %>.
    </pre>
    </body>
    </html>
    Output of browser:
    The table has 2 columns and 6 rows in it. The first column name is ITEMNO. The current row is
    Error: 500
    Location: /schedule/jsp/Trial.jsp
    Internal Servlet Error:
    java.lang.IllegalStateException: Response has already been committed
         java.lang.Throwable(java.lang.String)
         java.lang.Exception(java.lang.String)
         java.lang.RuntimeException(java.lang.String)
         java.lang.IllegalStateException(java.lang.String)
         void org.apache.tomcat.core.HttpServletResponseFacade.sendError(int, java.lang.String)
         void org.apache.jasper.runtime.JspServlet.unknownException(javax.servlet.http.HttpServletResponse, java.lang.Throwable)
         void org.apache.jasper.runtime.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void org.apache.tomcat.core.ServletWrapper.handleRequest(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
         void org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
         void org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(org.apache.tomcat.service.TcpConnection, java.lang.Object [])
         void org.apache.tomcat.service.TcpConnectionThread.run()
         void java.lang.Thread.run()
    Error is being thorwn on the statemnt:
    The current row is <%= rs.getRow() %>.
    Can anyone help with this?
    Thanks in advance.

    Hi beattris,
    No I dont close the rs and conn objects.
    The relevant method of my bean is :
    public void processQuery() throws Exception{
         try{
              Class.forName(getDrivername());
              conn = DriverManager.getConnection(getUrl(),getUsername(),getPassword());
              st = conn.createStatement();
              rs = st.executeQuery(getQuery());
              rsmd = rs.getMetaData();
              int columncount = rsmd.getColumnCount();
              int rowcount = 0;
              setCount(columncount);
              while(rs.next()){
                   rowcount++;
              setRowcnt(rowcount);
         }catch(Exception e){
              throw e;
    I did some searching on the internet for this error and found that it is tricky one and so far I havent found a way to correct it.
    The link i went to were:
    http://developer.java.sun.com/developer/Books/ProJSP/Chap19.pdf
    and
    http://archives2.real-time.com/rte-tomcat/2000/Jun/msg02490.html
    Well, I hope I get some answers soon.
    Thanks.

  • BEAN : Bean included in JSP Page

    Hi ,
    I had developed a web-application in that I had included a bean in a JSP code by using the following
    <jsp:useBean id="testbean" scope="session" class="path.test" />
    now the problem is some times when we click on that particular JSP page where this bean is included the screen instead of generating the jsp page it gives a complete path of the bean location as specified in the JSP ( i.e ) "path.test" .
    When I click the refresh button then the page get's loaded properly.
    This issue taken place rarely but it's very important to solve this and it happens in all the JSP pages wherever I had included a bean but only sometimes .
    Why so??? and help me to solve this problem
    Server: Apache � Tomcat 5.0
    thanks in advance

    You are absolutely correct. All your java classes should be in packages.
    I actually think its a java limitation introduced in Java 1.4 - they no longer allow access to the unnamed package.
    For full details check out: http://developer.java.sun.com/developer/bugParade/bugs/4361575.html
    My suggestion: include all your beans in packages. Its not that hard is it?
    Cheers,
    evnafets

  • How to call the form bean value on jsp withthe help of jstl tag

    hi
    all friends
    i am working in struts & i use jstl tag in jsp. i have one problem rise is how to call the form bean value in jsp page by using jstl tag.
    i now how to retrive the value through jsp:logic
    eg. <logic:empty name="userListForm" property="users">
    NO USER FOUND
    </logic:empty>
    see * userListForm mean formbaen name.
    * users means collection object.
    so how can i write above e.g in jstl

    You use the jstl core:if or core:choose combined with the EL:
    <c:if test="${empty users.userListForm}">
    NO USERS FOUND
    </c:if>I suggest you lookup the jsp expression language (EL) using google, it's very powerful.

  • Importing Bean Class to JSP

    Hi here's my bean
    import java.util.*;
    public class leaveChange extends Object implements java.io.Serializable
         String Name;
         String Grade;
         String Pattern;
         int numDays;
         Date startDate;
         Date endDate;
    Now to use this bean in my JSP page what do I do ?
    I tried
    <%@ page import="leaveChange"%>
    but got following error
    [javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\Devannualleave\newDev\advancedOptions_jsp.java:8: '.' expected
    [javac] import leaveChange;
    [javac] ^
    [javac] 1 error
    Thanks in advance

    Update
    changed Bean class to
    package test;
    import java.util.*;
    public class leaveChange extends Object implements java.io.Serializable
         String Name;
         String Grade;
         String Pattern;
         int numDays;
         Date startDate;
         Date endDate;
    JSP File
    <%@ page import="test.leaveChange" %>
    and have in my WEB-INF/classes/test
    my Bean Class
    but get the following error
    [javac] C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\Devannualleave\newDev\advancedOptions_jsp.java:8: package test does not exist
    [javac] import test.leaveChange;
    [javac] ^
    [javac] 1 error
    Any help ?

  • Defining the path for the use of beans in a JSP

              Hello,
              I would like to use a bean in a JSP file, via the <jsp:usebean> directive.
              I didn't find any property (weblogic property) which could define the path
              to the directory of my beans classes.
              So :
              1) i have put the path of this directory in the weblogic classpath in the weblogic
              start script.
              2) i made the same with the java classpath.
              Both solutions don't work at all.
              Any suggestion would be appreciated.
              Thanks in advance.
              

              We use the \weblogic\myserver\serverclasses for beans..
              of course we pack beans into jar files, and these jar files are included into
              the wls classpath..
              "Sylvain R." <[email protected]> wrote:
              >
              >Hello,
              >I would like to use a bean in a JSP file, via the <jsp:usebean> directive.
              >I didn't find any property (weblogic property) which could define the
              >path
              > to the directory of my beans classes.
              >So :
              >1) i have put the path of this directory in the weblogic classpath in
              >the weblogic
              >start script.
              >2) i made the same with the java classpath.
              >
              >Both solutions don't work at all.
              >
              >Any suggestion would be appreciated.
              >Thanks in advance.
              >
              

Maybe you are looking for

  • Problem with Stack

    Hi, I need a stack implementation of an stack. I found some code on http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/10_objs.htm (see chapter Object Type Example: Stack), but I don't know how to handle it. When I try declare   s St

  • Media Card Undetected!

    I accidentally removed the Curve (connected as USB) to the PC. Phone was on and the it can't detect the media card's presence (can't access files 0 music, 0 pics). I tried to reset it (turn off, remove and put card back) and the phone was still havin

  • Converting an MPG video for ipod.. please HELP

    Hello... i'm sorry about my bad english... I tried many times converting videos for ipod, it allways convert them and than they become without the sound... someone can help me with that? Thanks Leo

  • Dynamic PL/SQL code into ODI Procedure

    Hi guys: I have a PL/SQL code to execute into a ODI proc that changes because of a loop. I have to update N tables that have the same prefix and its sufix is the dynamic part of my PL/SQL. Also I have to set the DT_ETL (I already have a variable in m

  • New to Lightroom, problem importing raw CR2 files.

    I am new to Lightroom and am having trouble importing my CR2 raw photo files. In the "import" section I select my SD card that contains the raw image files. All .jpeg files on the card show up as thumbnails but the CR2 files show "preview not availab