Response.sendRedirect() problem

Hi all,
I in facing a problem during using response.sendRedirect() or there is some mistake, please help me...
I have written two jsp files:
i.e. first.jsp and second.jsp
FIRST.JSP is as follwing:
<%@ page import="java.io.*" %>
<%
     response.sendRedirect("http://192.168.0.4:9999/mylogo/second.jsp");
%>
and SECOND.JSP is as follows:
<%@ page import="java.io.*" %>
<%
     String coding=request.getParameter("name").trim();
%>
     My name is <h1><%= coding %></h1>
but when i write the follwing in address bar:
http://localhost:9999/mylogo/first.jsp?name=jake
an error occurs:
NullPointerException messae is received. I am using Apache Tomcat/4.1.29.
Please help me, and tell if ther is any thing missing in this code....
Thankx in advance...

When you use redirection, you are sending a header back to the browser which tells it to go somewhere else. This results in an entirely new request. Because of this, any request info from the first page will not be in the second. The advantage of redirects is you can tell the browser to go to any other server.
If you want to maintain the same request info, you can use forward. Forward only passes control in the server to another page. The browser will have no idea that this is happening, and it cannot go to another server.

Similar Messages

  • Problem in response.sendredirect()

    Hi
    I am using response.sendredirect() to forword a request to an absolute URL out side my current environment.
    but it's not working....it still tries to process the request in the same environment...
    what can be the problem???

    yes i am passing the absolue URL to the Method.
    "http://blrkec30386:9080/ececWeb/BANKAWAY?Action.Admin.Init=Y&AppSignonBankId=024"
    .

  • Response.sendRedirect(URL), problem if '&' is usd as part of paramete value

    i have to redirect to a page having following URL
    http://www.citease.com/afc/d&o_coverage.htm
    now & is part of value rather than a separater of parameters.
    whenever i redirect it as
    strURL = "http://localhost:8080/cms/redirector.jsp?ckUrl=http://www.citease.com/afc/d&o_coverage.htm";
    response.sendRedirect(strURL);
    it will not work properly, will try to access only
    http://www.citease.com/afc/d
    Please help.
    Best regards,
    Waseem Aslam

    Encode the URL, the & should be & amp;.
    You may find the URLEncoder useful.

  • Response.sendRedirect doesn't work

    Hi,
    I implemented the post authentication class. I added some code to the onLoginFailed method and i am trying to redirect user for my own page and not the standard error page of opensso (IdP). When using response.sendRedirect("/my_page") i got an error message telling me that redirection has failed because record already committed.
    I think the problem is due to the original redirection done by the IdP, isn't it? Is there a solution to redirect user for my own login failure page?
    Thanks.

    How about this.
    Do a combination of the two.
    Use the post auth plugin to do your work with LDAP it has access and has all the needed information.
    Add the attributes to the ?session?header? in the post auth plugin maybe?
    Use the default failrue url you are sending them to to pull the info out of the session headers and do whatever is needed at that point?
    I would try just populating one attribute first and redirecting using the default failure url to some simple page that prints out to validate if it would work.
    J

  • Response.sendRedirect() doesn't work immediately

    Hello,
    I'm moving my application to JDK 1.4 and IAS 10g.
    It's alright, but I noticed one problem.
    For long operation I created my way to display a "Working..." page.
    I use response.sendRedirect() to an HTML page, with the "Working..." message, that reload itself every five seconds (due to the fact that the message will be replaced, as I explained later).
    Once the operation has terminated it change a session variable that is loaded by the HTML page and it replace the "Working..." message with a "Done!" message.
    The problem is that in IAS 10g it doesn't redirect to the HTML file immediately, it seems that "wait" the operation is almost finished: il redirect to the HTML file displaying "Working...", and after the first reload of the page (5 seconds) it display "Done!".
    This is the part of the code:
    String urlToLoad = "/myApp/tools/template/cache/tempxyz.html";
    // SESSION VALUE: "Working..."
    response.sendRedirect(urlToLoad);
    response.flushBuffer();
    // OPERATIONS
    // CHANGE SESSION VALUE WITH "Done!"
    // END OF METHODThe "response.sendRedirect(urlToLoad);" instruction is executed without any error.
    I also tried to use the absolute path with "http://name_server", but it still doesn't work.
    I hope I explained my situation.
    I already read many post in this and others forums, but I didn't found any working solution.
    Thanks in advance for any suggestions,
    EP

    You could try putting your operations into a new thread... but I don't see why that would be necessary...
    String urlToLoad = "/myApp/tools/template/cache/tempxyz.html";
    // SESSION VALUE: "Working..."
    response.sendRedirect(urlToLoad);
    response.flushBuffer();
    Thread t = new Thread( new Runnable() {
      public void run() {
        // OPERATIONS
         // CHANGE SESSION VALUE WITH "Done!"
    t.start();
    // END OF METHOD(Or put the operations in a method in another class that implements the Runnable interface, ... whatever)

  • Response.sendRedirect doesn't work with IAS 10g

    Hello,
    I'm moving my application to JDK 1.4 and IAS 10g.
    It's alright, but I noticed one problem.
    For long operation I created my way to display my "Working in progress..." page.
    I create an HTML file into a cache folder and I redirect to that file that reload itself every five seconds.
    Once the operation is terminated it change a session variable that is loaded by the HTML page and it ends the "Working in progress..." message.
    The problem is that in IAS 10g it doesn't redirect to the HTML file immediately, it seems that "wait" the operation is almost finished: il redirect to the HTML file, and after 5 seconds it loads the end message of the operation.
    This is the part of the code:
    [WRITE FILE IN c:\application\tools\template\cache as tempxyz.html]
    String urlToLoad = "/myApp/tools/template/cache/tempxyz.html";
    response.sendRedirect(urlToLoad);
    [OPERATIONS]
    [CHANGE SESSION VALUE]
    -END-
    The "response.sendRedirect(urlToLoad);" instruction pass without errors.
    I hope I explained my situation.
    Thanks in advance for any suggestions,
    EP

    Thanks Qiang,
    Ive done exactly as youve said and it must be a rewriting problem as you suggested. Here is the header from accessing the servlet on the Linux host machine (IP 192.168.5.121 called 'BEAST')
    --10:12:27-- http://192.168.5.121:7780/webapp/test
    => `test'
    Connecting to 192.168.5.121:7780... connected.
    HTTP request sent, awaiting response...
    1 HTTP/1.1 302 Moved Temporarily
    2 Date: Wed, 11 May 2005 09:12:27 GMT
    3 Server: Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server
    4 Content-Length: 183
    5 Cache-Control: private
    6 Location: http://BEAST:7779/webapp/testJ.jsp
    7 Keep-Alive: timeout=15, max=100
    8 Connection: Keep-Alive
    9 Content-Type: application/octet-stream
    Location: http://BEAST:7779/webapp/testJ.jsp [following]
    --10:12:27-- http://beast:7779/webapp/testJ.jsp
    => `testJ.jsp.3'
    Resolving beast... done.
    Connecting to beast[127.0.0.1]:7779... connected.
    That worked fine. Here is the header on my windows machine on the network ( IP 192.168.5.120) :
    HTTP/1.1 302 Moved Temporarily
    Date: Wed, 11 May 2005 09:03:21 GMT
    Server: Oracle-Application-Server-10g/10.1.2.0.0 Oracle-HTTP-Server
    Content-Length: 183
    Cache-Control: private
    Location: http://BEAST:7779/webapp/testJ.jsp
    Keep-Alive: timeout=15, max=100
    Connection: Keep-Alive
    Content-Type: application/octet-stream
    I think the problem must be that the response is telling it to redirect to BEAST (which is the name of the server) but the windows box cant resolve the name. Must be why i get the page cannot be displayed.
    The code in the servlet 'test' to redirect is just:
    response.sendRedirect("testJ.jsp");
    Any ideas would be much appreciated on how I can fix this other than setting up a local DNS server?!
    Cheers,
    Rob.

  • Response.sendRedirect is not working for IE5.5

    Hi All,
    I am using response.sendRedirect method to go to different page from jsp file. It was working file before IE was upgraded to version 5.5. It is still working fine with Netscape.
    With IE, it remains on the same page even after executing response.sendRedirect method. IT ACTUALLY GOES TO ANOTHER PAGE AFTER SELECTING REFRESH. Could this be a CACHE problem. However, I tried to append the URL with some random number every time it executes response.sendRedirect method just to make it a different URL and still getting the same result.
    Any Help will be greatly appreciated.
    Thanks.

    Every time I clear the History Cache, It works for the first time and after that it remains on the same page.
    I tried to set the days to store the hist pages as 0.
    please let me know if any other browser settings OR program changes required.
    Thanks.

  • Is it a bug in WLS6.0 of response.sendRedirect()?

    I got a very strange problem that I found that the code like that:
              response.sendRedirect("../error/error.jsp?url=../hello.jsp&err=hello");
              runs well, but the code like that:
              response.sendRedirect("../error/error.jsp?url=../../hello.jsp&err=hello");
              doesn't work, WLS tells me page not found! Its mean WLS can't go back more than one lever directory!! It's not fun!! Can somebody help me?
              

    Where can I download my test ear file.
    Any way I am keep my source here.
    My Servet Source
    =============================================
    package com.ritesh.tempwork;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    public class MyServlet extends HttpServlet {
    * Initialize global variables
    public void init(ServletConfig config) throws ServletException {
         super.init(config);
    * Service the request
    public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         //getAction
         request.setAttribute("result",new ActionResult());
         this.getServletContext().getRequestDispatcher("/test.jsp").forward(request, response);
    * Get Servlet information
    * @return java.lang.String
    public String getServletInfo() {
         return "com.aclcargo.servlet.ActionMultiplexer Information";
    * Insert the method's description here.
    * Creation date: (7/13/2001 5:30:57 PM)
    public void destroy()
    ====================================================
    My Action Result class
    =====================================================
    package com.ritesh.tempwork;
    i[i]Long postings are being truncated to ~1 kB at this time.

  • In Servlet, response.sendredirect using iPlanet

    I'm from INIDIA. I have some problem in using response.sendRedirect. I'm using iPlanet application server. I tested on Java Web Server and it's working fine there but please advice me, how it'll work on iPlanet.
    Thanks

    Should work the same way. If you have an actual problem when you try it, let us know.

  • How to handle response.sendRedirect(url) in a portlet w/ webflow?

    I am using a webflow to navigate within a portlet. There are three jsp pages or
    nodes in the portlet. One of the jsp pages has the following logic:
    if (A) { response.sendRedirect(url1)}
    else if(B) { response.sendRedirect(url2)}
    else{display rest of this jsp page}
    I think I have the correct portlet urls. I used WebflowJSPHelper.createWebflowURL(...).
    The problem is when it tries to redirect, the whole portlet disapears leaving
    only the title bar. I check the weblogic log file and there is an exception about
    RuleSetNotFoundException. Does anybody know how to handle this problem? Can
    I use sendRedirect method in a portlet?
    thanks,

    Go to dev2dev.bea.com source code library and copy the redirect sample code in
    your application domain. This program expects you to make come changes in the
    portal workflow.
    ciao
    "Edoardo Boechat" <[email protected]> wrote:
    >
    Dear James,
    Maybe I'll be boring, but I'll give you my expirience with "sendRedirect".
    When you use sendRedirect you send back to the browser a new URL that
    him will
    use to obtain the content that will be exposed, in other words, It's
    a client
    side operation.
    The portlet machanism work on the server side of the application. So
    why you are
    using sendRedirect? If one of that conditions happen, are you interesting
    in expose
    a content of another web site?
    If you want to expose the content of another web site, use the wizard
    to generate
    a example jsp page who do this correct in a portlet and adapt the code
    to your
    situation.
    Otherwise, you are using a wrong concept. If it's a server side operation
    you
    need to use "forward" or "include" operation to do what you want.
    I expect be helpfull,
    Edoardo Boechat.
    "James" <[email protected]> wrote:
    I am using a webflow to navigate within a portlet. There are threejsp
    pages or
    nodes in the portlet. One of the jsp pages has the following logic:
    if (A) { response.sendRedirect(url1)}
    else if(B) { response.sendRedirect(url2)}
    else{display rest of this jsp page}
    I think I have the correct portlet urls. I used WebflowJSPHelper.createWebflowURL(...).
    The problem is when it tries to redirect, the whole portlet disapears
    leaving
    only the title bar. I check the weblogic log file and there is an exception
    about
    RuleSetNotFoundException. Does anybody know how to handle this problem?
    Can
    I use sendRedirect method in a portlet?
    thanks,

  • Response.sendRedirect() from doEndTag() method

    Hi there,
    I am trying to call response.sendRedirect("url") in a custom tag doEndTag() method but for or some reason I cannot get access to the javax.servlet.http.HttpServletResponse object where this method lives. Does anyone know how I can do a response.redirect from a doEndTag() method? I've searched the forum and it appears other people can do it but I'm not sure how?
    I can get access to javax.servlet.ServletResponse object by using pageContext.getResponse() but that doesn't give me the response.sendRedirect method. Can anyone help? What am I doing wrong?
    Thanks for your help.
    Cheers,
    Brent.

    you can pass the response object as argument to your
    method..Thanks for your response!
    Unfortunately I can't change the doEndTag() method parameters as doEndTag() is defined in the Tag interface. But if you mean pass the response object as an attribute of the tag i suppse that is possible.
    However, that's pretty close to the hack I currently have to work around this problem except I'm putting the response object in a request attribute in the page and then retrieving it in the doEndTag() method.
    But I am after something a little cleaner than either of these options..... I'm hoping I can just get the response object from another object I have access to. Any more thoughts?

  • Weblogic 6.0 (SP2) generates incorrect java code for JSP with response.sendRedirect()

              Hi,
              Here are the steps to reproduce the problem with the examplesWebApp application
              bundled with wlserver6.0(sp2):
              Product: Weblogic server 6.0 (sp2)
              Browser: IE 5.0
              1. Add index.jsp as the welcome file in WEB-INF/web.xml
              2. Create index.jsp as below:
              <%
              response.sendRedirect("index.html");
              return;
              %>
              <html>
              <head>
              <title>Index JSP file</title>
              </head>
              <body>
              <font color="red">This is index.jsp file </font>
              </body>
              </html>
              3. Create index.html as below:
              <html>
              <head>
              <title>Index HTML file</title>
              </head>
              <body>
              <font color="red">This is index.html file </font>
              </body>
              </html>
              4. Run the examples server and make sure examplesWebApp is deployed on the examples
              server using the console
              5. Access the URL http://localhost:7001/examplesWebApp
              The page will display a compilation error as below:
              C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
              unreachable statement
              out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
              color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              ^
              and a look at the generated java code for index.jsp (_index.java) will reveal
              the erroneous code snippet below in the jsp service method:
              try { // error page try block
              //[ /index.jsp; Line: 1]
              response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
              return; //[ /index.jsp; Line: 3]
              out.print("\r\n<html>\r\n<head>\r\n<title>Simple html</title>\r\n</head>\r\n<body>\r\n<font
              color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              } catch (Exception __ee) {
              while (out != null && out != _originalOut) out = pageContext.popBody();
              pageContext.handlePageException(__ee);
              The above web application works fine in Tomcat 3.2.X environment. The Weblogic
              server 6.0 servlet engine should not generate the "out.println()" corresponding
              to the html section of index.jsp. The moment it sees the "return", it should stop
              processing further.
              Can someone from Weblogic support team please verify this and let me know when
              this bug will be fixed?
              One interesting thing I noticed was when we last tried weblogic 6.0 at its beta
              stage, it worked fine after we put in a special patch jar file called "redirectfix.jar"
              we received from weblogic team but somehow it got re-introduced by the time it
              was released!!
              We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0. Our
              product has a lot of pages with such conditional {response.sendRdirect("page.jsp");return;}
              blocks. We would really appreciate a faster response form weblogic team.
              Thanks in advance.
              sam...
              Sam Palanisamy
              Senior Software Engineer
              Manage.com
              2345 N. First Street First Floor
              San Jose CA 95131
              

    Why should it stop when it sees a return? Is that in the spec?
              Peace,
              Cameron Purdy
              Tangosol Inc.
              << Tangosol Server: How Weblogic applications are customized >>
              << Download now from http://www.tangosol.com/download.jsp >>
              "Sam Palanisamy" <[email protected]> wrote in message
              news:[email protected]...
              >
              > Hi,
              >
              > Here are the steps to reproduce the problem with the examplesWebApp
              application
              > bundled with wlserver6.0(sp2):
              >
              > Product: Weblogic server 6.0 (sp2)
              > Browser: IE 5.0
              >
              > 1. Add index.jsp as the welcome file in WEB-INF/web.xml
              >
              > 2. Create index.jsp as below:
              > <%
              > response.sendRedirect("index.html");
              > return;
              > %>
              > <html>
              > <head>
              > <title>Index JSP file</title>
              > </head>
              > <body>
              > <font color="red">This is index.jsp file </font>
              > </body>
              > </html>
              >
              > 3. Create index.html as below:
              > <html>
              > <head>
              > <title>Index HTML file</title>
              > </head>
              > <body>
              > <font color="red">This is index.html file </font>
              > </body>
              > </html>
              >
              > 4. Run the examples server and make sure examplesWebApp is deployed on the
              examples
              > server using the console
              >
              > 5. Access the URL http://localhost:7001/examplesWebApp
              >
              > The page will display a compilation error as below:
              >
              C:\bea\wlserver6.0\config\examples\applications\examplesWebApp\WEB-INF\_tmp_
              war_examplesServer_examplesServer_examplesWebApp\jsp_servlet\_index.java:89:
              > unreachable statement
              > out.print("\r\n<html>\r\n<head>\r\n<title>Simple
              html</title>\r\n</head>\r\n<body>\r\n<font
              > color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              > ^
              >
              > and a look at the generated java code for index.jsp (_index.java) will
              reveal
              > the erroneous code snippet below in the jsp service method:
              >
              > try { // error page try block
              >
              > //[ /index.jsp; Line: 1]
              > response.sendRedirect("index.html"); //[ /index.jsp; Line: 2]
              > return; //[ /index.jsp; Line: 3]
              > out.print("\r\n<html>\r\n<head>\r\n<title>Simple
              html</title>\r\n</head>\r\n<body>\r\n<font
              > color=\"red\">This is index.jsp page</font>\r\n</body>\r\n</html>\r\n");
              > } catch (Exception __ee) {
              > while (out != null && out != _originalOut) out =
              pageContext.popBody();
              > pageContext.handlePageException(__ee);
              > }
              >
              > The above web application works fine in Tomcat 3.2.X environment. The
              Weblogic
              > server 6.0 servlet engine should not generate the "out.println()"
              corresponding
              > to the html section of index.jsp. The moment it sees the "return", it
              should stop
              > processing further.
              >
              > Can someone from Weblogic support team please verify this and let me know
              when
              > this bug will be fixed?
              >
              > One interesting thing I noticed was when we last tried weblogic 6.0 at its
              beta
              > stage, it worked fine after we put in a special patch jar file called
              "redirectfix.jar"
              > we received from weblogic team but somehow it got re-introduced by the
              time it
              > was released!!
              >
              > We are planning to migrate our product from tomcat 3.2.x to weblogic 6.0.
              Our
              > product has a lot of pages with such conditional
              {response.sendRdirect("page.jsp");return;}
              > blocks. We would really appreciate a faster response form weblogic team.
              >
              > Thanks in advance.
              > sam...
              > Sam Palanisamy
              > Senior Software Engineer
              > Manage.com
              > 2345 N. First Street First Floor
              > San Jose CA 95131
              >
              >
              

  • Response.sendRedirect doesn't work with Internet Explorer

    I do posts like advised here: http://www.theserverside.com/tt/articles/article.tss?l=RedirectAfterPost. GET-POST-REDIRECT-GET. Now I have a problem when do redirecting to the same page in Internet Explorer. It works good with Mozilla Firefox but not with Internet Explorer. When user click to "Enable"/"Disable" link and do submit, application makes changes on the database. Changes occurs, but redirect to the page doesn't work. When I refresh page, I see that, the changes was occurred. When I use Mozilla Firefox with same JSP, there is no need to refresh page, because, redirect works. When I change redirect URL to other, for example http://www.google.com/, redirect doesn,t work in Internet Explorer too.
    Code of users.jsp JSP:
    <%@ page import="az.ub.ccs.beans.User" %>
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ page errorPage="error.jsp" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <jsp:useBean id="bc" scope="page" class="az.ub.ccs.beans.BreadCrumb" />
    <jsp:useBean id="user" scope="request" class="az.ub.ccs.beans.User"/>
    <c:if test="${sessionScope.active == null}"><c:redirect url="login.jsp" /></c:if>
    <%
       if(request.getParameter("stateAction") != null)
          int state = (request.getParameter("stateAction").equals("enable")) ? 0 : 1;
          User.changeUserState(Integer.parseInt(request.getParameter("itemID")), state);
          response.sendRedirect("users.jsp");
          //response.setStatus(HttpServletResponse.SC_SEE_OTHER);
          //response.setHeader("Location", "users.jsp");
       bc.add("Users");
    %>
    <jsp:include page="top.jsp" flush="true">
       <jsp:param name="breadCrumbString" value="${bc.breadCrumbsAsHTML}"/>
       <jsp:param name="pageTitle" value="Users"/>
    </jsp:include>
    <tr>
       <td>
          <table border="1" width="100%">
             <tr class="tableHeader">
                <td>ID</td>
                <td>&#1048;&#1084;&#1103; &#1087;&#1086;&#1083;&#1100;&#1079;&#1086;&#1074;&#1072;&#1090;&#1077;&#1083;&#1103;</td>
                <td>&#1051;&#1086;&#1075;&#1080;&#1085;</td>
                <td>&#1053;&#1086;&#1084;&#1077;&#1088; &#1075;&#1088;&#1091;&#1087;&#1087;&#1099;</td>
                <td>&#1053;&#1072;&#1079;&#1074;&#1072;&#1085;&#1080;&#1077; &#1075;&#1088;&#1091;&#1087;&#1087;&#1099;</td>
                <td>Email</td>
                <td>&#1053;&#1086;&#1084;&#1077;&#1088;</td>
                <td colspan="2">&#1044;&#1077;&#1081;&#1089;&#1090;&#1074;&#1080;&#1077;</td>
             </tr>
             <c:forEach items="${user.userList}" var="user">
             <tr>
                <td align="right">"${user.userID}"</td>
                <td><c:out value="${user.userName}"/></td>
             </c:forEach>
             <tr>
                <td colspan="7"> </td>
                <td colspan="2"><a href="addEditUser.jsp">[Add new]</a></td>
             </tr>
          </table>
          <form name="stateForm" method="post" action="users.jsp">
             <input type="hidden" name="itemID"/>
             <input type="hidden" name="stateAction"/>
          </form>
       </td>
    </tr>
    <jsp:include page="bottom.jsp" flush="true"/>

    I use HttpWatch to see request and response details. Link to the report file of HttpWatch http://tasadar8.googlepages.com/CCSHttpWatch.rar

  • 6.1 SP5: response.sendRedirect crashes

    Hi all,
    I am porting a JSP app from Iplanet 4.1 to SunONE 6.1 SP5 (Solaris 5.9).
    When I try to do the above statement in a JSP, I get the following in the error log:
    [14/Jun/2007:16:05:05] failure ( 3812): for host 172.16.10.184 trying to POST /jspcontent/ozbet.jsp;jsessionid=43DBC3EA6343C4B0E3BF6AD26B943D25, service-j2ee reports: StandardWrapperValve[jsp]: WEB2792: Servlet.service() for servlet jsp threw exception
    java.lang.IllegalStateException
    at org.apache.catalina.connector.HttpResponseFacade.sendRedirect(HttpResponseFacade.java:179)
    at jsps.jspcontent._ozbet_jsp._jspService(_ozbet_jsp.java:109)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:687)
    at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:459)
    at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:375)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
    I am not sure what I need to declare differently in 6.1. The web app jars are in WEB-INF/lib under the docroot.
    The code in the JSP is pretty standard, but ran under Iplanet 4.1.
    try {
         String URL = "https://www.ozbet.com.au/tab/ozbet.htm?p_date=" //has parameters;
    response.sendRedirect(URL);
    catch (ApplicationException e) {
         //do some stuff here
    %>
    <b>ERROR:</b> <%= msg %>"
    <%
    FYI the webapp is working fine wrt to jdbc, jsp etc. It is just the sendRedirect() that is crashing.
    Do I need to declare anything related to NSAPI in obj.conf ?
    Please help and thanks in advance.
    Richard
    Message was edited by:
    r_defonseka
    Message was edited by:
    r_defonseka

    That's not a crash. HttpServletResponse.sendRedirect is throwing an IllegalStateException because you called it after the response had been committed. This is a documented part of the Servlet spec. (See, for example, http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletResponse.html#sendRedirect(java.lang.String) for the the J2EE 1.3 docs.)
    The most likely problem is that you're calling sendRedirect after an include or after outputting too much data. If you're going to call sendRedirect, you need to do so near the top of your JSP file, before you output a lot of data. Once data has been sent to the client, there's no way for the server to say "oops, never mind, ignore that data and redirect over here instead".

  • Certificate in struts response.sendRedirect.

    Hi,
    First of all, sorry because my english.
    In my application (I use Struts v1 ) I nedd to redirect the user to an external url. And I have to send a certificate in this redirect.
    This is my code:
              System.setProperty("javax.net.ssl.keyStore", "my_cert.pfx");
              System.setProperty("javax.net.ssl.keyStorePassword","password");
              System.setProperty("javax.net.ssl.keyStoreType", "PKCS12");
              System.setProperty("javax.net.ssl.trustStore", "their_cert.cer");
              response.sendRedirect("https://external_url");but the destination doesn't recieve the certificate. Could be because the way i do the redirection (with response.sendRedirect)?? Somebody can help me, please??
    Thanks and regards

    Should work the same way. If you have an actual problem when you try it, let us know.

Maybe you are looking for