Two JSPs using JavaBeans

Hi,
I have a JSPs and JavaBeans question.
There are two JSP files. One.jsp and Two.jsp.
One.jsp include code that use the JavaBeans from Two.jsp:
<%
     if (bl.getDmlOperation() == NcepConstants.UPDATE) {
Two.jsp have:
<jsp:useBean      id="bl"     class="TestsPrivateBean" scope="session"/>
<%@ include file="One.jsp" %>
When I run this code in TOMCAT, it can run in runtime with no problem.
But the company it now moving to use an IDE (Oracle JDeveloper 9i) with require me to build this into one project. When I try to build the project, it shows error in One.jsp as "variable bl not found in class_One".
When I put the <jsp:useBean      id="bl"     class="TestsPrivateBean" scope="session"/> code into Two.jsp, it shows "duplicate found error".
How should I do to fix this?
Thanks
Kenny

It sounds like it's compiling One.jsp independant of Two.jsp, which will cause the first error. Try renaming One.jsp to One.inc or something. That way it doesn't try compiling One.jsp at all (it won't be there).

Similar Messages

  • The deployment problem in JSP using JavaBean

    Hi there,
    I followed the descriptions in Writing Enterprise Applications with
    Java 2 SDK, Enterprise Edition tutorial to build a set of programs to run JSP with JavaBean, and I also followed the steps in creating new WAR file, but some how it wouldn't work after I deployed them. I run the JSP in IE and got a message like this:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 20 in the jsp file: /1bonus.jsp
    Generated servlet error:
    c:\j2sdkee1.3.1\repository\orbit\web\JSPRoot\$1bonus$jsp.java:63: Class org.apache.jsp.JBonusBean not found.
    JBonusBean jbonus = null;
    ^
    I used the deploytool to create the WAR file, and after I added the 1bonus.jsp, I also added JBonusBean into the WAR file. I found 1bonus.jsp was added into the WAR file, but there's no JBonusBean appeared under the WAR file.
    Could you please tell me is there anything wrong?
    Thanks for your time.
    Regards,
    Eric

    I think you have not imported 'BonusBean' in your jsp. Code this line in your jsp at the top.
    <%@page import="BonusBean" %>
    Sudha

  • JSP using JavaBeans

    Hello
    Does anyone know of any examples i can look at for using JSP's with JavaBeans.
    Thanks
    Jazci

    Look here:
    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/JSPBeans.html#62069

  • Communication between two Jsps using Javascript

    I m new to use Javascript.
    I will really aprreciate if someone take some time and clarify my doubt.
    Here is the situation
    There is a 'Browse' hyperlink on the Parent.jsp. As soon as, i click the link, a new jsp Child.jsp is opening with the values coming from the backend. As the user selects some values in the Child jsp and say 'Add', the values should be transfered and displayed ( can be done by creating dyanamic 'divs')to the Parent jsp. Here is the tricky one. The Parent.jsp should not refreshed.
    I tried so hard to achive this, but failed miserably.
    (Creation of dynamic divs is just a way to achive this)
    Can you please help me out in this? Is there any other way, this requirement can be achived?
    Advance thanks

    Hope this would help
    http://digital.ni.com/public.nsf/allkb/B937AC4D8664E37886257206000551CB
    Parallel port acess VIs will be in found in the following path.
    C:\Program Files\National Instruments\LabVIEW xxxx\examples\portaccess\parallel port examples.llb
    However,the above VIs doesn't support Windows Vista & Later.

  • How to run jsp using javabean class in tomcat

    hello all,
    i have bean class placed in classes folder of tomcat and placed jsp and html in root directory. i am not able to run it , if i have do any setting in web.xml, pls let me know from u

    No XML required, but you must put the class into a package.
    Packages are folders with some files that identify whats in them, so you will end up with something like
    yourWebbApp/classes/yourPackage/yourClass

  • Using javabean problem

    Hi all,
    I need to call function in java program in jsp , i use it as javabean but i found one function does not work, I think it may be because that functions related to the other class, though i have put them inside the right folder. what i would like to know is can the function be called in jsp using javabean if the function involve other class? thanks!!

    Hi You can call that function using
    <jsp:useBean id="beanInstanceName" class="package.class"/>
    <jsp:setProperty name="beanInstanceName" property="*"/> // for setting the all attribute os the javabean class.
    for gettiing the function of getting the value of attribute.
    <jsp:getProperty name="beanInstanceName" property="propertyName"/>
    or
    call with the
    <jsp:useBean id="beanInstanceName" class="package.class"/>
    <%=beanInstanceName.getMthodName%> within ur Jsp.
    Try this.
    Thanks
    Vivek

  • Using JavaBeans in a JSP Page

    I wan't to know the advantages and disadvantages of using JavaBeans in a JSP page.
    Like for example general traditional approach for a database connection
    is to create a connection and access the database from that and close the connection
    at the end of the page, instead of the If I use a common connection bean for making connections,
    is that suggestable and then when should i close the connection then.
    One good application of JavaBeans is using a Set and Get methods for form fields in
    a registration form to get back the values.
    So may i know how best can we use the JavaBeans other than this application.
    ThanX in advance,
    kiran
    [email protected]

    I believe putting processing and query code in the JavaBean was one of the reasons for putting JavaBeans support in JSP in the first place. The original idea was to use the setXXX methods to populate the bean's data from the posted form, then do the processing (or database query), then use the getXXX methods to display the bean's data.
    Efficiency-wise, it's exactly the same as putting all the code in-line in the JSP page (actually, it might be a bit slower, because of the reflection required to do it.) Code-wise though, it makes the JSP easier to read.
    Of course, we have EJBs now too, which tie very closely and can match database queries almost one-to-one, one way to incorporate these is inside the JavaBean you reference from the JSP, another way from a servlet you redirect the JSP to, etc...

  • Hi can anyone explain me how to  syncronize two database using jsp?

    Hi can anyone explain me how to syncronize two database using jsp?

    I thinking than you really need the jsp page for calling the java methods whith sincronize the database.You think wrong.
    You wrote a bad question.What was bad about it?
    You need a java method for sincronize the two databases using a jsp page.No you don't, see my answer.

  • How to pass parameter between two jsp pages using web link (not form)

    Hi Friends,
    I have two jsp pages and would like to pass a parameter from one JSP page (one.jsp) to another JPS page (two.jsp)
    in one.jsp
    <a href="two.jsp?ant="<%=ant%">"> <%=antName%> </a><br>
    I don't know how to pass value of parameter "ant" to two.jsp from one.jsp.
    Can anyone help this? Thank you in advance</a>

    Looks like you've got it almost right - just an extra unneeded "
    <a href="two.jsp"?ant=<%= ant %>"><%=antName%></a>
    which should render on the page as something like
    My Ant Task
    When you click the link, it should pass that parameter, and you can get it via request.getParameter().

  • Urgent!!!!!How can i use javamail in jsp without using javabeans

    hello friend
    I m making a forum in which i want to send response to the user through mail I m not using javabean Can anyone help me.How to use javamail in jsp

    http://java.sun.com/developer/onlineTraining/JavaMail/exercises.html

  • Use JavaBean in Tomcat4.0

    Hi all!!!!
    I wanna use JavaBeans in my JSP page, but I dont know how to locate my beans.
    I put my jsp-page in the ..\webapps\ROOT\, and I try to put my beans in the \webapps\ROOT\WEB-INF\classes\.But I got the following message...
    org.apache.jasper.JasperException: Unable to compile class for JSPerror: File E:\tomcat\webapps\ROOT\WEB-INF\classes\user\Select.class does not contain type user.Select as expected, but type Select. Please remove the file, or make sure it appears in the correct subdirectory of the class path.
    Plz help me....thanx alot!!!!!!

    For this example the web root is at c:\web, and the bean class file is SimpleBean.java and the package name is FoobarPackage.
    Step one, put your java file/s into the package. At the top of your java file put "package FoobarPackage;"
    Step two, put all your java files at c:\web\WEB-INF\classes\FoobarPackage\
    Step three, compile.
    Step four, restart tomcat.
    Step five, make a jsp page and place it at c:\web. In your jsp page to load the bean you place the following in your page.
    <jsp:useBean id="TheBean" scope="whatever you want" class="FoobarPackage.SimpleBean" />
    Step six, create a context mapping in your tomcat config file to c:\web to host your files.
    Step seven, load the page in your browser.
    -S-

  • Question : JSP use EJB

    I write a stateful Session Bean,and I want to use the same instance of this Stateful Session Bean in two JSP file(in a session). How can I do with it?
    I try to use the same JavaBean in two JSP page,and through this javaBean invoke the EJB instance,it can work. But is it a good method?

    You can pass to the second JSP page in the same session using the object HttpSession the Stateful Session Bean instance.
    e.g.
    FirstJSPPage
    HttpSession mySession = request.getSession();
    mySession.put("mySessionBean",mySessionBean);
    SecondJSPPage
    HttpSession mySession = request.getSession(false);
    MySessionBean mySessionBean =
    (MySessionBean)mySession.get("mySessionBean");

  • Getting error while passing implicit request object from JSP to JavaBean

    Hi,
    I am getting error while passing implicit object ie( request object)
    from within JSP to JavaBean.
    Following is source for JSP, JavaBean and Error message I am getting.
    vaLookup.jsp Source
    <jsp:useBean id="db" class="advisorinsight.javabeans.DisplayPages"
    scope="request">
    <jsp:setProperty name="db" property="request" value="<%= request %>"
    />
    </jsp:useBean>
    <jsp:getProperty name="db" property="totalrecords" />
    JAVABEAN DisplayPages.java source
    package javabeans;
    import java.io.Serializable;
    import javax.servlet.http.HttpServletRequest;
    public final class DisplayPages implements Serializable {
    private String totalrecords;
    private HttpServletRequest request;
    public void setRequest(HttpServletRequest req){
    this.request = req;
    public java.lang.String getTotalrecords()
    this.totalrecords =
    this.request.getParameter("totalrecords");
    return this.totalrecords;
    public DisplayPages(){
    totalrecords = "";
    request = null;
    error after executing vaLookup.jsp
    [30/Nov/2001 11:56:04:5] info: EXTMGR-006: GXExtensionManager: Extension
    service JavaExtData successfully loaded
    [30/Nov/2001 11:56:04:5] info: EXTMGR-006: GXExtensionManager: Extension
    service LockManager successfully loaded
    [30/Nov/2001 11:56:04:5] info: EXTMGR-006: GXExtensionManager: Extension
    service RLOPManager successfully loaded
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:5] info: REQ-012: thread add
    [30/Nov/2001 11:56:04:7] info: ENGINE-ready: ready: 10819
    [30/Nov/2001 11:56:46:0] info: --------------------------------------
    [30/Nov/2001 11:56:46:0] info: JSPRunnerSticky: init
    [30/Nov/2001 11:56:46:0] info: --------------------------------------
    [30/Nov/2001 11:56:51:7] error: Exception: SERVLET-compile_failed:
    Failed in compiling template: /va/valookup.jsp, javac error:
    c:\iplanet\ias6\ias\APPS\variabl
    S\va\valookup.java:76: Undefined variable: JSP_8
    db.setRequest(_JSP__8);
    ^
    1 error
    Exception Stack Trace:
    java.lang.Exception: javac error:
    c:\iplanet\ias6\ias\APPS\variableannuity\va\WEB-INF\compiled_jsp\jsp\APPS\va\valookup.java:76:
    Undefined variable: JSP_8
    db.setRequest(_JSP__8);
    ^
    1 error
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileJSP(Unknown Source)
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileOrLoadJSP(Unknown
    Source)
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown
    Source)
    at
    com.netscape.server.servlet.jsp.JSPCompiler.compileInstance(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callJspCompiler(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUri(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformHttpServletResponse.callUriRestrictOutput(Unknown
    Source)
    at
    com.netscape.server.servlet.platformhttp.PlatformRequestDispatcher.forward(Unknown
    Source)
    at com.netscape.server.servlet.jsp.JSPRunner.service(Unknown
    Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
    Source)
    at
    com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
    Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.applogic.AppLogic.execute(Unknown Source)
    at com.kivasoft.thread.ThreadBasic.run(Native Method)
    at java.lang.Thread.run(Thread.java:479)

    The only thing that I see that looks funny to me is when you pass the request object into the method using <%=request%>, Im not sure whats going to happen here because that is suppose to print the results. Have you tried simply using <%request%>?

  • How to display the data in XML files into JSP using Jdeveloper.

    Hi All,
    I have two XML files one XML file has the view names and the other has the table names of a particular views, how to display the data in JSP using JDeveloper where when i click a particular view the list of tables of that particular view from XML file two should be displayed in JSP Page.
    Are there any reference documents, regarding the above process please can anyone guide through how to do it.

    Let the servlet ask your business tier to provide the data, then stuff it into beans, and pack those into the Session instance. Then forward the request to the JSP, let the JSP get those beans and display them.

  • 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());

Maybe you are looking for