Thread: JSP - JBean

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Vienna
    Posts
    3
    Rep Power
    0

    JSP - JBean


    Hi I have following jsp:

    <%@ page contentType="text/html"%>
    <%@ page language="java"%>
    <%@ page import="at.siemens.mma.iap.*"%>
    <html>
    <head>
    <%
    int i = 0;

    String strHeaderTitle = "";
    String s = null,
    sopponent1 = null,
    sopponent2 = null,
    squote1 = null,
    squotex = null,
    squote2 = null,
    smaxquotekey = null,
    smaxbet = null,
    smaxwin = null,
    sstarttime = null;

    if( (sopponent1 = request.getParameter("opponent1")) != ""
    &&(sopponent2 = request.getParameter("opponent2")) != ""
    &&(squote1 = request.getParameter("quote1")) != ""
    &&(squotex = request.getParameter("quotex")) != ""
    &&(squote2 = request.getParameter("quote2")) != ""
    &&(smaxquotekey = request.getParameter("maxquotekey")) != ""
    &&(smaxbet = request.getParameter("maxbet")) != ""
    &&(smaxwin = request.getParameter("maxwin")) != ""
    &&(sstarttime = request.getParameter("starttime")) != "")
    {
    if(sopponent1.length() == 0
    || sopponent2.length() == 0
    || squote1.length() == 0
    || squotex.length() == 0
    || squote2.length() == 0
    || smaxquotekey.length() == 0
    || smaxbet.length() == 0
    || smaxwin.length() == 0
    || sstarttime.length() == 0)
    {
    strHeaderTitle = "Erstellen einer neuen Wette fehlgeschlagen";
    }
    else
    {
    strHeaderTitle = "Wette wurde erfolgreich erstellt";
    }
    }
    %>
    <title><%= strHeaderTitle %></title>
    </head>
    <%@page import="java.io.*"%>
    <body>
    <%
    if(sopponent1.length() == 0
    || sopponent2.length() == 0
    || squote1.length() == 0
    || squotex.length() == 0
    || squote2.length() == 0
    || smaxquotekey.length() == 0
    || smaxbet.length() == 0
    || smaxwin.length() == 0
    || sstarttime.length() == 0)
    {
    %>
    <br>

    <p align="center"> Das erstellen der Wette ist <strong>fehlgeschlagen</strong>!
    <br>
    Bitte überprüfen Sie ihre Eingaben! <br>
    <br>
    Um Ihre Eingabe zu ändern verwenden sie folgenden Button!
    <form method="get" action="create_bet.jsp?opponent1=$opponent1&opponent2=$opponent2&quote1=$quote1&quotex=$quotex&quote 2=$quote2&maxquotekey=$maxquotekey&maxbet=$maxbet&maxwin=$maxwin&starttime=$starttime">
    <div align="center" style="visibility:hidden">
    <input type="text" name="opponent1" value="<%= request.getParameter("opponent1")%>">
    <input type="text" name="opponent2" value="<%= request.getParameter("opponent2")%>">
    <input type="text" name="quote1" value="<%= request.getParameter("quote1")%>">
    <input type="text" name="quotex" value="<%= request.getParameter("quotex")%>">
    <input type="text" name="quote2" value="<%= request.getParameter("quote2")%>">
    <input type="text" name="maxquotekey" value="<%= request.getParameter("maxquotekey")%>">
    <input type="text" name="maxbet" value="<%= request.getParameter("maxbet")%>">
    <input type="text" name="maxwin" value="<%= request.getParameter("maxwin")%>">
    <input type="text" name="starttime" value="<%= request.getParameter("starttime")%>">
    <br>
    </div>
    <div align="center">
    <input type="submit" name="Submit" value="Eingabe ueberarbeiten">
    </div>
    </form>
    <div align="center">
    <%
    }
    else
    { %>
    <jsp:useBean id="CreateBet" class="at.siemens.mma.iap.CreateBetBean" />
    <jsp:setProperty name="CreateBet" property="opponent1" value="1" />
    <%
    CreateBet.DB_SetNewBetInfos();
    %>
    </jsp:useBean>
    <%
    }
    %>
    </div>
    </body>
    </html>



    AND Following JBean:


    /*
    * Created on 30.06.2003
    *
    * To change the template for this generated file go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    */
    package at.siemens.mma.iap;
    public class CreateBetBean {



    public String opponent1;
    public String opponent2;
    public String quote1;
    public String quotex;
    public String quote2;
    public String maxquotekey;
    public String maxbet;
    public String maxwin;
    public String starttime;

    public int DB_SetNewBetInfos(){

    if (opponent1 != "")
    {
    return 1;
    }
    else
    {
    return 0;
    }
    }
    }




    My Problem is now following!

    I Copy my file structure to the deploy directory (C:\jboss-3.2.1_tomcat-4.1.24\server\default\deploy), as war file.

    When i Access to the jsp it is working fine, but with the java bean i get always an error:

    org.apache.jasper.JasperException: Unable to compile class for JSP

    An error occurred at line: -1 in the jsp file: null

    Generated servlet error:
    [javac] Compiling 1 source file
    [javac] C:\jboss-3.2.1_tomcat-4.1.24\server\default\tmp\deploy\server\default\deploy\work\MainEngine\localhost\Betting\web\check_c reate_bet_jsp.java:159: at.siemens.mma.iap.CreateBetBean is not public in at.siemens.mma.iap; cannot be accessed from outside package
    [javac] at.siemens.mma.iap.CreateBetBean CreateBet = null;
    [javac] ^
    [javac] C:\jboss-3.2.1_tomcat-4.1.24\server\default\tmp\deploy\server\default\deploy\work\MainEngine\localhost\Betting\web\check_c reate_bet_jsp.java:161: at.siemens.mma.iap.CreateBetBean is not public in at.siemens.mma.iap; cannot be accessed from outside package
    [javac] CreateBet = (at.siemens.mma.iap.CreateBetBean) pageContext.getAttribute("CreateBet", PageContext.PAGE_SCOPE);
    [javac] ^
    [javac] C:\jboss-3.2.1_tomcat-4.1.24\server\default\tmp\deploy\server\default\deploy\work\MainEngine\localhost\Betting\web\check_c reate_bet_jsp.java:164: at.siemens.mma.iap.CreateBetBean is not public in at.siemens.mma.iap; cannot be accessed from outside package
    [javac] CreateBet = (at.siemens.mma.iap.CreateBetBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "at.siemens.mma.iap.CreateBetBean");
    [javac] ^
    [javac] C:\jboss-3.2.1_tomcat-4.1.24\server\default\tmp\deploy\server\default\deploy\work\MainEngine\localhost\Betting\web\check_c reate_bet_jsp.java:178: DB_SetNewBetInfos() in at.siemens.mma.iap.CreateBetBean is not defined in a public class or interface; cannot be accessed from outside package
    [javac] CreateBet.DB_SetNewBetInfos();
    [javac] ^
    [javac] 4 errors


    Can anyone help me?

    Please!
  2. #2
  3. I played Richard the Third
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Den Haag, Netherlands
    Posts
    122
    Rep Power
    12
    Does restarting Tomcat/JBoss after you copied the files help?
    Now is the winter of our discontent made glorious summer by this son of York.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Vienna
    Posts
    3
    Rep Power
    0
    No, it doesn't work!

    Is there a possibility to see if a bean is running?

IMN logo majestic logo threadwatch logo seochat tools logo