Redirect jsp page problem

          I have problem when I want to redirect a page, inputparam2test.jsp back to the perious
          page, inputparam1test.jsp. Everything works until I
          add a "if" statement in the inputparam1test.jsp.
          The error is "Error 500--Internal Server Error".
          Can anybody help me out? Thanks a lot!
          inputparam1test.jsp:
          <html>
          <head>
          <title>create a patameter input form</title>
          </head>
          <body>
          <%!
          String dataset;
          String modeltype;
          %>
          <%
          dataset = request.getParameter("dataset");
          modeltype = request.getParameter("modeltype");
          %>     
          <center>
          <form action="inputparam2test.jsp" method="post">
          <table cellspacing=10>
          <tr>
          <td colspan=2>
                    Please enter model parameters
               </td>
               </tr>     
          <tr>
               <td>
                    Dell LRI
               </td>
               <td>     
                    <select name="DellLRI">
                    <option value="1">1
                    <option value="0">0
                    </select>
               </td>
               </tr>
               <%
               if(modeltype.equals("Direct")) {
          out.println("in if");
          %>
               <tr>
               <td>
               </td>
               <td>     
                    <input type="submit" value="Next>" name="Next>">
               </td>
               </tr>
          </form>
          </center>
          </body>
          </html>
          inputparam2test.jsp:
          <html>
          <head>
          <title>continue input parameters </title>
          </head>
          <body>
          <%
          response.sendRedirect("inputparam1test.jsp");
          %>
          </body>
          </html>
          

You do not check if the modelType is null and
          if(modeltype.equals("Direct")) {
          out.println("in if");
          will result in a NullPointerException when it is null.
          Almond Huang <[email protected]> wrote:
          > I have problem when I want to redirect a page, inputparam2test.jsp back to the perious
          > page, inputparam1test.jsp. Everything works until I
          > add a "if" statement in the inputparam1test.jsp.
          > The error is "Error 500--Internal Server Error".
          > Can anybody help me out? Thanks a lot!
          > inputparam1test.jsp:
          > <html>
          > <head>
          > <title>create a patameter input form</title>
          > </head>
          > <body>
          > <%!
          > String dataset;
          > String modeltype;
          > %>
          > <%
          > dataset = request.getParameter("dataset");
          > modeltype = request.getParameter("modeltype");
          > %>     
          > <center>
          > <form action="inputparam2test.jsp" method="post">
          > <table cellspacing=10>
          > <tr>
          > <td colspan=2>
          >           Please enter model parameters
          >      </td>
          >      </tr>     
          > <tr>
          >      <td>
          >           Dell LRI
          >      </td>
          >      <td>     
          >           <select name="DellLRI">
          >           <option value="1">1
          >           <option value="0">0
          >           </select>
          >      </td>
          >      </tr>
          >      <%
          >      if(modeltype.equals("Direct")) {
          > out.println("in if");
          >      }
          > %>
          >      <tr>
          >      <td>
          >      </td>
          >      <td>     
          >           <input type="submit" value="Next>" name="Next>">
          >      </td>
          >      </tr>
          > </form>
          > </center>
          > </body>
          > </html>
          > inputparam2test.jsp:
          > <html>
          > <head>
          > <title>continue input parameters </title>
          > </head>
          > <body>
          > <%
          > response.sendRedirect("inputparam1test.jsp");
          > %>
          > </body>
          > </html>
          Dimitri
          

Similar Messages

  • Http 500 error when redirecting jsp pages

    hello all
    I hava a strang problem.My application is running on Apache tomcat 5.0 with the database MYSQL as back end. front end i use jsp techonology.
    when i am running in localhost the site works fine in fedora .
    But once i connect the site to something like www.baraginings.com.au i get http500 error when i am tring to redirect my pages.
    As far as i concerns the problem comes with this statment.
    response.sendRedirect("register.jsp");
    big help is needed to slove this problem
    thanks in advance
    /prash

    A 500 error usually means a runtime exception in the called JSP/Servlet.

  • History problem in jsp page,internet explorer back button

    hi everyone
    i have a jsp page suppose a.jsp.in which i am using dropdown menu to displays:list of data from database,one submit button i am using name select and click here.after selecting the value from dropdown menu ,again some other data will be displayed from some other table in same a.jsp page.
    my problem is:
    when user selects one value from drop down menu ,it is diplaying the value in same page .upto here is ok
    and i click back button from I.E only one page back it is showing
    but when user select the value form drop down menu 2nd time ,and after data get dipalyed in same apge a.jsp.then
    whne i click back button ,now it is showing two a.jsp page .history is not going .
    this is the problem.i dont want to this morw than one page get displayed in back button.only one page a.jsp
    if anyone has understood my problem ,please help.
    thanku

    thanks java2006
    but it is not working .i will try to explain once again
    1. one page called a.jsp.this page contains one drop drown menu list box ,and one submit button.
    2.data in drop dropdown is coming from db.as the user select value from drop down box .relalted value is diplayed on same a.jsp page.
    3.again user select the 2ndvalue from drop down box ,related value is displayed.
    this i explained about my a.jsp page.
    problem is
    4.when user select the 1st value and clcik on submit button related value is displaying.upto here its ok.and in back button of Internet explorer it is showing only one a.jsp page
    5.but whenever i am trying to see 2nd or 3rd or more value from drop down after related value is being diplayed in same a.jsp page.
    the back button of internet exlorer showing two a.jsp page after clcicking submit button
    .as u have told the code aso but it is not working
    i have added ur code indisde html tags .

  • Java.lang.NullPointerException warning beside components on ADF JSP page

    java.lang.NullPointerException warning beside components on ADF JSP page problem
    Hello
    i developed a web application with the help of the Adf technology On jdeveloper 10.1.3.3.0 . Everything is Ok.
    But when i use application sometimes on the page i take a java.lang.NullPointerException warn beside the some components like a inputbox or a radio button ..)
    i looked the logs but nothing.
    How can i solve this problem.
    Have you got any idea?

    Hi,
    it's the validator property on inputText components that causes it. not validation or StateValidation or EnableTokenValidation.
    Paste your inputText source from the page if you are not sure.
    Brenden

  • 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

  • Redirection to JSP page from Applet not working...

    Hello,
    I have some JSP pages that obtain information and set session variables. Once they have gotten the information, they call an applet to perform some processing, then the applet redirects back to the calling page. My problem is that when the applet redirects using
    getAppletContext().showDocument(reportJspUrl, "_self");
    it seems to be unable to see the session variables that I set in the beginning - consequently I am getting a faulty session timeout error. Has anyone seen this problem? I don't understand why it is happening. It seems that when the applet causes the page to be shown, the page should be able to see the session since it is in the same browser, even in the same frame of the browser.
    Thank you for your help in advance.
    Ali

    Have you tried getting the session in the jsp with req.getSession(false) and confirming that the session returned is not null.

  • Redirect a page with JSP

    Hi there,
    How do you redirect a page using JSP. For example I create a login screen and once a user click on the login button it goes to validate page and validate the userID and password. If the userID and password is correct I want to redirect to the application else redirect to a Fail login screen.
    Thanks in advance with any help.
    Nite()
    null

    Hi Slag,
    Thanks for your help, it work. Now another problem is I am trying to write a code that validate the password and it didn't check the request.getParameter. Here are the following code:
    <% if (request.getParameter("password") == null) { %>
    <jsp:forward page="LoginFailed.jsp" />
    <% } else { %>
    <%@ include file="untitled1.jsp" %>
    <%
    %>
    If I run the response page(current page) it work, it actually see it null and populate the LoginFailed.jsp page, but when I run the login page and it didn't check against the statement.
    Thanks in advance,
    Nite()
    null

  • Problem in sending Input to next JSP page

    Hi all,
    i am having problem with some JSP code. I have a JSP page that take some user input and send it to the next page. Now in those inputs there are some input fileds that needs to be added by the user if he wants to submit those input otherwise he can send the other default inputs. Now the problem is i have some String Array variable for those optional inputs in the next JSP page where they will be redirected. Now if i want to send input other than those optional ones then i get errors saying:
    org.apache.jasper.JasperException
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:367)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    root cause
    java.lang.NullPointerException
         org.apache.jsp.store_jsp._jspService(store_jsp.java:85)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:856)I tried to test the empty string on that page as well but it failed. Please help me

    if (request.getParameter("yourParameter") != null)
    use the variable
    else
    ignore the variable or assign a default value
    Also be careful with
    String yourSingular = request.getParameter("yourParameter");
    String[] yourArray = request.getParameterValues("yourArray")
    String newSingular = yourSingular;
    String fromYourArray = yourArray[0];

  • Problem in custom jsp page when pressing enter button

    Hi to all,
    <pre>
    I am created a cutom jsp page. When i am clicking on a button it working fine, but if i am pressing
    Enter key it redirecting to home page and showing an exception in cosole.
    <b>Exception is </b>
    18:00:50,718 ERROR [WEBAPP] Class/Method: tcActionBase/execute encounter some problems: {1}
    java.lang.NullPointerException
    at com.thortech.xl.webclient.actions.tcLookupDispatchAction.execute(Unknown Source)
    at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
    at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
    at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
    18:00:50,718 ERROR [WEBAPP] Class/Method: tcAction/execute encounter some problems: {1}
    java.lang.NullPointerException
    at com.thortech.xl.webclient.actions.tcActionBase.execute(Unknown Source)
    at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
    at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
    18:00:50,718 WARN [RequestProcessor] Unhandled Exception thrown: class java.lang.NullPointerException
    18:00:50,718 ERROR [[action]] Servlet.service() for servlet action threw exception
    java.lang.NullPointerException
    at com.thortech.xl.webclient.actions.tcAction.execute(Unknown Source)
    at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.thortech.xl.webclient.security.SecurityFilter.doFilter(Unknown Source)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
    </pre>
    Edited by: iceman513 on Aug 11, 2010 7:14 PM
    Edited by: iceman513 on Aug 24, 2010 10:32 AM
    Edited by: iceman513 on Aug 24, 2010 10:33 AM

    once you click a button, say, "Draw Rectangle", it should draw a rectangleYes, but you need to repaint() the component (in your case panel) to see the change.
    The error is: The method paintComponent(Grpahics) is undefined for the type ObjectThe compiler never lies. As far as your code goes, you have added a method paintComponent(...) to a class that implicitly extends Object. Perhaps you wanted to create an anonymous subclass of JPanel.JPanel panel = new JPanel() {
      public void paintComponent(Graphics g) {
        super.paintComponent(g);
        myPaint(g);
    };Note the changes in brace and semicolon placement.
    Also:
    1. You're setting a FlowLayout to a JPanel, which is anyhow the default layout manager. And when using a layout manager, setSize calls are redundant and effectively ignored.
    2. For a JFrame to be centered on the screen, setLocationRelativeTo(null) after setting the size, not before.
    3. To void visual artifacts, setVisible(true) after all other properties are set.
    It looks to me like you've been throwing together bits of code from here and there without adequate understanding. I recommend you go through the Swing tutorials linked from the topic listing page for this forum.
    db

  • Urgent....How can i redirect to my jsp page from servlet in init() method..

    How can i redirect to my jsp page from servlet in init() method..Becoz that servlet is calling while server startsup..so im writing some piece of code in init() method..after that i want to redirect to some jsp page ...is it possible?
    using RequestDispatcher..its not possible..becoz
    RequestDispatcher rd = sc.getRequestDispatcher("goto.jsp");
    rd.foward(req,res);
    Here the request and response are null objects..
    So mi question can frame as how can i get request/response in servlet's init method()..

    Hi guys
    did any one get a solution for this issue. calling a jsp in the startup of the servlet, i mean in the startup servlet. I do have a same req like i need to call a JSP which does some data reterival and calculations and i am putting the results in the cache. so in the jsp there in no output of HTML. when i use the URLConnection i am getting a error as below.
    java.net.SocketException: Unexpected end of file from server
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:707)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:705)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:612)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
    nection.java:519)
    at com.toysrus.fns.alphablox.Startup.callJSP(Unknown Source)
    at com.toysrus.fns.alphablox.Startup.init(Unknown Source)
    at org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
    so plz do let me know how to call a jsp in the start up of a servlet.
    Thanks
    Vidya

  • Problem with displaying BLOB images on JSP page using a servlet

    hi. I have a big problem with displaying BLOB images using JSP. I have a servlet that connects to the oracle database, gets a BLOB image , reads it, and then displays it using a BinaryStream. The problem is , this works only when i directly call that servlet, that is http://localhost:8080/ImageServlet. It doesn't work when i try to use that servlet to display my image on my JSP page (my JSP page displays only a broken-image icon ) I tried several coding approaches with my servlet (used both Blob and BLOB objects), and they work just fine as long as i display images explicitly using only the servlet.
    Here's what i use : ORACLE 10g XE , Eclipse 3.1.2, Tomcat 5.5.16 , JDK 1.5
    here is one of my image servlet's working versions (the essential part of it) :
                   BLOB blob=null;
              rset=st.executeQuery("SELECT * FROM IMAGES WHERE ID=1");
              while (rset.next())
                   blob=((OracleResultSet)rset).getBLOB(2);
              response.reset();
              response.setContentType("image/jpeg");
              response.addHeader("Content-Disposition","filename=42.jpeg");
                    ServletOutputStream ostr=response.getOutputStream();
                   InputStream istr=blob.getBinaryStream(1L);
                    int size=blob.getBufferSize();
              int len=-1;
                    byte[] buff = new byte[size];
                         while ((len=istr.read( buff ))!=-1 ) {
                   ostr.write(buff,0,len);
             response.flushBuffer();
             ostr.close(); and my JSP page code :
    <img src="/ImageServlet" border="0"  > If you could just tell me what i'm doing wrong here , or if you could show me your own solutions to that problem , i would be very greatful ,cos i'm realy stuck here , and i'm rather pressed for time too. Hope someone can help.

    I turns out that it wasn't that big of a problem after all. All i had to do was to take the above code and place it into another JSP page instead of into a servlet like i did before. Then i just used that page as a source for my IMG tag in my first JSP. It works perfectly well. Why this doesn't work for servlets i still don't know, but it's not a problem form me anymore . Ofcourse if someone knows the answer , go ahead and write. I would still appriceatte it.
    here's the magic tag : <img src="ImageJSP.jsp" border="0"  > enjoy : )

  • Problem launching a jsp page with eclipse and tomcat

    Hi,
    I have just started using eclipse and tomcat for creating dynamic web pages. I tried to launch a jsp page after starting the tomcat server with the URL: http://locahost:8080/HelloWorld/, an error page was displayed as below:
    HTTP Status 404 -/
    type Status report
    message /_
    description The requested resource (-) is not available
    Apache Tomcat/5.5.17
    I didn't get any error at the console and when i just typed http://localhost, a pop up menu saying that the connection was refused when attempting to contact localhost.
    I'm not sure what is the problem here. Could it be the permssion to the localhost is not granted by the system as the eclipse IDE is running using linux?
    Hope someone can help.
    Thanks.

    http://www-128.ibm.com/developerworks/library/os-ectom/

  • Problem with onload in jsp page

    Hi all,
    I had two jsp pages, a search and a results page. I need to enter some search criteria in the first page and based on that criteria i will be getting the results in the results jsp. Now, when i click the back button in the results page, i need to go to the search page and the values which i entered in the search page needs to be present there. But the problem is i had a javascript function which runs on loading of the search page. This function will set all the values in this search page to empty whenever we go to the search page. I am calling this javascript function as follows in my search jsp page.
    <body onload="setdefaultvalues('<%=name%>');">
    I am having the code for the back button in the results page as follows.
    <INPUT TYPE="button" VALUE='Back' onClick="javascript:history.go(-1);resetvalue(name);" class="button">
    The problem i am facing is whenever i go to the search page by clicking on the back button, the values in the search page are getting empty because of the onload method. There is no way that i can remove this onload method as i require it for setting the values in the search page evrytime i get to that from other modules as it is the main page for my module. So, is there anyway that i can stop this function from executing when i come from the results page or is there any other way that i can store the values in the search page when going from the results page.

    i think you really should have the result page include your search page contents rather than having the user need to click back as you'll end up with all sorts of nightmares in caching & session object management to be honest. if the search page is complex use javascript to hide contents and let the users expand them when they want to re-search.
    however, if you feel you must i would suggest the following:
    in your result page:
    session.setAttribute("userQuery","true"); (you probably actually want to put a container object with the query information in here)
    in your search page you could have something like:
    <body <% session.getAttribute("userQuery")==null { %>onload="setdefaultvalues('<%=name%>');"<% } %>>
    -or-
    <body onload="setdefaultvalues('<%=name%>',<%=session.getAttribute("userQuery")==null?"true":"false"%>);">
    function setdefaultvalues(name,run) { if ( !run ) return;....}
    you'll have to decide when to remove the object though cause once its set its there until the session expires or you remove it.
    hope that helps, good luck!

  • Problem in passing data from one .jsp page to another .jsp page

    i have a problem here
    Actually i have 2 jsp pages. What im trying to do here is actually i want to pass data from the first jsp page to the second for updating
    The first jsp page contains data that user wants to update in the form of table.
    <td><img src = "edit.gif" alt = "edit" border="0" ><td>
    <TD><%= Name %></td>
    <TD><%= rs.getInt("Age") %></td>
    <TD><%= rs.getString("Gender") %></td>
    So this page displays the data that users wants to update plus one image button (edit button). So when user clicks this button, all the data in this page will be brought to the second .jsp page called updatePersonal for updating.
    The problem here is that it is not displaying the existing data in the second .jsp page.
    The second page basically contains forms
    <INPUT TYPE="text" NAME="FirstName" maxlength="30" value = "<%=FirstName%>">
    Can someone please help me. I really dont know what to do..How do i get the data displayed in the text field that is passed from the first .jsp page..thankx in advance

    Please modify below code to:
    td><img src = "edit.gif" alt = "edit" border="0" ><td>
    -----------------modified code
    td><a href="updatePersonal.jsp?FirstName=<%=rs.getString(FirstName")%">&LastName=<%=rs.getString("LastName")%>&Age=<%=rs.getInt("Age")%>&Gender=<%=rs.getString("Gender")%>"><img src = "edit.gif" alt = "edit" border="0" ></a><td>
    I'm sure it works</a>

  • Forwarding JSP page through requestdispatcher problem in submiting form

    Hello everyone,
    I am very much new to servlet.
    My problem is somewhat this....
    when i am forwarding one JSP page by requestdispather , there is no problem.But after that when i am trying to submit one html form written inside the jsp page , the request is not submiting the jsp page rather it resides in the servlet.
    The code in servlet is
    RequestDispatcher rd =getServletContext().getRequestDispatcher("/applyConfirm.jsp");
    rd.forward(request,response);
    Now in (applyConfirm.jsp )jsp page one button is there , so when i will click that button the page has to be submitted.But its not submitting rather the request resides in the servlet.
    Dose someone will have any idea.
    Thanks in advance

    First check what sort of button you are using. It should be of "submit" type.
    Check the URL to witch URL it is submitting i.e. Action property in <FORM> tag.
    Make sure for the URLs in the client i.e HTML ex: href, action, and so on use the thumb rule of prefixing "<%=request.getContextPath()%>/" in your JSP or in servlet add it in the java code.
    This should solve the relative URL reference problem.
    Hope this helps.
    Cheers.

Maybe you are looking for

  • Dreamweaver cs6 not responding on a mac

    I tried opening dreamweaver cs6 and it never got passed the welcome window. I updated with the latest updates, no change. I reinstalled DW and the same story. My OS is 10.7.5 mountain lion on a quadcore mac pro. Has anyone else have this issue?

  • Text cross references

    Is there a way to use the text that I've selected as the cross-reference text? The text that I've selected does not match the text in the cross-reference header. I've also tried to create a marker with the desired text, but do not know how to use the

  • Library management with external hard drive

    I have a 120GB external hard drive, where I store all of my music, audiobooks, videos, etc. When I created my iTunes library, everything worked great and I loaded my media into my Video iPod. But, the next time I plugged my external hard drive into m

  • Understanding my MP640

    Hi there, I have just been given a Pixma MP640 as it was apparently, not working.  Bought some ink and hey presto, it seems to do what it says on the box. I rarely print my photos, usually submit to photo-libraries, so am a bit of a colour printing r

  • ABAP Developer Key Required to Learn for Beginners?

    Hi, I'm working as a functional consultant in MM, I thought it would be good to start learning ABAP to help me with enhancements, debuggging .. FS creation etc. We have a sandbox system in our company and I wanted to write some code and start learnin