Exception when URL connects to JSP page

Hi All,
I have a Web Application [http://localhost:8080/MyWebApps/TestEnv]
Consider the following 3 pages:
index.jsp
Login.jsp
LoggedIn.jspI have clean & build and Undeploy & Deploy it (NetBeans and using glassfish)
Start -> Run -> [http://localhost:8080/MyWebApps/TestEnv/]
will load the index.jsp, redirect to Login.jsp,
I give a valid userName & password (submit the form),
reload Login.jsp and it redirects me to LoggedIn.jsp.
I have created a class that passes the same url to its loadURL method
but the openStream method of the URL class gives an IOException
Please tell me how to fix my problem I am baffeled as to the solution
Below I have provided the code
Thanx in advance

index.jsp
<HTML>
  <BODY>
<%
    response.sendRedirect("Login.jsp");
%>
  </BODY>
</HTML>Login.jsp
<HTML>
  <BODY>
<%
    String uName = null;
    String uPass = null;
    if((uName = request.getParameter("uName") != null)
      if((uPass = request.getParameter("uPass") != null)
        if(Check.Login(uName,uPass))
          response.sendRedirect("LoggedIn.jsp");
/* code for Login
  public static boolean Login(String name, String password){
    if(name.equals("user"))
      if(password.equals("pass123"))
        return true;
    return false;
%>
    <FORM Action="Login.jsp" Method="GET">
      <TABLE>
        <TR>
          <TD>User Name:</TD>
          <TD><INPUT Type="TEXT" Name="uName"/></TD>
        </TR>
        <TR>
          <TD>User Password:</TD>
          <TD><INPUT Type="PASSWORD" Name="uPass"/></TD>
        </TR>
        <TR>
          <TD><INPUT Type="SUBMIT" Value="GO"/></TD>
          <TD><INPUT Type="RESET" Value="Reset"/></TD>
        </TR>
      </TABLE>
    </FORM>
  </BODY>
</HTML>LoggedIn.jsp
<HTML>
  <BODY>
    <H1>You Have Logged In</H1>
  </BODY>
</HTML>JAVA
import .....;
public class Connector {
  public static void main(String[] args){
    String path = "http://localhost:8080/MyWebApps/TestEnv/";
    Connection conn = new Connection();
    try{
      conn.loadURL(path);
    }catch(Exception ex){
      Sysyem.out.println(ex.getMessage());
  public void loadURL(String path) throws Exception{
     URL url = new URL(path);
     BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
     String HtmlInputLine;
     while((HtmlInputLine = in.readLine()) != null)
       System.out.println(HtmlInputLine);
     in.close();
}

Similar Messages

  • How do I get the URL of a jsp page?

    I have a jsp page which has a link to a servlet page, in the servlet page, I want to get the URL of the jsp page.
    I tried to use request.getHeader("referer"), it seems like if it is a link in the jsp directly lead to the servlet, it works, but if the link calls a javascript function which opens up a window runing the servlet, it is not working. I have to do the second way, so it is not working by doing request.getHeader("referer")
    I tried to use javascript "location.href", I get the whole url by alerting the url in the jsp page:
    http://localhost:8080/pos-webapp/serv/qt_old?currentpage=portal&bcd=ABC123&pnm=P1001830&prnm=1&psd=236863.0&ln=01&sln=NYPPA&stp=2.1&stt=A&_POSID=1F8464122ADAF4EEC9B1A94C286EB252
    then I pass this url when calling with my servlet, in the servlet page, when I do request.getParameter("url"), the url is actually cut off like this:
    http://localhost:8080/pos-webapp/serv/qt_old?currentpage=portal
    anything after &pnm is cut off, anyone has any idea?
    Thanks in advance.

    Thank you.
    but how do I put encoding in the javascript code? do I need to decode in my servlet page?
    here is my code in the jsp page:
    linkset[3]+='<div class="menuitems">Email Diagnostics to AutoOne</div>'<%     
    function emailDiagnostics()
    win = window.open("/pos-webapp/serv/email_diagnostics?url=" + location.href + "&browser=" + navigator.appName, "emailDiagnostics",
    "width=350, height=140, resizable=no, scrollbars=no, toolbar=no, location=yes, directories=no, status=no, menubar=no, copyhistory=no, left=450, top=300");
    win.focus();
    }

  • JDBC-ODBC connectivity from JSP page

    hi
    i am trying to connect a jsp page with database using jdbc-odbc driver. i have created a dsn with the name 'test' that connects to a database 'test' in SQL server. the following lines has been added to the web.xml file placed in the \WEB-INF folder
    <context-param>
    <param-name>
    javax.servlet.jsp.jstl.sql.dataSource
    </param-name>
    <param-value>
    jdbc:odbc:text, sun.jdbc.odbc.JdbcOdbcDriver
    </context-param>
    i have also placed the rt.jar file in the \WEB-INF\lib folder. but, when i run the jsp page and ty to make any database interaction, an expection occurs
    java.lang.ClassNotFoundException : sun.jdbc.odbc.JdbcOdbcDriver
    please help

    I think you need to download the JDBC/ODBC driver jar file into your project. For example, if you need a JDBC driver for the Oracle database, you search google for 'oracle jdbc driver'. Its driver is something like classes14.jar. I suggest you create and test your database connection pool in a servlet so you will have an easier time debugging any issues in getting it to work.
    Also, as the previous post points out, JSP is for displaying data and submitting user input back to the servlet. Put all your business logic in the servlet, put any data you get from the database in request scope by the servlet, dispatch to the JSP page so it can be displayed. This is a crude example. For a better design read up on MVC (Model View Controller) design.

  • How to establish a MYSQL Database connection in JSP page.

    Hi People,
    Tell me how to establish mysql database connection in JSP page.
    Needed details on:
    1) what are all the mysql drivers need to be included.
    2) what is the syntax for establish a database connection

    hi,
    http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmlsee down for mysql config with tomcat

  • How do I get the URL of a jsp page which calls a servlet?

    I have a jsp page which will lead to a servlet, I can get the URL of the servlet, but how do I get the URL of the jsp page which lead to the Servlet in the servlet?

    You could try doing:
    request.getHeader("Referer");

  • Database connection to jsp page

    I have a data entry form in HTML and done validation in javascript.
    From that form the values entered by the user, is displayed on JSP page by method.
    <%=request.getParameter(" ")%
    MY problem is:
    i want that the values shown by the jsp page, is submitted or saved into database automatically, when i click submit button on the page.
    How can i do this.
    I have to use jdbc driver to make a connection for the database.
    plzz help me, as it is very urgent.
    my jsp page is as follow:
    <%@ page language="java" import="java.sql.*" %>
    <html>
    <head>
    <title></title>
    <body>
    <%
    try {
    //Load the jdbc driver
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    //Create a connection object
    Connection con=DriverManager.getConnection("jdbcdbc:jspsql","java","java");
    System.out.println("got connection");
    // Create a statement object and call its executeUpdate method to insert a record
    Statement s=con.createStatement();
    String sql = "INSERT INTO Gl_Mast VALUES ('1','ABHI','120','520')";
    s.executeUpdate(sql);
    // Step 4. Use the same Statement object to obtain a ResultSet object
    sql = "SELECT GL_CODE, GL_DESCR FROM Gl_Mast";
    ResultSet rs = s.executeQuery(sql);
    while (rs.next()) {
    out.println(rs.getString(1) + " " + rs.getString(2) + "<br>");
    rs.close();
    s.close();
    con.close();
    catch (ClassNotFoundException e1) {
    // JDBC driver class not found, print error message to the console
    System.out.println(e1.toString());
    catch (SQLException e2) {
    // Exception when executing java.sql related commands, print error message to the console
    System.out.println(e2.toString());
    catch (Exception e3) {
    // other unexpected exception, print error message to the console
    System.out.println(e3.toString());
    %>
    <form name="display" ACTION="" >
    <table width="100%" border="3">
    <tr>
    <TD COLSPAN=5><center><h3><b><i>GL MASTER INFORMATION</i></b></h3></center></TD>
    </TR>
    <tr>
    <th>Code No.</th>
    <th>Description</th>
    <th>Dr. Amount</th>
    <th>Cr. Amount</th>
    <th>Type</th>
    </tr>
    <tr>
    <td> <%=request.getParameter("code")%></td>
    <td> <%=request.getParameter("Description")%></td>
    <td> <%=request.getParameter("DrAmount")%></td>
    <td> <%=request.getParameter("CrAmount")%> </td>
    <td> <%=request.getParameter("type")%></td>
    </tr>
    </table>
    <p>
    <INPUT TYPE="submit" VALUE="SAVE" >
    <INPUT TYPE="button" VALUE="BACK" onClick="history.go(-1)">
    </body>
    </html>
    thanx..
    abhijit

    X POST

  • Sharing Portal database connection with JSP page

    Hi out there,
    I implemented a JSP page as a selection form to be integrated into Oracle Portal. This JSP page contains a 'dynamic' form which needs to send queries to the database also integrated in the Portal.
    For this I am currently using a JDBC connection but I would prefer to use the internal db connection of the Portal System.
    Explanation: The user has to log in to the Portal and after that can call the JSP form. To poulate some comboboxes within this form I need some data from the database and the user does have READING privileges on that database.
    Can anybody tell me how to use the user's login and password (or the established connection) to fetch the needed data from the database OTHER than with a jdbc connection?
    Thanx in advance!
    Cheers,
    Thomas

    sorry. not going to happen. you're running in a completely different environment when running Java on Portal. Portal is running in the database; your Java is running on the application server. your Java code must use JDBC to access any database resources, even if Portal related.
    it is essential that you implement a connection pool on the application server to optimize your database traffic. check out bitmechanic for a very good open source option.
    good luck,
    rich

  • "No more data to read from socket" exception when testing connections

    Hi,
    I will appriciate your help with the following problem.
    We have the follwoing errors in the weblogic.log (We are using weblogic 8.1.0.2 and Oracle 9.2.0.3)
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep> <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001128> <Connection for pool "oraclePool" closed.>
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001067> <Connection for pool "oraclePool" refreshed.>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001112> <Test "select count(*) from DUAL" set up for pool "oraclePool" failed with exception: "java.sql.SQLException: No more data to read from socket".>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>> <> <BEA-001131> <Received an exception when closing a cached statement for the pool "oraclePool": java.sql.SQLException: Io exception: Broken pipe.>
    These exception occures every hour after the connection pool is being closed and refreshed.
    Also there are a lot of the follwoing warnning in the log :
    <BEA-001074><A JDBC pool connection leak was detected.
    Does these two problems connected? What can we do in order to solve it?
    Thanks
    Edited by RF123 at 01/28/2007 3:41 AM

    R F wrote:
    Hi,
    I will appriciate your help with the following problem.
    We have the follwoing errors in the weblogic.log (We are using weblogic 8.1.0.2 and Oracle 9.2.0.3)
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep> <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001128> <Connection for pool "oraclePool" closed.>
    ####<Dec 20, 2006 10:47:49 AM EET> <Info> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001067> <Connection for pool "oraclePool" refreshed.>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001112> <Test "select count(*) from DUAL" set up for pool "oraclePool" failed with exception:
    "java.sql.SQLException: No more data to read from socket".>
    ####<Dec 20, 2006 10:47:51 AM EET> <Error> <JDBC> <ep > <mfserver> <Thread-14> <<WLS Kernel>
    <> <BEA-001131> <Received an exception when closing a cached statement for the pool "oraclePool":
    java.sql.SQLException: Io exception: Broken pipe.>
    These exception occures every hour after the connection pool is being closed and refreshed.
    Also there are a lot of the follwoing warnning in the log :
    <BEA-001074><A JDBC pool connection leak was detected.
    Does these two problems connected? What can we do in order to solve it?Hi. The problems are not directly related, but may have the same cause.
    Something is killing your DBMS connections out from under the driver.
    Do you have a firewall between WLS and the DBMS, or a flakey network?
    Contact BEA support to get the 8.1sp2 patch for getting meaningful
    connection leak traces (CR209251_81sp2.jar). When that patch is installed
    the leak messages should show a full stack trace of the application code
    where the connection was obtained. It is that application code that
    somehow failed to close the pool connection, causing a pool leak. I
    suspect that the application code got an unexpected exception, such as
    when/if the DBMS/network/firewall killed a connection. In this case I
    believe the application went through an exception-handling path that
    forgot to close the connection.
    Joe

  • Embedding SWF file with SAP Netweaver BI Connection to JSP page

    All,
    Is it possible to embed a SWF file with SAP Netweaver BI connection that is already published in BW system to a JSP page?
    Thanks...

    Hallo,
    embedding the published web-template via iframe into the jsp should work:
    <iframe id="test" src="/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex?DASHBOARD=TECHNICAL_NAME_DASHBOARD" width="600" height="800" />
    Regards,
    Roman

  • Error when I executed my JSP page

    Hello,
    I have installed in my machine o OracleAS e o OracleDS. I created a JSP page using Reports Builder. When I try run my page, after some time, the following error message is displayed in the browser:
    Reports Error Page
    Wed Jun 19 10:08:29 BRT 2002
    javax.servlet.jsp.JspException: REP-51002: Falha na Ligagco ao Servidor de Relatsrios rep60_mariana
    javax.servlet.jsp.JspException: REP-51002: Falha na Ligagco ao Servidor de Relatsrios rep60_mariana
         int oracle.reports.jsp.ReportTag.doStartTag()
         void MyReport.jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtime.HttpJsp.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void oracle.jsp.runtimev2.JspPageTable.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String)
         void oracle.jsp.runtimev2.JspServlet.internalService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void oracle.jsp.runtimev2.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         void javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
         void com.evermind.server.http.ServletRequestDispatcher.forwardInternal(javax.servlet.ServletRequest, javax.servlet.http.HttpServletResponse)
         boolean com.evermind.server.http.HttpRequestHandler.processRequest(com.evermind.server.ApplicationServerThread, com.evermind.server.http.EvermindHttpServletRequest, com.evermind.server.http.EvermindHttpServletResponse, java.io.InputStream, java.io.OutputStream, boolean)
         void com.evermind.server.http.HttpRequestHandler.run(java.lang.Thread)
         void com.evermind.util.ThreadPoolThread.run()
    Someone could help me?
    Thanks.
    Carla

    hello,
    this error message is when the report cound not contact the specified report server. since you are saying you are on windows NT i assume you try to run the report using the OC4J instance that comes with iDS.
    take a look at the HOW TO article "How to Execute Oracle9iAS Reports Services from Oracle9iDS" in Getting Started with Oracle9i Reports (http://otn.oracle.com/docs/products/reports/htdocs/doc_library/getstart/GettingStarted/whatsnew.html)
    it describes the necessary configuration you have to do to run a report there for testing.
    regards,
    philipp

  • SSO problem when redirecting from a JSP page to an external application

    Hi,
    I try to make a redirect from a JSP page (that is under a SSO protected application on iAS) to another page from another application, on an external iAS server, also protected by (a different) SSO. After the redirection is done, the login window appears, I enter the login name and the password and after that I obtain the followin error:
    "Oracle SSO Failure - Unable to process request
    Either the requested URL was not specified in terms of a fully-qualified host name or OHS single sign-on is incorrectly configured.
    Please notify your administrator."
    In the logs og the server I found the following:
    [OSSO] W05: Requested URL is not specified in terms of fully-qualified host name or invalid SSO partner configuration. Host from request
    mycompany.com:7777, registered host 144.147.147.200:7778.
    (the ip address being the address of the mycompany.com host).
    Any clue about this? Thanks a lot in advance!
    Regards,
    Marinel

    Hi Carlo,
    Thanks for your answer.
    The JSP original page is not added as a partner application to the second SSO server.
    The idea was that the user should insert first the login name/passwd for the first server, after being logged in, then redirected to the second application (on a different server), insert the login name/password for the second application and then load the 2nd application page. It seems that is not working after inserting the password for the 2nd application.
    Coming to a more general question that could help me to avoid this complicated approach: is it possible to have two different applications deployed on two different iAS servers and the two applications to use the same SSO (let's say the one from the first iAS server)? I have to mention that the process scenario is the following: the user load a page from the first application (protected by SSO), then, after successfull login and some processing in the first app, he will be automatically redirected by the first app to the second application, on the second server. I want to have also the second application, on the 2nd server, protected by SSO (ideally would be the same SSO as the first one!). Ideally the scenario would be: if it is redirected from the first app and the user is already authenticated, the automatic redirection should be done transparently for the user (without enetring the password again). If the user goes directly from the browser to a page of the second app, the SSO login window should be displayed and the user should provide his password.
    Is such a scenario possible on two apps deployed on two different servers?!
    Thanks a lot again!
    Regards,
    Marinel

  • Getting error message "Only a type can be imported-" when trying to execute jsp page

    I get the error: "Only a type can be imported. com.adobe.cq.TestServiceImpl resolves to a package in adobe day cq5
    I have created one bundle and installed in felix console. The status of the bundle is also Active. And also it is available in both service and component console.
    Here is my TestServiceImpl class in com.adobe.cq bundle
    package com.adobe.cq;
    import org.apache.felix.scr.annotations.Component;
    import org.apache.felix.scr.annotations.Service;
    import org.osgi.framework.BundleContext;
    import org.osgi.service.component.ComponentContext;
    import javax.jcr.RepositoryException;
    import org.apache.felix.scr.annotations.Property;
    import org.apache.felix.scr.annotations.Properties;
    //src.component
    //declares the class component. This will provide a wrapped ManagedService component in the OSGI container.
    //src.service interface="SampleService"
    //declares the service we are offering. Actually, the interface attribute is superflous, as by default, all implemented Interfaces are used.
    @scr.component
    @scr.service interface="testService"
    @Component(immediate = true, metatype = true)
    @Service
    @Properties( {
    @Property(name = "service.description", value = "abcd"),
    @Property(name = "label", value = "myLabel") })
    public class TestServiceImpl implements TestService {
    public String sayHello() {
         return "Hello World!";
    Here is my jsp code
    <%@include file="/libs/foundation/global.jsp"%><%
    %><%@include file="/apps/mine/includes/functions.jsp"%><%
    %><%@ page import="com.adobe.cq.TestServiceImpl,
    org.apache.sling.api.SlingHttpServletRequest,
                    java.util.List"%><%
    %><%
    SlingHttpServletRequest r = (SlingHttpServletRequest)request;   
                    TestServiceImpl testService = sling.getService(TestServiceImpl.class);
                    out.println("testService:::"+testService);
    %>
    <div id="te-nav" style="display:block !important;">
    </div>
    Is it because of am using annotation in TestServiceImpl class?
    Could you please tell me how to fix it?
    Regards,
    Anderson

    Hi Pawan,
    Thanks for your information. It was problem with my pom.xml It started to work after changing my POM.xml
    I am not able to get sling service for TestServiceImpl. But I am only able to create TestService which is my interface. I need to get reference for TestServiceImpl class not for TestService interface. Please help me to make it.
    i have created TestServiceImpl and TestService class for testing whether my bubdle is crating all the folder structure or not.
    But my requirement is like assume class A has some methods like getMenuLink, setMenuLink.. And In class B i am calling some methods in class A and doing some manipulation in createLink method.
    Here class B does not have any interface. Not implementing  any interface. But I need to get class B refererence via sling.getService.
    I know that if we are using maven SCR plugin..we need to have @component, @service. And All java classes are not services. Will it work if I add activate, deactivate method in class B?
    Could you please tell me how to proceed next?
    Thanks,
    Anderson

  • Exception in Loading Images in JSP pages

    Hi All,
    I am trying to load an image many number of times(to create a sort of graph).
    I am using Buffered Image & Graphics.drawImage().Still when my page loads I can see only the lines I draw btween the images but not the images.The images are seen only on refresh.
    I get Illegal State Exception ServletHttpResponse.getWriter().
    Can anyone help me with this at the earliest
    THANKS

    Hi,
    Here is part of my code:
    image= new BufferedImage(1000,img_height, BufferedImage.TYPE_INT_RGB);
    grph=image.getGraphics();
    Then in for loop i execute the following ,changing the co-ordinate,required no of times.
    grph.drawImage(myImage,xCord,yCord,xBlock,yBlock,null);
    Finally I do this:
    ServletOutputStream out1 = response.getOutputStream();
    JPEGImageEncoder encoder= JPEGCodec.createJPEGEncoder(out1);
    encoder.encode(image);
    The page that has this code is called by another jsp in the image tag.<img src="drawimage.jsp">
    Please Reply

  • Throws Exception when jdbc connect to Oracle

    Hi! I'm waiting for your answers.
    When i use jdbc to connect Oracle,system throws exceptions as follows:
    java.lang.ClassCastException: oracle.sql.converter.CharacterConverter12Byte
    oracle.sql.CharacterSet1Byte oracle.sql.CharacterSet1Byte.getInstance (int,racle.sql.converter.CharacterConverter)
              CharacterSet1Byte.java:82
         oracle.sql.CharacterSet oracle.sql.CharacterSetWithConverter.getInstance(int)     CharacterSetWithConverter.java:85
    I code in Oracle9i Jdeveloper 9.0.2. The Oracle version is 9.0.2.
    My code example is as follows:
    package mypackage2;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public class Class1
    public Class1()
    public static void main(String[] args)
    Class1 class1 = new Class1();
    Connection conn = null;
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    //exception throws in getConnection()
    conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@localhost:1521:CR","system","CR2001");
    catch (Exception e)
    e.printStackTrace();

    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import oracle.jdbc.driver.*;
    public class viewtable
         Connection con;
         Statement st;
         public viewtable (String args[]) throws ClassNotFoundException,FileNotFoundException,IOException,SQLException
         url="jdbc:oracle:thin:system/manager@IP:1521:SID";
         Class.forName ("oracle.jdbc.driver.OracleDriver");
         try
         con=DriverManager.getConnection(url);
              st = con.createStatement ();
              doexample ();
              st.close ();
              con.close ();
         }catch(SQLException e)
              System.err.println(e.getMessage());
         public void doexample () throws SQLException
         ResultSet rs = st.executeQuery("select * from sales");
              if(rs!=null) {
              while(rs.next())
                   int a = rs.getInt("no");                    System.out.println("NO = "+a);
              rs.close();
         public static void main (String args[])
              System.out.println ("Oracle Exercise 1 \n");
              try
                   viewtable test = new viewtable(args);
              } catch (Exception ex)
                   System.err.println ("Exception caught.\n"+ex);
                   ex.printStackTrace ();
    the above is the full code, please check the problem....many thanks

  • How to prevent java.io.exception when someone enters a bogus page in theURL

    Say i have a page called Test.jsp. The user goes to it and everything is fine. If the user happens to play with the url and changes it to Tes.jsp, i get java.io.exception. Is there anyway to catch this?
    This is my error:
    JSP Error:
    Request URI:/page/Tes.jsp
    Exception:
    java.io.FileNotFoundException: page/Tes.jsp
         at java.io.FileInputStream.(FileInputStream.java)
         at oracle.jsp.provider.JspFilesystemResource.fromStream(JspFilesystemResource.java)
         at oracle.jsp.provider.JspFilesystemResource.fromReader(JspFilesystemResource.java)
         at oracle.jsp.app.JspAppLoader.reloadPage(JspAppLoader.java)
         at oracle.jsp.app.JspAppLoader.loadPage(JspAppLoader.java)
         at oracle.jsp.app.JspAppLoader.getPage(JspAppLoader.java)
         at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java)
         at oracle.jsp.JspServlet.doDispatch(JspServlet.java)
         at oracle.jsp.JspServlet.internalService(JspServlet.java)
         at oracle.jsp.JspServlet.service(JspServlet.java)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
         at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
         at org.apache.jserv.JServConnection.run(JServConnection.java:188)
         at java.lang.Thread.run(Thread.java)
    Thanks in advance
    Adam

    Most JSP servers have a configuration option to serve
    up an error page in situations like this. Yours
    probably does too.Once you find that, make it your error page with a page directive of isErrorPage="true". Then you have access to the implicit exception variable name to determine if it is really a 404 exception.

Maybe you are looking for