Hi,

I am having a JSP page which will call a servlet if it finds the data in the
bean has not been set.  I have attached the jsp file,bean and servlet file
for ur reference and ofcourse the error too which i am getting while i am
trying to access the jsp page.


JSP PAGE
-----------
<jsp:useBean id="jsptesting" class="JspTestBean" scope="session" />
<jsp:setProperty name="jsptesting" property="*" />

<html>
<head>
<title>This is a jsp test</title></head>
<body>
        <%if ( jsptest.getData().length() == 0 ) {%>
                response.write("forwarding...");
                <jsp:forward page="/jsptest" />
        <%}%>
</body>
</html>


Servlet
-----------
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class JspTestServlet extends HttpServlet
{
        public void doPost(HttpServletResponse res, HttpServletRequest req)
throws ServletException, IOException{
                PrintWriter out = res.getWriter();
                //DBQUery and set the bean file.
        }

}

Bean File
-----------
public class JspTestBean
{

        public void setData(String[] strparmData){
                praws_Data = strparmData;
        }

        public String[] getData(){
                return praws_Data;
        }

        //Variables
        private String[] praws_Data;
}

ERROR PAGE
-----------
Class Not Found "jsptesting".

I am using JWS2.0 anyone please guide where to place the jsp page and the
servlet.  Apparently i am newbie to this JSP and also correct me if my JSP
logic is wrong.  All i need to do is that dynamically build my combobox with
some values from the html.

Thanks a million for ur help,
Srini
-----Original Message-----
From: Amos Shapira [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 21, 2000 3:54 PM
To: [EMAIL PROTECTED]
Subject: RE: JSP-Servlet-DB


There are at least two places where I can think of doing that:

1. Since the pool is conceptually a singleton (one instance for
the entire application) then it may make sense to have a static
reference to it from DBHandle.

2. Another option might be to keep a reference in the application
level (via ServletContext.setAttribute()/ServletContext.getAttribute())

Make sure that the pool is indeed initialized before it is used for
the first time, either automatically configure upon first access or
maybe via an init() method of one of the servlets which is configured
to "load on startup".

Hope this helps,

--Amos Shapira
WebCollage

> -----Original Message-----
> From: Srini Sathya. [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 21, 2000 2:41 PM
> To: [EMAIL PROTECTED]
> Subject: JSP-Servlet-DB
>
>
> Hi,
>
> We are designing our application as follows:
>
> JSP -> Servlet [to retrieve the form data] -> DBHandle [For hadling
> dbrequest ].
>
> Once the user submits the form it will call a servlet which
> will have all
> the form data.  My problem is that i need to maintain a CP
> and to give one
> connection for each and every request to the DBHandle which
> will update the
> database.  If my servlet is going to be only one then i would
> have my CP
> initialized at the init() and can manipulate my poool, since
> i have lot of
> servlets (one for adding user, one for adding a group etc.,)
> i am confused
> where to create the pool.  I fear if i create the pool in the
> DBHandle class
> then since each and every servlet is going to create a
> instance of DBHandle
> there would be lot of connections, is that correct??.  If
> this is a bad
> design where would be the best place to instantiante my CP
> and to create
> pool.
>
> Thanks for ur help,
> Srini
>
> -----Original Message-----
> From: Khurram Saqlain [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 21, 2000 1:53 AM
> To: [EMAIL PROTECTED]
> Subject: application design
>
>
> I'm designing our application which looks like:
>
> JSP/HTML          (presentation layer)
> -----------
> Servlets          (Application layer)
> ----------
> EJB               (DB Layer)
>
>
> My question, how should I pass data retrieved from the database
> as a EJB to the JSP layer? I could pass the EJB to the presentation
> layer but is there a another alternative?
>
> Is passing an EJB to the presentation layer a good approach
> when the result set contains a large number of rows?
>
> TIA,
> Khurram
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ______________________________________________________________
> _____________
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
> http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to