Setting Java class parameters for a JSP page

Hi,
I have a Java class that has a reference to a Session Id. I want to call a JSP from the class and set the session id to a String variable in the JSP. I am using a URL class to call the JSP. After the actual URL is passed to the URL constructor, I am appending the "?m_sessionId=e_session Id" at the end of the URL. In my JSP, I have the m_sessionId String parameter that i want to set e_sessionId to. What should i do in my JSP to set this? Any answers will be very helpful and I'd like to offer many thanks in advance
  public void loadSessionStuff(String sessionID){
   String e_sessionId = URLEncode.encode(sessionID);
   URL url = new URL("http://localhost:9000/MyJSP.jsp?m_sessionId="+e_sessionId);
   .....MyJSP.jsp looks something like this
   <%!
      String m_sessionId;
      public void setSessionId(){
       m_sessionid = request.getParameter("e_sessionId");    
       public String getSessionId(){
           return m_sessionId;
        other stuff....
    %>Is this the correct way to do things. It's not working.
Regards
R

Hi Rahul,
Yeah, i got that resolved. Do you know how i can get the thing in reverse gear. What i mean is i can successfully call and get the JSP to do things for me from my Java bean. What about sending stuff back to my bean?
I want to send the List back to my calling class so i can work with it.
Thanks
Regards
Jeeves
My Java code is as follows
Results i_krf = null;
  if(null != getSessionId()){                   
                String e_sessionId = URLEncoder.encode(this.m_sessionId);
                String eQuestion = URLEncoder.encode(sQuestion);
                Object obj;               
                String URL = "http://"+m_rea.getHostname()+":"+m_rea.getPort()+"/"+"SecondaryInitiator.jsp"+"?m_sessionId="+e_sessionId+"&question="+eQuestion;
                URL url = new URL(URL);
                         URLConnection urlConn = url.openConnection();
                ois = new ObjectInputStream(new BufferedInputStream(urlConn.getInputStream()));
                while((obj = ois.readObject()) != null){
                     System.out.println("From OIS::"+obj.getClass());
                                i_krf = (Reults) obj;
<%@ page import = "java.io.*,java.sql.*,java.util.*"%>
<%
  String m_sessionId;
  String eQuestion;
  System.out.println("In the JSP Page. Scriptlet part");
  m_sessionId = request.getParameter("m_sessionId");
  eQuestion = request.getParameter("question");
  System.out.println("Session Id in JSP::"+m_sessionId+"::"+eQuestion);
  Results i_krf = loadSession(m_sessionId);
  if(null != i_krf){
   System.out.println("NOT NULL::");
   List list = i_krf.getPathList(eQuestion);
   for(Iterator it = list.iterator();it.hasNext();){
    PathKeys pk = (PathKeys) it.next();
    System.out.println("PATH::"+pk.getPathKey());
%>
<%!     
     Shopper m_sSession = null;
     Results i_krf;
     public Results loadSession(String m_sessionId){
      if(null != m_sessionId){
        m_sSession = Shopper.findShopSession(m_sessionId);       
        System.out.println("Session ID from JSP"+m_sessionId);
        if(null != m_sSession ){
          i_krf = new ResultsImpl(m_sSession );
      return (null==i_krf?null:i_krf);
%>

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.

  • Problem during call java class (model layer) from jsp page (view layer)

    I created new Fusion web application so I have now to parts in the application navigator (model, viewcontroller)
    I want to write java class in the Model part as following:
    package persistence;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class DBManager {
    Connection connection = null;
    public DBManager() {
    super();
    public void init() {
    try {
    // Load the JDBC driver
    String driverName = "oracle.jdbc.driver.OracleDriver";
    Class.forName(driverName);
    // Create a connection to the database
    String serverName = Constant.DB_SERVER_NAME;
    String portNumber = Constant.DB_PORT_NUMBER;
    String sid = Constant.DB_SID;
    String url =
    "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" +
    sid;
    String username = Constant.DB_USER_NAME;
    String password = Constant.DB_PASSWORD;
    connection = DriverManager.getConnection(url, username, password);
    System.out.println("*");
    System.out.println(connection.getCatalog());
    } catch (ClassNotFoundException e) {
    System.out.println("Could not find the database driver");
    } catch (SQLException e) {
    System.out.println("Could not connect to the database");
    e.printStackTrace();
    and wrote JSP page in the view controller part as following :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@page import="persistance.*"%>
    <% persistance.DBManager manager = new DBManager(); %>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    <title>Browse</title>
    </head>
    <body>
    <table>
    </table>
    </body>
    </html>
    but this I have the following error in the jsp page :type persistance.DBManager not found
    my job is to build simple ADF application using JSF and java without any ADF faces or JPA or any another technology
    thanks

    Duplicate message.
    type persistance.DBManager not found
    Add a Dependency on the Model project in the View project. In Project Properties select the Dependencies node to add dependencies.
    Edited by: dvohra16 on Jun 19, 2011 8:37 AM

  • How to Generate a Java file for a JSP Page

    Hi ,
    I am using weblogic11 .
    I am working on a JSP page which nearly consists of 4000 lines of code.
    I need to debug the file , but weblogic server is not generating the java file for the JSP pages .
    Please let me know how can i genertae Java file for the jsp pages ??

    JSPs are compiled into servlets automatically and those classes are stored in WEB-INF/classes folder. Servlet engine handles servlets.

  • How to include a .class file in a jsp page

    hi everyone,
    i know the syntax as:
    <%@ include file = "filename.class" %>
    then at run time the server could not find the class file
    if i use,
    <%@ page import = "FileName.class" %>
    then also the same problem persists
    & if i use
    <jsp:include page = "Relative address"/>
    the problem still remains as it is...
    please help me out...i am working on developing an EJB application in which client interacts with server's Stateful session bean through a jsp page...it is necessary for me to include the home interface class file in my jsp page.
    P.S. do not suggest me to include the class file in a package & then use
    <%@ page import = "packageName.ClassFileName" %>
    i
    Edited by: Ankit_JIITU on 6 Jul, 2008 1:55 AM

    Ankit_JIITU wrote:
    i have already included the remote interface class file by <%@ page import = "University.RemoteInterfaceName" %>in my jsp page ...
    if i try to make a new package called test & then include my home interface in that package...i need to import University.*to generate the class file of my home interface ; but the class file generation is not taking place as i am getting the error..
    "package University does not exist".How can i overcome this problem. The package University, which you are trying to import, must be in the classpath. If you removed it then you will have to add it back.
    i have tried my best..but tell me if there's any possible way of including a class file in the jsp page without involving a package.No, there isn't.
    If not,then pls help me to generate the class file of my home interface within a package called test.Read the New To Java Tutorial and understand how packages work.
    >
    i am assuming that u have a deep knowledge of developing EJB applications.

  • HT2506 Is it possible to print separate pages on the same sheet in preview. I would like to split a set of class power points to display Page 1 and 2 on the first page, page 3 and 4 on the second page etc. Thanks in advance!

    Is it possible to print separate pages on the same sheet in preview. I would like to split a set of class power points to display Page 1 and 2 on the first page, page 3 and 4 on the second page etc.
    Thanks in advance!

    Nevermind everyone!
    I got it to work with Print Down/Across...silly me.
    Thanks anyway!
    -Arin

  • One MIDI input, one set of modulation parameters for the EXS24

    This might be somewhat of a neophyte question, but here goes:
    I'm interested in being able to set a specific set of modulation parameters for each note in series of notes inputted into the EXS24. I'd like to be able to bypass any sort of complex routing techniques with the modulation matrix or automating the parameters in the arrangement window. For instance if I input 2 C1 notes, one right after the other, of the same length, I'd to be able to set the velocity, filter values, ASDR values, etc. of the first completely independently from the second. The main reason I ask this is that for instruments such as a guitar (which has multiple strings), one note might be able to be played at high velocity, high release, low attack, for instance, while another one might be played exactly after that (on a separate string maybe) with low velocity, high release, high attack, etc., etc. In order to achieve this more realistic sound, would I have to work with multiple instances of the EXS24 (and then maybe just group them all together?), or is this sort of micro-manipulation of all the modulation parameters for each individual midi note input somehow possible with just one instance of EXS24?
    Hope this makes sense!

    Do you have a controller with polyphonic after touch? you can already have different velocities for note attacks and filters with a standard velocity sensing keyboard. If your board sends release velocity you can also have a different release for each note. With poly after touch you can have different vibrato depth for each note. If you want differing mod speeds for different notes I'd have to give it more thought...

  • Requirements for building jsp pages

    wht are the basic requirements for building jsp pages
    or even 4 wrkin on j2ee..
    new to j2ee and hv exp on j2se

    It's depends what OS you have:
    Windows -- IIS + Tomcat
    Linux(FreeBSD) -- Apache + Tomcat (or Resin, but I prefer Tomcat);
    Of couse you should have a text editor to edit *.jsp file :-)

  • How to set the connection parameters for SQL

    How to set the connection parameters for SQL to access the MS Access database
    Attachments:
    Quick_SQL.vi ‏21 KB
    Doc1.doc ‏45 KB
    db1.mdb ‏112 KB

    Right-click the WINDOWS desktop, choose New->Microsoft Data Link. That will bring up a dialog that allows you to configure and test your database connection. You might connect to the Access database via ODBC or directly via Jet Engine. The Jet Enginge saves you the trouble of creating an ODBC connection on your PC. After you leave the dialog, the "data link" will show up on your desktop as text file. Open it and copy-paste the connection string to your VI.
    This webpage is an excellent resource for connection strings: http://www.able-consulting.com/ADO_Conn.htm
    If your application requires users to change the database connection at runtime, you can also include the dialog via ActiveX (MSDASC.IDataSourceLocator).

  • Essential PL/SQL , Java Classes/Methods for working on BLOB

    &#61623; Are there any methods/procedures with which we could work on a BLOB object which contains purely text?
    &#61623; Essential PL/SQL , Java Classes/Methods for working on BLOB:
    null

    &#61623; Are there any methods/procedures with which we could work on a BLOB object which contains purely text?
    &#61623; Essential PL/SQL , Java Classes/Methods for working on BLOB:
    null

  • How to convert a .jsp to a .java/.class file for use in peoplesoft

    Hi java/jsp experts,
    I want to convert a .jsp to a .java/.class file. is there a tool available, please let me know if you have any pointers....
    or can i do it manually:
    these are a few lines that the .jsp contains, and i would like to translate this to be in .java/.class format:
    <%@ page import="sun.misc.BASE64Encoder, javax.crypto., javax.crypto.spec."%>
    <%@ page import="java.util.StringTokenizer" %>
    <%@ page import="java.util.Map" %>
    <%!
    sb.append("<input type=\"hidden\" name=\"orderPage_serialNumber\" value=\"");
    sb.append(serialNumber);
    sb.append("\">\n");
    return sb.toString();
    %>
    how can i translate the above import statements and html elements from jsp to java, please let me know.
    Once i have the .java file created from the .jsp, I will compile .java to create the .class file and invoke the .class in peoplecode by using java apis available in peopletools.
    Thanks in advance.

    Is there a way convert a binary .exe file( compiled by
    another compiler) into Java .class/.jar file ? Anyone
    know of a free program that can do this?It's not possible. There are many decompilers and disassemblers for Java but nothing will take you from ANY binary to Java source. It would be the end of computing as we know it and the beginning of a new era -:)

  • How to set an 'alias' for a JSP page in web.xml

    Hi
    Suppose I have a JSP page called SimplePage.jsp and I want to refer to it by someother name while running the application how do I do this in the web.xml file. I have used <servlet-mapping> to do this in the case of a servlet. However I am not sure how to do this with a JSP
    Could somebody show me how to do this. I would be very much grateful.
    All help appreciated and acknowledged.
    thanks in advance
    ilango

    It worked. The correct web.xml version is as below:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app SYSTEM "http://java.sun.com/dtd/web-app_2_3.dtd" [
    ]>
    <web-app>
    <!-- Define servlets that are included in the example application -->
    <servlet>
    <servlet-name>ControllerServlet</servlet-name>
    <servlet-class>ControllerServlet</servlet-class>
    <init-param>
    <param-name>base</param-name>
    <param-value>http://localhost:8080/MVCIIapp/servlet/ControllerServlet</param-value>
    </init-param>
    <init-param>
    <param-name>jdbcDriver</param-name>
    <param-value>sun.jdbc.odbc.JdbcOdbcDriver</param-value>
    </init-param>
    <init-param>
    <param-name>imageUrl</param-name>
    <param-value>http://localhost:8080/MVCIIapp/images/</param-value>
    </init-param>
    <init-param>
    <param-name>dbUrl</param-name>
    <param-value>jdbc:odbc:Burnaby</param-value>
    </init-param>
    <init-param>
    <param-name>ilangocal</param-name>
    <param-value/>
    </init-param>
    <init-param>
    <param-name>mangla</param-name>
    <param-value/>
    </init-param>
    </servlet>
    <servlet>
    <servlet-name>Header</servlet-name>
    <jsp-file>/MVCIIapp/jsp/Header.jsp</jsp-file>
    </servlet>     
    <servlet-mapping>
    <servlet-name>ControllerServlet</servlet-name>
    <url-pattern>/Master</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>Header</servlet-name>
    <url-pattern>/Opener</url-pattern>
    </servlet-mapping>     
    </web-app>
    I have other jps files too.I am going to try and put aliases for them and see how they perform.
    I hope I have not spoken too soon by saying that the aliases work. Let me wait and watch with bated breath.
    But thanks a lot for your suggestions without which this would not have been possible
    ilango

  • How can i  apply this  java program for  a jsp page?

    import java.io.*;
    import java.util.*;
    public class FileProcessing
      //create a vector container  for the input variables
         Vector variables = new Vector();
      //create a vector container for the constants
         Vector constants = new Vector();
      /*create a string expression container for the equation
         as read from the file */
         String expression = " ";
      //create double result container for the final result
         double result = 0;
         public boolean processFile(String filename,String delim)
          //index for values vector
              int num_values = 0;
          //index for constants vector
              int num_constants = 0;
          //current line being read from the external file.
              String curline = " ";
          //start reading from the external file
              try
                   FileReader fr = new FileReader(filename);
                   BufferedReader br = new BufferedReader(fr);
                   while(true)
                        curline = br.readLine();
                        if(curline == null)
                             break;
                    //determine the type of current interaction
                        boolean variable = curline.startsWith("input");
                        boolean constant = curline.startsWith("constant");
                        boolean equation = curline.startsWith("equation");
                        boolean output = curline.startsWith("result");
                   //on input variables
                        if(variable)
                          StringTokenizer st = new StringTokenizer(curline,delim);
                          int num = st.countTokens();
                          int count=0;
                          while(st.hasMoreTokens())
                               String temp = st.nextToken();
                               if(count==1)
                                    byte b[]= new byte[100];
                                    System.out.println(temp);
                                    System.in.read(b);
                                    String inputval = (new String(b)).trim();
                                    variables.add(num_values,inputval);
                                    num_values++;
                               count++;
                        // on constant values
                        if(constant)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==1)
                                       byte b[]= new byte[100];
                                       System.out.println(temp);
                                       System.in.read(b);
                                       String cons = (new String(b)).trim();
                                       constants.add(num_constants,cons);
                                       num_constants++;
                                  count++;
                        // on equation
                        if(equation)
                             StringTokenizer st = new StringTokenizer(curline,delim);
                             int num = st.countTokens();
                             int count = 0;
                             while(st.hasMoreTokens())
                                  String temp = st.nextToken();
                                  if(count==2)
                                       this.expression = temp;
                                  count++;
              // now we are ready to evaluate the expression
                       if(output)
                          org.nfunk.jep.JEP  myparser= new org.nfunk.jep.JEP();
                          myparser.setAllowAssignment(true);
                          for(int i=1;i<variables.size()+1;i++)
                             String name = "arg"+Integer.toString(i);
                             myparser.addVariable(name,new Double(variables.get(i-1)
                                                .toString()).doubleValue());
                          for(int i=1;i<constants.size()+1;i++)
                               String name = "arg" +Integer.
                                         toString(i+variables.size());
                               myparser.addConstant(name,new Double(constants.get(i-1).toString()));
                   //output is obtained as follows
                          myparser.parseExpression(expression);
                          result = myparser.getValue();
                          System.out.println("Assay value: "+result);
              catch(Exception e)
                   System.out.println(e.toString());
              return true;
         public static void main(String[] args)
              FileProcessing fp = new FileProcessing();
              fp.processFile("input.eqn",":");
    }//my text file name is: "input.eqn" (given below)
    input:Enter Value1:arg1
    input:Enter Value2:arg2
    input:Enter Value3:arg3
    constant:arg4
    constant:arg5
    Equation:arg1+arg2+arg3
    result:

    how can i apply this java program for a jsp pagewhy do you want to do this ?
    Your program reads from a file on the disk and formats based on a patterm.
    Jsp is not intended for such stuff.
    ram.

  • JSP implementation class for a JSP Page

    Hello,
    It is very important for me to know ...
    - Do you consider that a JSP developer should know that each JSP Page becomes at run-time a Java Servlet ? And int the way that the Java code you have wrote in the JSP Page is dispatched in the declaration of this servlet ?
    He should know how the Java code generated by the server looks like ?
    Thank you all for your answers.
    Adriana

    Everybody's going to have their own opinion on this - here's my 2 cents.
    Theoretically, there are at least two roles here.
    #1. An expert in HTML, graphic layout, user interface etc.
    #2. A programmer who understands the technical infrastructure - Java, beans, servlets, database connections etc.
    In the perfect world, Role #1 would build JSPs and would not need to understand Java or the technical architecture. The JSPs would act as templates and not contain any Java code (e.g. scriptlets). Role #2 would build custom tags and beans for use in the JSPs.
    To answer your question, Role #1 should not understand how JSPs are translated to servlets, but Role #2 should.
    In reality, the two roles are often filled by the same person, usually a programmer who may introduce Java elements into the JSP. Once this occurs, then the JSP has become a program rather than a template and knowledge of its translation to servlets is necessary for debugging.

  • How to call a class method from a jsp page?

    Hi all,
    i would like to create a basic jsp page in jdev 1013 that contains a button and a text field. When clicking the button, i would like to call a method that returns a string into the text field.
    The class could be something like this:
    public class Class1 {
    public String getResult() {
    return "Hello World";
    How do i go about this?
    Thanks

    Here is a sample:
    HTML><HEAD><TITLE>Test JDBC for Oracle Support</TITLE></HEAD><BODY>
    <%@ page import="java.sql.*, oracle.jdbc.*, oracle.jdbc.pool.OracleDataSource" %>
    <% if (request.getParameter("user")==null) { %>
    <FORM method="post" action="testjdbc.jsp">
    <H1>Enter connection Parameters</H1>
    <H5>Please enter host name:</H5><INPUT TYPE="text" name="hostname" value="localhost" />
    <H5>Please enter port number:</H5><INPUT TYPE="text" name="port" value="1521" />
    <H5>Service nanme:</H5><INPUT TYPE="text" name="service" value="XE" />
    <H5>Please enter username: </H5><INPUT TYPE="text" name="user" />
    <H5>Please enter password</H5><INPUT TYPE="password" name="password" />
    <INPUT TYPE="submit" />
    </FORM>
    <% } else { %>
    <%
    String hostName = request.getParameter("hostname");
    String portNumber = request.getParameter("port");
    String service = request.getParameter("service");
    String user = request.getParameter("user");
    String password = request.getParameter("password");
    String url = "jdbc:oracle:thin:" + user + "/" + password + "@//" + hostName + ":" + portNumber + "/" + service;
    try {
    OracleDataSource ods = new OracleDataSource();
    ods.setURL(url);
    Connection conn = ods.getConnection();
    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();
    // gets driver information
    out.println("<TABLE>");
    out.println("<TR><TD>");
    out.println("<B>JDBC Driver version</B>");
    out.println("</TD>");
    out.println("<TD>");
    out.println(meta.getDriverVersion());
    out.println("</TD>");
    out.println("</TR>");
    out.println("<TR><TD>");
    out.println("<B>JDBC Driver Name</B>");
    out.println("</TD>");
    out.println("<TD>");
    out.println(meta.getDriverName());
    out.println("</TD>");
    out.println("</TR>");
    out.println("<TR><TD>");
    out.println("<B>JDBC URL</B>");
    out.println("</TD>");
    out.println("<TD>");
    out.println(meta.getURL());
    out.println("</TD>");
    out.println("<TABLE>");
    conn.close();
    } catch (Exception e) {e.printStackTrace(); }
    %>
    <%-- end else if --%>
    <% } %>
    </BODY>
    </HTML>

Maybe you are looking for