Accessing my own class members from the JSP file

Hi,
I have created a class by name simple.java.and the package structure is like sridhar.source.useful.In this package i placed my file simple.java.
Now i import this file with the import statement in JSP like
<%@ import = "sridhar.source.useful.*" %>
Now from the JSP file i want to execute some of the methods in simple.java.
I tried this one by importing the simple.java in my JSP file,but i am getting some errors:
variables that i have declared in Java files are not defined.
The JSP is not importing the class simple.java
I am executing my JSP in weblogic6.1(webserver is IPlanet)
shall i need to set any classpath for this in the weblogic shell script??
pls clarify me if any configuration is to be made or not??
regards
Naidu

For JSP with IPlanet/weblogic and imported custom classes:
Put your class / package in the correct folder. $path is any path you want....
Ex: package foo, class foorbar must be
$path/foo/foobar.class
All classes must be .class, not .jar.
Weblogic/IPlanet must be configured to have the CLASSPATH
$path/
(do not include foo/foobar!)
The JSP has
<%@ import "foo.*" %>
Your class may now be used just like the other imported classes. Say you have an object Foobar with a constructor, you can just say
Foobar myFoo = new Foobar();
I do this with my classes, so if you have any questions, just ask.

Similar Messages

  • Accessing a java class method from the jsp page.

    Hi im a beginner with jsp and im trying to find a way to access a method of my java class file in jsp page. After searching through the forums i tried to use the usebean tag. Im using apache to host the jsp file.Below is an excerpt of my code and the error message i got. What am i doing wrong? anyone know?
    <%@ page language="java" %>
    <jsp:useBean id="movies" class="movie.Movie" />
    <jsp:setProperty name="movies" property="*"/>
    <%
    movies.getStart("file:///C:/Video/Applications2/sun.mpg");
    response.setContentType("text/xml");
    %>
    exception
    org.apache.jasper.JasperException: Exception in JSP: /View.jsp:7
    4: <jsp:setProperty name="movies" property="*"/>
    5: <%
    6:
    7: movies.getStart("file:///C:/Video/Applications2/sun.mpg");
    8: response.setContentType("text/xml");
    9: %>
    Stacktrace:
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    javax.servlet.ServletException: javax/media/ControllerListener

    Hi thanks for responding. Ok i did look through and it was opening some gui. I still need the program to do server side processes so cant use an applet.but i dont need the gui so i revised it and removed the gui. also im using a servlet to call the class now yet i still have the same error. Any ideas?
    Below is the vid2jpg code minus the gui.
    import java.io.*;
    import java.awt.*;
    import javax.media.*;
    import javax.media.control.*;
    import javax.media.format.*;
    import javax.media.protocol.*;
    import java.awt.image.*;
    import javax.imageio.*;
    public class vid2jpg implements ControllerListener
         Processor p;
         Object waitObj = new Object();
         boolean stateOK = true;
         DataSourceHandler handler;
    int imgWidth;int imgHeight;
         Image outputImage;
         String sep = System.getProperty("file.separator");
         int[] outvid;
         int startFr = 1;int endFr = 1000;int countFr = 0;
         boolean sunjava=true;
         * Static main method
         public static void main(String[] args)
              if(args.length == 0)
                   System.out.println("No media address.");
                   new vid2jpg("file:///C:/Video/applications2/sun.mpg");     // or alternative "vfw://0" if webcam
              else
                   String path = args[0].trim();
                   System.out.println(path);
                   new vid2jpg(path);
         * Constructor
         public vid2jpg(String path)
              MediaLocator ml;String args = path;
              if((ml = new MediaLocator(args)) == null)
                   System.out.println("Cannot build media locator from: " + args);
              if(!open(ml))
                   System.out.println("Failed to open media source");
         * Given a MediaLocator, create a processor and start
         private boolean open(MediaLocator ml)
              System.out.println("Create processor for: " + ml);
              try
                   p = Manager.createProcessor(ml);
              catch (Exception e)
                   System.out.println("Failed to create a processor from the given media source: " + e);
                   return false;
              p.addControllerListener(this);
              // Put the Processor into configured state.
              p.configure();
              if(!waitForState(p.Configured))
                   System.out.println("Failed to configure the processor.");
                   return false;
              // Get the raw output from the Processor.
              p.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW));
              TrackControl tc[] = p.getTrackControls();
              if(tc == null)
                   System.out.println("Failed to obtain track controls from the processor.");
                   return false;
              TrackControl videoTrack = null;
              for(int i = 0; i < tc.length; i++)
                   if(tc.getFormat() instanceof VideoFormat)
                        tc[i].setFormat(new RGBFormat(null, -1, Format.byteArray, -1.0F, 24, 3, 2, 1));
                        videoTrack = tc[i];
                   else
                   tc[i].setEnabled(false);
              if(videoTrack == null)
                   System.out.println("The input media does not contain a video track.");
                   return false;
              System.out.println("Video format: " + videoTrack.getFormat());
              p.realize();
              if(!waitForState(p.Realized))
                   System.out.println("Failed to realize the processor.");
                   return false;
              // Get the output DataSource from the processor and set it to the DataSourceHandler.
              DataSource ods = p.getDataOutput();
              handler = new DataSourceHandler();
              try
                   handler.setSource(ods);     // also determines image size
              catch(IncompatibleSourceException e)
                   System.out.println("Cannot handle the output DataSource from the processor: " + ods);
                   return false;
         //     setLayout(new FlowLayout(FlowLayout.LEFT));
    //          currPanel = new imgPanel(new Dimension(imgWidth,imgHeight));
         //     add(currPanel);
         //     pack();
              //setLocation(100,100);
         //     setVisible(true);
              handler.start();
              // Prefetch the processor.
              p.prefetch();
              if(!waitForState(p.Prefetched))
                   System.out.println("Failed to prefetch the processor.");
                   return false;
              // Start the processor
              //p.setStopTime(new Time(20.00));
              p.start();
              return true;
         * Sets image size
         private void imageProfile(VideoFormat vidFormat)
              System.out.println("Push Format "+vidFormat);
              Dimension d = (vidFormat).getSize();
              System.out.println("Video frame size: "+ d.width+"x"+d.height);
              imgWidth=d.width;
              imgHeight=d.height;
         * Called on each new frame buffer
         int nextframetime = 0;
    private void useFrameData(Buffer inBuffer)
    try
    if(inBuffer.getData()!=null) // vfw://0 can deliver nulls
    if(sunjava) // and with import javax.imageio.*;
    int frametimesecs = (int)(inBuffer.getTimeStamp()/1000000000);
    if(frametimesecs%10 == 0 && frametimesecs==nextframetime)
    nextframetime+=10;
    BufferedImage bi = new BufferedImage(outputImage.getWidth(null), outputImage.getHeight(null), BufferedImage.TYPE_INT_RGB);
    Graphics g = bi.getGraphics();
    ImageIO.write(bi, "png", new File("images"+sep+"image_"+(inBuffer.getTimeStamp()/1000000000)+".png"));
    catch(Exception e){}
         * Tidy on finish
         public void tidyClose()
              handler.close();
              p.close();
         * Block until the processor has transitioned to the given state
         private boolean waitForState(int state)
              synchronized(waitObj)
                   try
                        while(p.getState() < state && stateOK)
                        waitObj.wait();
                   catch (Exception e)
              return stateOK;
         * Controller Listener.
         public void controllerUpdate(ControllerEvent evt)
              if(evt instanceof ConfigureCompleteEvent ||     evt instanceof RealizeCompleteEvent || evt instanceof PrefetchCompleteEvent)
                   synchronized(waitObj)
                        stateOK = true;
                        waitObj.notifyAll();
              else
              if(evt instanceof ResourceUnavailableEvent)
                   synchronized(waitObj)
                        stateOK = false;
                        waitObj.notifyAll();
              else
              if(evt instanceof EndOfMediaEvent || evt instanceof StopAtTimeEvent)
                   tidyClose();
         * Inner classes
         * A DataSourceHandler class to read from a DataSource and displays
         * information of each frame of data received.
         class DataSourceHandler implements BufferTransferHandler
              DataSource source;
              PullBufferStream pullStrms[] = null;
              PushBufferStream pushStrms[] = null;
              Buffer readBuffer;
              * Sets the media source this MediaHandler should use to obtain content.
              private void setSource(DataSource source) throws IncompatibleSourceException
                   // Different types of DataSources need to handled differently.
                   if(source instanceof PushBufferDataSource)
                        pushStrms = ((PushBufferDataSource) source).getStreams();
                        // Set the transfer handler to receive pushed data from the push DataSource.
                        pushStrms[0].setTransferHandler(this);
                        // Set image size
                        imageProfile((VideoFormat)pushStrms[0].getFormat());
                   else
                   if(source instanceof PullBufferDataSource)
                        System.out.println("PullBufferDataSource!");
                        // This handler only handles push buffer datasource.
                        throw new IncompatibleSourceException();
                   this.source = source;
                   readBuffer = new Buffer();
              * This will get called when there's data pushed from the PushBufferDataSource.
              public void transferData(PushBufferStream stream)
                   try
                        stream.read(readBuffer);
                   catch(Exception e)
                        System.out.println(e);
                        return;
                   // Just in case contents of data object changed by some other thread
                   Buffer inBuffer = (Buffer)(readBuffer.clone());
                   // Check for end of stream
                   if(readBuffer.isEOM())
                        System.out.println("End of stream");
                        return;
                   // Do useful stuff or wait
                   useFrameData(inBuffer);
              public void start()
                   try{source.start();}catch(Exception e){System.out.println(e);}
              public void stop()
                   try{source.stop();}catch(Exception e){System.out.println(e);}
              public void close(){stop();}
              public Object[] getControls()
                   return new Object[0];
              public Object getControl(String name)
                   return null;
    below is the servlet code.
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    public class ShowMovie extends HttpServlet {
    String rootURL="http://127.0.0.1:8080/Video/";
    public void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
         //String movie=request.getParameter("movie");
         String movie ="son";
         getStart(movie);
              response.sendRedirect(rootURL+"View.jsp");
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
         public void getStart(String url){
              new vid2jpg(url);
    this is the error from the server. Im using tomkat 5
    exception
    javax.servlet.ServletException: Servlet execution threw an exception
    root cause
    java.lang.NoClassDefFoundError: javax/media/ControllerListener
         java.lang.ClassLoader.defineClass1(Native Method)
         java.lang.ClassLoader.defineClass(Unknown Source)
         java.security.SecureClassLoader.defineClass(Unknown Source)
         org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1812)
         org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:866)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1319)
         org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1198)
         java.lang.ClassLoader.loadClassInternal(Unknown Source)
         ShowMovie.getStart(ShowMovie.java:31)
         ShowMovie.processRequest(ShowMovie.java:14)
         ShowMovie.doGet(ShowMovie.java:22)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.

  • Accessing parent window form elements from a JSP file

    Actually I have a JSP page . It calls a popup function to load another JSP file on the event Onclick of a label. In the JSP file loaded on the popup window, I need to access the form elements of the parent.
    Eg: the Parent has a Textarea named "ta_1" in the form "appl_1".
    Now i cannot access this element in the child JSP page using,
    window.opener.document.ta_1.appl_1.value;
    The window.opener is not defined for this HTML page cos the HTML page was generated as an output of the JSP file.
    Please give a JSP code snippet which accesses the parent form element..

    Actually I have a JSP page . It calls a popup function to load another JSP file on the event Onclick of a label. In the JSP file loaded on the popup window, I need to access the form elements of the parent.
    Eg: the Parent has a Textarea named "ta_1" in the form "appl_1".
    Now i cannot access this element in the child JSP page using,
    window.opener.document.ta_1.appl_1.value;
    The window.opener is not defined for this HTML page cos the HTML page was generated as an output of the JSP file.
    Please give a JSP code snippet which accesses the parent form element..

  • How to pass value from the jsp file to a java bean

    I have huge promblem .I want to pass value of combo box to bean file to set my database contecting.The is how i call function to pass database to the bean file
    <%db.setDatabase(database);%>are coding to set my databse connection
    private String database;
        public Conn(){
         try{
                   Class.forName("org.gjt.mm.mysql.Driver");
                   DriverManager.registerDriver((Driver) Class.forName("org.gjt.mm.mysql.Driver").newInstance());
                   String data=getDatabase();
                   String url = "jdbc:mysql://localhost/"+data;
                   Connection conn = DriverManager.getConnection(url);
                   setConnection(conn);
              catch(SQLException e){
                   System.out.println(e.toString());
              catch(Exception e){
                   System.out.println(e.toString());
         public void setDatabase(String Database){
          this.database = Database;
         public String getDatabase(){
         return this.database;
         }     and Below are error produce
    Note: sun.tools.javac.Main has been deprecated.
    /mrs/system_menu.jsp:18: Method setDatabase(java.lang.String) not found
    in class bgoc.dbConn.Conn.
    db.setDatabase(database);
    ^
    1 error, 1 warning
    please help me soon. any that come to your will help
    thank you

    I have huge promblem .I want to pass value of combo box to bean file to set my database contecting.The is how i call function to pass database to the bean file
    <%db.setDatabase(database);%>are coding to set my databse connection
    private String database;
        public Conn(){
         try{
                   Class.forName("org.gjt.mm.mysql.Driver");
                   DriverManager.registerDriver((Driver) Class.forName("org.gjt.mm.mysql.Driver").newInstance());
                   String data=getDatabase();
                   String url = "jdbc:mysql://localhost/"+data;
                   Connection conn = DriverManager.getConnection(url);
                   setConnection(conn);
              catch(SQLException e){
                   System.out.println(e.toString());
              catch(Exception e){
                   System.out.println(e.toString());
         public void setDatabase(String Database){
          this.database = Database;
         public String getDatabase(){
         return this.database;
         }     and Below are error produce
    Note: sun.tools.javac.Main has been deprecated.
    /mrs/system_menu.jsp:18: Method setDatabase(java.lang.String) not found
    in class bgoc.dbConn.Conn.
    db.setDatabase(database);
    ^
    1 error, 1 warning
    please help me soon. any that come to your will help
    thank you

  • Error accessing JSp file from Tomcat4.1.27 at line:-1 in the jsp file: null

    Hi...when I tried to access my JSp file from tomcat 4.1.27 web server, I got the following error message. Can anyone help me out?
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    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
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:8: '.' expected
    import java;
    ^
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:80: illegal start of expression
    private static java.util.Vector jspxincludes;
    ^
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:82: illegal start of expression
    public java.util.List getIncludes() {
    ^
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:280: '}' expected
    ^
    4 errors
         at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
         at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
         at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2416)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:601)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:534)

    You JSP has four compile errors:
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:8: '.' expected
    import java;Invalid import. You need to import a whole package (*) or single class.
    import java; is wrong
    import java.util.*; is right
    import java.util.List; is right
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:80: illegal start of expression
    private static java.util.Vector jspxincludes;
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:82: illegal start of expression
    public java.util.List getIncludes() {Check the lines before these to make sure you didn't leave off a semi-colon, parens (')') or bracket ('}').
    C:\Tomcat\work\Standalone\localhost\Tree\jspfiles\tree_jsp.java:280: '}' expectedYou are missing a closing bracket ('}') somewhere.
    The message about the "line -1" error is the standard message that is always given when there are compile errors in the JSP.

  • How to set the classpath and path from the jsp to call  java class function

    Hi Exprets,
    I have a requirement to call a java class function which returns a hashmap object from the jsp. The java class in present in one jar file and that jar file is location somewhere in unix path. So the requirement is to set the classpath for that jar file and then create the object of the java class and then call the function.
    If any one know how to achieve it, please reply as soon as possible.
    thanks in advance,
    swapna soni.

    It is never advisable to store large data sets in the session. But it will depend on a lot of factors:
    1. How costly is the query retrieving the data from the database?
    If it's a complex query with lots of joins and stuff, then it will be better to store it in the session as processing the query each time will take a lot of time and will decrease performance. On the other hand if the query is simple then it's advisable not to store it in the session, and fetch it each time.
    2. Are there chances for the data to become stale within a session?
    In this case storing the data is session will mean holding the stale data till the user session lasts which is not right.
    3. How many data sets does the session already holds?
    If there are large no. of data sets already present in the session, then it's strictly not advisable to store the data in the session.
    4. Does the server employ some kind of caching mechanism?
    Using session cache can definitely improve performance.
    You will have to figure out, what is the best way analyzing all the factors and which would be best in the situation. As per my knowledge, session is the only place where session specific data can be stored.
    Also, another thing, if the data set retrieved is some kind of data to be displayed in reports, then it would be better to use a pagination query, which will retrieve only the specific no. of rows at a time. A navigation provided in the UI will retrieve the next/previous data set to display.
    Thanks,
    Shakti

  • How to reference a DatabaseHandler servlet class from a jsp file in Tomcat

    Trying to create a database connection in the jsp file in webapps\project folder by referencing the DatabaseHandler class in webapps\project\WEB-INF\classes.
    Here is the code in the jsp to make the connection:
    DatabaseHandler db = new DatabaseHandler() ;
    String sql = "SELECT password FROM cms_users WHERE user =" + userName ;
    java.sql.ResultSet rs = db . selectQuery( sql ) ;
    Here is the DatabaseHandler class:
    import java.sql.*;
    public class DatabaseHandler
         // instance variables - replace the example below with your own
    private Connection connection;
         * Constructor for objects of class DatabaseHandler
         public DatabaseHandler()
    String url = "jdbc:odbc:javadatabase";
    // Load the driver to allow connection to the database
    try
    Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
    connection = DriverManager.getConnection( url );
    catch ( ClassNotFoundException cnfex )
    System.err.println( "Failed to load JDBC/ODBC driver." );
    cnfex.printStackTrace();
    System.exit( 1 ); // terminate program
    catch ( SQLException sqlex )
    System.err.println( "Unable to connect" );
    sqlex.printStackTrace();
    public ResultSet selectQuery( String query )
    Statement statement;
    ResultSet resultSet = null ;
    try
    statement = connection.createStatement();
    resultSet = statement.executeQuery( query );
    catch ( SQLException sqlex )
    sqlex.printStackTrace();
    System . exit( 1 ) ;
    return resultSet ;
    Here is the error i am getting when i try to run the jsp script:
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 2 in the jsp file: /ValidateLogon.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\cms\ValidateLogon_jsp.java:47: cannot find symbol
    symbol : class DatabaseHandler
    location: class org.apache.jsp.ValidateLogon_jsp
    DatabaseHandler db = new DatabaseHandler() ;
    ^

    Just like in the class file you need to import any classes that you want to access in the JSP.
    http://java.sun.com/products/jsp/tags/11/syntaxref11.fm7.html

  • Pass the data back from the jsp page to the java code

    Hi,
    I have written an iView that receives an event using EPCF and extracts data from the client data bag.
    I need this iView to pass the data back from the jsp page to the java code.
    I am trying to do this using a hidden input field, but I cannot get the code to work.
    Here is the code on the jsp page.
    <%@ taglib uri="tagLib" prefix="hbj" %>
    <hbj:content id="myContext" >
      <hbj:page title="PageTitle">
       <hbj:form id="myFormId">
    <hbj:inputField id="myInputField" type="string" maxlength="100" value="" jsObjectNeeded="true">
    <% myInputField.setVisible(false);%>
    </hbj:inputField>      
       </hbj:form>
      </hbj:page>
    </hbj:content>
    <script language=JavaScript>
    EPCM.subscribeEvent("urn:com.peter", "namedata", window, "eventReceiver");
    function eventReceiver(eventObj) {
         var url = eventObj.dataObject;
         var funcName = htmlb_formid+"_getHtmlbElementId";
         func = window[funcName];
         var ipField = eval(func("myInputField"));
         ipField.setValue(url);
         var form = document.all(htmlb_formid);
         form.submit();
    </script> 
    Here is my java code
    package com.sap.training.portal;
    import com.sapportals.htmlb.InputField;
    import com.sapportals.htmlb.page.DynPage;
    import com.sapportals.htmlb.page.PageException;
    import com.sapportals.portal.htmlb.page.JSPDynPage;
    import com.sapportals.portal.htmlb.page.PageProcessorComponent;
    public class ListSalesOrder extends PageProcessorComponent {
      public DynPage getPage(){
        return new ListSalesOrderDynPage();
      public static class ListSalesOrderDynPage extends JSPDynPage{
         private String merong;
        public void doInitialization(){
        public void doProcessAfterInput() throws PageException {
              InputField reportfld = (InputField) getComponentByName("myInputField");
              if (reportfld != null)      merong = reportfld.getValueAsDataType().toString();
        public void doProcessBeforeOutput() throws PageException {
              if ( merong != null ) setJspName("merong.jsp");
              else setJspName("ListSalesOrder.jsp");
    Here is DD
    <?xml version="1.0" encoding="utf-8"?>
    <application>
      <application-config>
        <property name="SharingReference" value="com.sap.portal.htmlb"/>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
      </application-config>
      <components>
        <component name="SearchSalesOrder">
          <component-config>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="/pagelet/SearchSalesOrder.jsp"/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
          </component-profile>
        </component>
        <component name="ListSalesOrder">
          <component-config>
            <property name="ClassName" value="com.sap.training.portal.ListSalesOrder"/>
          </component-config>
          <component-profile>
            <property name="tagLib" value="/SERVICE/htmlb/taglib/htmlb.tld"/>
          </component-profile>
        </component>
      </components>
      <services/>
    </application>
    After receive event, then call java script function "eventReceiver" and call "form.submit()".
    But .. PAI Logic in Java code doesn't called ...
    Where is my problme ?
    Help me ...
    Regards, Arnold.

    Hi Arnold,
    you should not do a form.submit yourself. Instead you can put a component called ExternalSubmit to your page:
    ExternalSubmit exSubmit = new ExternalSubmit("EX_SUBMIT"));
    exSubmit.setServerEventName("MyEvent");
    This results in a java script funtion on the page which is called "_htmlb_external_submit_". If you call this function the the form gets submitted and your event handler is called.
    regards,
    Martin

  • How do i retrieve information from the JSP into my SELECT statements?

    I need to retrieve the information that is being entered into JSP page.. So that i can use them to do an SQL statement.. but im not very sure if my codes are correct.. Following are my codes.. Pls help.. thx
    MyJSPPage.jsp
    <jsp:useBean id="user" class="user.User" scope="session"/>
    <form name="loanItem" method ="POST" action="user">
    <input type="hidden" name="userID" value="<jsp:getProperty name="user" property="userID"/>">
         <tr><td align=left height="34"> <b> <font size="4">Member ID:</font>
    </b> </td>
              <td height="34">
              <jsp:getProperty name="user" property="userID"/></td>
         </tr>     
    ==================================================================================
    MyManager.java --> this file is where all my SQL statements are ..
    [l]String itemType = session.getParameter("itemType");[l] (--->> is how i retrieve info from the JSP page?)
              if (itemType.equals("Book"))
                   String sqlQuery1 = "select loanDuration from ItemPolicy where itemType ='" + itemType+ "'";
                   System.out.println(sqlQuery1);
                   ItemPolicy itempolicy = null;
                   try {
                        db = new Database();
                        rs = db.readRequest(sqlQuery1);
                        if (rs != null && rs.next()) {
                             itempolicy = new ItemPolicy();
                             itempolicy.setLoanDuration(Integer.parseInt(rs.getString("loanDuration")));
                        db.close();
                   } catch (SQLException se) {
                                  se.printStackTrace();
                                  throw (new UserException("Unable to retrieve from Database!"));
                             } catch (Exception e) {
                                  e.printStackTrace();
                                  throw (new UserException("Unknow error encountered!"));
                   String dueDate = util.getDueDate(itempolicy.getLoanDuration());
              else if (itemType.equals("Magazine"))
    ==================================================================================
    Thanks in advance...

    you should change to request.getParameter("itemType").
    or just System.out.print the itemType to see it got the value.
    Hope it helps.

  • Invoking the scheduler's doScheduledTask method from the jsp

    Hi Folks,
    Could you please throw some ideas on my issue,
    I would like to invoke the scheduler's doScheduledTask method from the jsp.
    approach is like...
    I have JSP and a form. Form has a one text field and i will give some value and clicks on the submit button, it should invoke the scheduler method.
    or
    if you know any other approach to invoke the scheduler's doScheduledTask method from the jsp is invitable.
    Thanks much in advance

    Hi,
    1. Create the form in the jsp and a form handler to process this form, say InvokeSchedulerFormHandler.
    2. Create a variable to refer to the scheduler.
    MyScheduler myScheduler;
    // create getter and setter for this.
    3.. Create a handle method, handleInvokeScheduler(). Do any validations if required.
    4. After the validations, call getMyScheduler().doScheduledTask();
    5. In the jsp, map the submit button to this handle method.
    <dsp:input type="submit" bean="InvokeSchedulerFormHandler.invokeScheduler" value="Submit"/>
    6. Create the .properties file to the form handler and to your scheduler.
    MyScheduler.properties
    $class=com.package.MyScheduler
    $scope=global
    InvokeSchedulerFormHandler.properties
    $class=com.package.InvokeSchedulerFormHandler
    $scope=request
    myScheduler=/com/package/MyScheduler
    (Am wondering about this requirement :) . If you can specify the reason, it will be helpful).
    Hope this helps.
    Keep posting the questions / updates.
    Thanks,
    Gopinath Ramasamy

  • How can i access the jsp file in a asp file

    Hi every one..
    we have two projects one is developed in ASP and one is developed in JSP both are running in two different locations.
    now i want to include a jsp file from one project to ASP file in the other project.
    please tell me how can i insert the JSP file in ASP application.
    thanx in advance.

    Wouldn't that be an ASP question for an ASP forum?

  • How can I access my home security DVR from the internet?

    My Time Capsule (as a router and not a bridge) blocks me from accessing my home security DVR from the internet.  I can access it from other computers connected to my LAN but not from the internet.  I guess it's a firewall setting issue.  I can't add the home security application to the list of firewall allowed incoming connections since it's a Windows app that I cannot install on my Mac.  On the other hand, the app is installed on my old PC but I can't access the Mac firwall settings from the PC and add the security app (If that's the problem).
    My DVR is connected to a Netgear switch which is connected to the Time Capsule which is connected to a Cisco modem provided by Comcast. I thought one of the modem ports had to be opened by Comcast. That was not the issue.  After spending 2 hours on the phone with Comcast going in circles talking to 10 different overseas agents, they concluded the Netgear switch was blocking me from accessing the DVR.  I think they are wrong and that it's a Mac firewall problem.  HELP!!!  Does anyone know what could be the problem and how to solve it?

    Did you forward the required ports in the TIme Capsule? If not it won't work.. it has nothing to do with firewall unless the DVR is plugged into the Mac. If it is plugged into a switch you need to lock the IP of the DVR and find out what ports are required.. usually just port 80, ie html.. but it could be some others.
    Since Apple do not use upnp to open ports.. the TC will have to manually be provided with the ports.. Apple use PMP-NAT that is not used by the rest of the known world.. Just to ensure you stay in the camp.

  • Can songs uploaded using the iMatch service be accessed by other family members using the Family Sharing feature?

    Can songs uploaded using the iMatch service be accessed by other family members using the Family Sharing feature?

    No
    Which purchased content can I share using Family Sharing - Apple Support

  • SAP XI 3.0 - Error while reading the ID of own business system from the SLD

    Error while reading the ID of own business system from the SLD for system Quality (QOC) and Client 100. 
    I get this error in the SXMN_MONI.  The business process is that the Interface to send master schedule and finished inventory from the legacy system to SAP to create planned orders in SAP for all Plants.
    I could able to get "SUCCESSFULLY PROCESSED" in development and production.  But only in Quality I getting this error.  Could anyone help me to fix this issue.
    thanks...

    Probably, its due to incorrect RFC Adapter properties in config.
    Go to Integration COnfiguration. Double Click on the Business System for your R/3 system. On the right hand screen, Click  on Service-->Adapter Specific Parameters.
    Check whether the Logical System Name comes up as SAP<SID> and whether R/3 system ID and Client are appropriate.
    If these values are inappropriate, make changes to the corresponding Technical System defined in the SLD. After you have made the necessary corrections, come back to Integration COnfiguration, Double click on Business SYstem for R/3. Switch to Edit Mode. Click on Service-> Adapter Specific Parameters and then click on the Icon between Apply and Cancel buttons, inorder to compare with SLD and make those values reflect in config. Then click on Apply and Save the Business System.
    After this, you can retry sending the message.
    Rgds
    R Chandrasekhar

  • Error while reading the ID of own business system from the SLD for system

    Hello,
    I try to send master material data from a 4.7 system via XI 3.0 to an autoID Infrastructure system 2.1. All Communication Channels, Receiver Agreements, Receiver and Interface Agreements are configured. The IDOC gets propper into the XI, Inbound Message is "green". Now, I get the following message:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="INTERNAL">SLD_NO_OWN_BS</SAP:Code>
      <SAP:P1>ZTA</SAP:P1>
      <SAP:P2>013</SAP:P2>
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>Error while reading the ID of own business system from the SLD for system ZTA and client 013</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    Can anybody help me?

    Probably, its due to incorrect RFC Adapter properties in config.
    Go to Integration COnfiguration. Double Click on the Business System for your R/3 system. On the right hand screen, Click  on Service-->Adapter Specific Parameters.
    Check whether the Logical System Name comes up as SAP<SID> and whether R/3 system ID and Client are appropriate.
    If these values are inappropriate, make changes to the corresponding Technical System defined in the SLD. After you have made the necessary corrections, come back to Integration COnfiguration, Double click on Business SYstem for R/3. Switch to Edit Mode. Click on Service-> Adapter Specific Parameters and then click on the Icon between Apply and Cancel buttons, inorder to compare with SLD and make those values reflect in config. Then click on Apply and Save the Business System.
    After this, you can retry sending the message.
    Rgds
    R Chandrasekhar

Maybe you are looking for