Passing vector between java class and jsp page

Hi,
I think this is similar to the last post but anyways maybe somebody can help us both out bontyh.....I am getting an error saying undefined variable or class when i try to access a Vector which was returned in a class.
Anyways anyone got any ideas?

Maybe if you give some more information...

Similar Messages

  • Ordinary java class and jsp page

    hi i want to use some java class(not javabean ) in my jsp . how do i import them and use them?

    You can just import the package into your JSP, and access it like any other class of the Standard Java API that you access.
    fun_one

  • Java Classes and JSP`s (urgent)

    hi, my question is:
    How can i invoke normal java classes` methods using Jsp`s for this??, is it possible??, if it is, then how do you do this, and where do you have to put the java classes in order to find them from a jsp.
    thanks

    Hi,
    You can access normal java classes in JSP pages. You have to import them in the header like this:
    <%@ page language="java" import="//your java class file with package"%>
    or if u r using java beans, then use the <usebean> tag. Put the java classes in the classes directory. Which server u r using? If it is JWS, then u have a specified classes directory, where u have to put all the class files along with their packages. Hope this will help.
    atanu.

  • How to load java class from jsp page?

    hi all!
    Does anyone know how to load java class from jsp page?
    I try to load java class from jsp page.
    Is it possible to load java class fom jsp page?
    thanks and have a good day!

    What I mean is How to load/open java class file from jsp page?
    I think we can open Applet from jsp page by using
    <applet code=helloApplet.class width=100 height=100>
    </applet>
    but, how to open java class which is an application made by Frame?
    thanks and have a good day

  • Calling java class from jsp page

    Dear Friends.
    I wrote jsp page and java class.
    Am calling java class from jsp page. after processing result,
    I have to refresh jsp page from java class.
    processing time may take 5 minutes or 1 minute etc. that depends on user.
    Can It be possible ? if possible , How ?

    Ok, I get a very strange error now:
    org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
    What is this??? Anyone?

  • Passing parameters from a Java class to Jsp page

    Hi everybody. I'm newbie in using Java class in conjunction with JSP pages. Infact I have a problem. How can I pass the parameters used in a Java class (as UserName, Password, and so on..) to a JSP page? What methods (and classes) I have to use?
    Thank you in advance
    Have a nice day

    It still doesn't work. I write the code
    //my java class
    package channel_service;
    import java.util.Vector;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class CallMenu {
    private Vector parameters = new Vector();
    public void setParameters( String UserId ) {
    parameters.add(0, UserId);
    //parameters.add(2, Pin);
    //parameters.add(3, UserName);
    //parameters.add(4, Greeting);
    public Vector getParameters() {
    return parameters;
    //my jsp page
    <%@ page import="Channel_Service.src.channel_service.CallMenu" %>
    <%@ page import="java.util.Vector" %>
    <html>
    <head><title>User Menu Page</title></head>
    <body>
    <center><h1><i><b>This is your personal User Menu page</b></i></h1></center>
    <br>
    <br>
    <center><h2><i>In the list below you'll find all your personal information (as UserID, Password and so on...)
    and all the function you have the rights to use</i></h2></center>
    <br>
    <br>
    <table align=center>
    <tr>
    <%
    CallMenu cl = new CallMenu();
    cl.setParameters();
    Vector params = cl.getParameters();
    String UserId = (String)params.elementAt(0);
    String Pin = (String)params.elementAt(1);
    String UserName = (String)params.elementAt(2);
    String Greeting = (String)params.elementAt(3);
    %>
    <td><h2><b><i>User ID = <%= UserId %></td></tr>
    <tr><td><h2><b><i>PIN = <%= Pin %></td></tr>
    <tr><td><h2><b><i>User Name = <%= UserName %></td></tr>
    <tr><td><h2><b><i>The system says <%= Greeting %></td></tr>
    </table>
    </body>

  • Pass table rowtype between java class and PL/SQL package

    I am a complete newbie when it comes to java itself but I've been asked to investigate the possibility of passing a rowtype datatype from a PL/SQL package to a java class and vice versa.
    I have heard of oracle.sql.ArrayDescriptor as an option but this appears to address only SQL types that are defined outside of a package.
    I'm talking about using, say, SCOTT.EMP%rowtype instead of a user-defined type. I'm thinking that a java array could be defined from the definition of a table in the database but I don't know what class would be appropriate.
    Could someone provide a simple proof-of-concept example that shows how you could use a java array to pass data to a package that is expecting a table rowtype variable and conversely a java class that reads the rowtype returned into a java array?
    Would oracle.jdbc.driver.OracleDatabaseMetaData be a way of doing this?
    Thanks!

    Kuassi:
    <br><br>
    Not at all. I didn't feel like you misled me at all. I'm grateful for your help. I think that maybe I failed to describe my problem adequately in the first place.
    <br><br>
    Perhaps I've also gotten stuck on the term <i>ref cursor</i>.
    <br><br> At any rate, the people I'm gathering information for have further refined their requirement. We want to take a collection of data and send it to a procedure. It doesn't have to be a "ref cursor" or "%rowtype" per se, but something that is maintainable and workable from both ends.
    <br><br>
    For example, to use the old SCOTT/TIGER paradigm, let's suppose we have a website where you can indicate which employees work for a given department. The website allows us to fill in information for multiple employees at once. We want to use a servlet that gathers all the employees data and sends it on through to a PL/SQL package so that the data is validated and committed in the database.<br><br>
    Perhaps the java servlet should handle the multiple employee records as an array? If so, how can a PL/SQL procedure be made to recognize that construct?<br><br>
    I can accept that java cannot create a "ref cursor" type to send information to a package, but might this be possible via some other implementation?
    <br><br>
    Hopefully this is a little more clear. If not, please let me know and I'll try to inject more details as to what we are trying to accomplish.
    <br><br>
    Once again, thanks for your persistent replies and help.
    <br>

  • Tag to take a java class in JSP page

    Hi,
    � need to get a tag to get a java class for example Test.java into a JSP page like MyJSP.jsp so that � can ,after doing this, call its methods, variables etc.
    Thank you !

    � know a way to do th�s us�ng JRun but the programme � have (NETBEANS IDE 3) does not accept �t.

  • Difference between Java class and JavaBean?

    What is the difference between a Java class and a JavaBean?
    A class has variables which hold state.
    A class has methods which can do things (like change state).
    And if I understand a JavaBean it is rather like a BIG class...
    i.e.
    A JavaBean has variables which hold state.
    A JavaBean has methods which can do things (like change state).
    So, what's the difference between the two?
    And in case it helps...What is the crossover point between the two? Is there a minimalist type JavaBean which is the same as a class? What is the difference between Java beans and Enterprise Java Beans?
    Thanks.

    Introspection, as I understand it is a bunch of
    methods which allows me to ask what a class can do
    etc. right? So, if I implement a bunch of
    introspection methods for my class then my class
    becomes a JavaBean?Introspection allows a builder tool to discover a Bean's properties, methods, and events, either by:
    Following design patterns when naming Bean features which the Introspector class examines for these design patterns to discover Bean features.
    By explicitly providing the information with a related Bean Information class (which implements the BeanInfo interface).
    I understand now they are completely different.
    Thanks. Very clear.
    I do not understand how they are completely different.
    In fact I don't have a clue what the differences are
    other than to quote what you have written. In your
    own words, what is the difference? This is the "New
    to Java Technology" forum ;-) and I'm new to these
    things.In that case ejbs are way too advanced for you, so don't worry about it.

  • Calling my Java class from JSP page

    Hello, I am trying to call my Java class from my JSP page passing parameters to it and getting back a collection of result sets. Can someone tell me what I might be doing wrong:
    JSP code to call Java class:
    <%
    String strEssUser = "test";
    String strProcessingMonth = "JUL";
    String strProcessingYear = "2002";
    strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
    %>
    I get this error when I try to run this JSP page using tomcat:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:77: Class org.apache.jsp.ListReturn not found.
    strQueryList=new ListReturn(strEssUser.toString(), strProcessingMonth.toString(), strProcessingYear.toString());
    I'm not sure if this problem is the way I am calling the Java class, or if I have a problem in the Java code itself. Can anyone help?

    Ok, I get a very strange error now:
    org.apache.jasper.JasperException: Unable to compile class for JSPerror: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
    What is this??? Anyone?

  • Java File and JSP Page

    I am to create a link verification program -- a simple java file with the database connection & some business logic and a JSP page that instantiates the my java file. It won't work. Everytime I run the jsp page, it gives me java.lang.NullPointerException. Can anyone give me some directions? The web server I am using is JRun.
    Thank you
    Below are my code:
    JSP Page:
    <%--      Verify Links
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <%@ page import="java.sql.*" %>
    <%@ page import="java.net.*" %>
    <%@ page import="pro.*" %>
    <html>
    <head>
    <title>Results</title>
    </head>
    <body>
    <%
    try{
    LinkConnection newconn = new LinkConnection();
    newconn.initialize();
    newconn.query();
    newconn.close();
    }catch (ClassNotFoundException cnfe)
    out.println(cnfe);
    catch (SQLException sqle)
    out.println(sqle);
    catch (NullPointerException npe)
    out.println(npe);
    %>
    </body>
    </html>
    Java Code:
    package pro;
    import java.io.*;
    import java.sql.*;
    import java.net.*;
    public class LinkConnection {
    Connection con;
    ResultSet RS;
    Statement Stmt;
    public void initialize() throws SQLException, ClassNotFoundException
    Class.forName("oracle.jdbc.driver.OracleDriver");
    con = DriverManager.getConnection("XXXX", "XXXX", "XXXX");
    public void query() throws SQLException
    Statement Stmt=con.createStatement();
    String strSQL="Select guideline_name, guideline_url from pgt_guidelines";
    ResultSet RS=Stmt.executeQuery(strSQL);
    while (RS.next())
    String guidelinename = RS.getString("guideline_name");
    String guidelineurl = ("http://" + RS.getString("guideline_url"));
    try {
    URL url = new URL(guidelineurl);
    HttpURLConnection link=(HttpURLConnection)url.openConnection();
    System.out.println("<font color='blue'>");
    System.out.println(guidelinename);
    System.out.println("<br>");
    System.out.println(guidelineurl);
    System.out.println("</font>");
    System.out.println("<font color='red'>");
    System.out.println(link.getResponseCode());
    System.out.println("</font>");
    System.out.println("<br />");
              }catch (Exception e)
              {System.out.println("<font color='yellow'>Error Link </font>")
    public void close() throws SQLException {     
    RS.close();
    Stmt.close();
    con.close();

    i'm having the same problem, what is the solution to this
    A Servlet Exception Has Occurred
    java.lang.NullPointerException
         at test.Lesson.runSql(Lesson.java:80)
    ===== Lesson.java file =====
    package test;
    import java.sql.* ;
    import java.io.Serializable;
    public class Lesson {
         public Lesson( ) { }
    //Line 9
         public String runSql ( ) {
              String browserOutput = "";
              Connection sqlca = null;
              Statement sqlStatement = null;
              ResultSet myResultSet = null;
    //Line 16
              /* Connect to database, run SQL and produce output */
              try { 
                   /* Connection to the database */
                   Class.forName("org.gjt.mm.mysql.Driver").newInstance();
                   String theDatabase ="jdbc:mysql://localhost/employee";
                   sqlca = DriverManager.getConnection(theDatabase,"usr","pwd");
    //Line 24
                   /* Construct and execute the sql, positioning before the
                   first row in the result set */
                   sqlStatement = sqlca.createStatement();
                   myResultSet = sqlStatement.executeQuery
    //Line 29
                   ("select emp_id, " +
                        "emp_lname, " +
                        "city, " +
                        "state," +
                        "zip_code, " +
                        "emp_fname " +
                        "from employee " +
                        "where emp_id < 250 " +
                        "order by emp_lname, emp_fname");
    //Line 39
                   /* Construct the heading for the table */
                   browserOutput =
                        "<div align=left>"+
                        "<table border=0 align=left width=520>" +
                        "<caption><i><b>" +
                        "Employee Listing</b></i></caption>" ;
    //Line 46
                   /* Construct the column headings for the table */
                   browserOutput +=
                        "<th align=left>Emp_id</th>" +
                        "<th>First Name</th>" +
                        "<th>Last Name</th>" +
                        "<th>City</th>" +
                        "<th>State</th>" +
                        "<th>Zip</th>" ;
    //Line 55
                   /* Move to next row and & its contents to the html output */
                   while(myResultSet.next()) {
                        browserOutput += "<TR><TD>" +
                   myResultSet.getObject("emp_id").toString() + "</TD><TD>" +
                   myResultSet.getObject("emp_fname").toString()+"</TD><TD>" +
                   myResultSet.getObject("emp_lname").toString() + "</TD><TD>" +
                   myResultSet.getObject("city").toString() + "</TD><TD>" +
                   myResultSet.getObject("state").toString() + "</TD><TD>" +
                   myResultSet.getObject("zip_code").toString() + "</TD></TR>" ;
    //Line 66
                   }//end of while
                   sqlStatement.close();
                   sqlca.close();
              }//end of try
              catch (SQLException e) {
    //Line 72
                   browserOutput = " Error: SQLException: " + e.getMessage();
                   browserOutput= " Error: SQLState: " + e.getSQLState();
                   browserOutput= " VendorError: " + e.getErrorCode();
              }//end of SQLException
              catch (Exception e) {
                   browserOutput = " Error: JDBC Class creation: " + e.getMessage();
              }//end of Exception
    /**Line 80**/     finally {
                   try { sqlca.close(); }
                   catch(SQLException e) {
                   browserOutput = " Error: Closing connection: " + e.getMessage();
              }//end of finally
         /* Complete the html and return it to the Java Server Page */
         browserOutput += "</table>" + "</div>" ;
         return browserOutput;
         } //end of runSql
    }//end of Lesson

  • Import java-classes in JSP-page

    Hi,
    I'm starting with JSP and with trying one of the first examples in the book "beginning J2EE 1.4" from wrox, i got following problem.
    i'm trying to import a java-class in the package CH03 with
    <%@ page import="Ch03.FaqCategories" %>but he didn't find the package Ch03.
    I try already many things and i have no idea of the cause of the problem. So it's difficult to give information that leads to the solution.
    Maybe helpfull is the direcory-structure:
    jsp-page: /Ch03/welcome.jsp
    java-classe: /Ch03/WEB-INF/classes/Ch03/FaqCategories.class
    If you need source-codes or other information, just ask.
    Thanks,
    Dennis

    Thank you,
    Your help was one step into the good direction and that problem is solved.
    The application work now with studio one, but if i try it to work it with a stand-alone tomcat server it doesn't work anymore. I go first try to solve this problem by my self or at least try to describe the problem more exactly, before i ask for new help.
    but if you have any idea, that's always welcome...
    with regards,
    Dennis

  • How to use java class in jsp page of JSPProvider?

    Hello everybody.
    I created simple JSPProvider channel with portal amconsole and named it "jspprov1". Then I created "jspprov"1 directory under "/ets/opt/SUNWps/desktop/sampleportal". I put "index.jsp" in it. And it worked until I add this line into "index.jsp": <% @page import="jspprov1package.aclass1" %>. Then I created directory "jspprov1package" under "/ets/opt/SUNWps/desktop/classes" and put "aclass1.class" into it and into "/ets/opt/SUNWps/desktop/classes" itself. I created "aclass1.class" on the other machine (with no installed portal) in j2sdk1.4.1_02: "javac aclass1.java". The text of this class is simple:
    "package jspprov1package;
    public class aclass1{
    public int int_field = 10;
    But the page still don't work. It writes on the portal desktop "ERROR: Content is not available".
    Does anybody know why this happened?

    Sorry, there were mistakes in jsp page and java files.
    I maked the channel "show exceptions" and found them out.

  • Scope of a java class in JSP page

    Hi
    If I use a java bean using the
    <jsp:useBean
    id="beanSomeName"
    scope="page|request|session|applicaton
    I can specify the scope of of the bean after which I can assume it is Garbage Collected.
    However if I just create a new Java Class in a jsp bean ( I inherited this code ) what will be scope of this java class. When will it be Garbage collected.
    Is it Page scope?
    Thanks
    bib/-

    If you do
    <% MyClass c = new MyClass(); %>
    and don't do anything else to store it in the request or session than it is like page scope.
    if you do
    <%! MyClass c = new MyClass(); %>
    it is more like application scope.

  • Importing java classes into jsp page

    I'm trying to import java classes inside my jsp page, while doing that i am getting compilation error "package uma.natarajan.javaclasses" not found. I don't know where to copy the java files. i'm keeping my jsp files under public_html folder
              

    Hi uma,
              create uma\natarajan\javaclasses under weblogic_home\myserver and copy java
              classes(u want to import) to uma\natarajan\javaclasses and then u try.
              Concept is the java classes u import should be present in a classpath. Hope
              this may help u,
              Arun,
              [email protected]
              "uma natarajan" <[email protected]> wrote in message
              news:3a490bcb$[email protected]..
              > I'm trying to import java classes inside my jsp page, while doing that i
              am getting compilation error "package uma.natarajan.javaclasses" not found.
              I don't know where to copy the java files. i'm keeping my jsp files under
              public_html folder
              

Maybe you are looking for

  • IChat video chatting not working

    I have read through many posts and cannot find an answer to my problem. When I initiate or receive and invite for a video chat with another Mac I receive a message indicating that "There was a communication error during your chat". It goes on to stat

  • I am trying to view videos and I keep getting blocked plugin signs. What can I do to fix this problem.

    I am unable to view videos. I keep getting blocked plugin signs. How can I fix this problem?

  • [SOLVED] can't start apache ¿because owncloud logfile doesn't exist?

    I've just installed MariaDB, PHP, mysql and owncloud, but since I installed this last one I can't run httpd. This is the error: $ systemctl status -l httpd ● httpd.service - Apache Web Server    Loaded: loaded (/usr/lib/systemd/system/httpd.service;

  • Content of the Audit Log

    Hello, It seems that the text of the audit log is contained in table xi_af_msg_audit ins the J2EE schema under field text_key. If I access this key directly from the database it seems to be unnecessarily long, with a lot of blank space padding. Is it

  • SD Query Install - No Entry Found Problem

    Gurus, I have this weird problem in Bex. I installed around 15  Business Content SD query and transported to the assigned Z package. I was able to view the query and have data populated last week. But recently when i tried to open a particular sales