JSP + sendRedirect(URL)

My page use frames. From the main page I am inserting some data into the database using another file. Everything is fine, except that I need to return to the parent frame using the whole window.
What I get is that It returns to the parent frame but the frames use only part of the window (the part of the frame were it was invoked).
I am using sendRedirect(url).
Can anyone tell me how to solve this problem.
Thank you for your help.

If you have a page that can never be in a frame, you can use javascript:
<SCRIPT language="javascript1.1">
if ( self!=top )
    top.location.replace(self.location.href);
    js11 = true;
</SCRIPT>
<SCRIPT language="javascript">
if ( self!=top && !js11)
   top.location.href = self.location.href
</SCRIPT>

Similar Messages

  • Respose.sendRedirect(URL) Vs RequestDispatcher

    if i use respose.sendRedirect(URL) and use request.setAttribute all my variable values are erased. but if i use RequestDispatcher, my page is like in a different directory and messes up all the links for css.. how do you go about this? do you have any solutions for this? and if i am going to use session.setAttribute how when and where do i remove the session values? thanks

    what do you mean by
    Use HttpServletResponse#setAttribute() instead. i have a piece of code that looks like this. is this what you meant?
    private void processRequest(HttpServletRequest request, HttpServletResponse response) {
              Connection con = null;
              HttpSession session = request.getSession();
              String username = request.getParameter("username");
            String password = request.getParameter("password");
            if(username.trim().equals("") || password.trim().equals("")) {
                 errors = "Invalid USERNAME or PASSWORD.";
                   try {
                        session.setAttribute("errors", errors);
                        //request.setAttribute("errors", errors);
                        response.setAttribute();
                        session.setAttribute("username", username);
                        response.sendRedirect("../login.jsp");
                   } catch (IOException e) {
                        e.printStackTrace();
    }

  • 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.

  • 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,

  • Exception on [b]Response.sendRedirect(url)[/b]

    I have 2 pages search page & add page i am getting IllegalStateException when trying to execute the following code
    response.sendRedirect("Add_Employee.jsp");

    @OP:
    response.sendRedirect("Add_Employee.jsp");
    response.sendRedirect(response.encodeRedirectURL("Add_Employee.jsp"));
    @Reply1:
    response.sendRedirect("http://localhost:8080/Add_Emplo
    yee.jsp");It's better not to hard-code the URL in the manner you have specified. It would require frequent change everytime the web application is deployed on a different server, which would mean a loss of portability.
    $

  • Jsp:forward URL problem

    Hi,
    I have 2 pages X.jsp and Y.jsp
    The content of X.jsp is a simple
    // send an email here
    <jsp:forward page="Y.jsp">
    </jsp:forward>
    The content of Y.jsp is only "Mail is sent" message.
    The problem is that everytime page X is loaded,
    the browser displays Y.jsp content, but the URL in the Address box of the browser still displays X.jsp
    This leads me to reload problem, even though the page displays the "Mail is sent" message, the URL still shows X.jsp, and everytime the browser is reloaded, another mail is sent.
    How to make the URL change to Y.jsp ?
    TIA.

    Hi,
    I have 2 pages X.jsp and Y.jsp
    The content of X.jsp is a simple
    // send an email here
    <jsp:forward page="Y.jsp">
    </jsp:forward>
    The content of Y.jsp is only "Mail is sent" message.
    The problem is that everytime page X is loaded,
    the browser displays Y.jsp content, but the URL in the
    Address box of the browser still displays X.jsp
    This leads me to reload problem, even though the page
    displays the "Mail is sent" message, the URL still
    shows X.jsp, and everytime the browser is reloaded,
    another mail is sent.
    How to make the URL change to Y.jsp ?
    TIA.Thats the natural behavious of forward.
    One simple solution is not to use forward. You can use HTTP redirection rather than forward.
    Hope it helps.

  • Can i user response.setStatus(301) and sendRedirect( url ) together ?

    in my redirect page , according to a condition i am setting the status as MOVED_PERMANENTLY on a condition in the same time i am directing this to a different URL
    res.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);
    ((HttpServletResponse)res).sendRedirect(rvo.getToURL());
                                       req.getSession().getServletContext().getRequestDispatcher(rvo.getToURL()).forward(req,res);but every time after redirect it is still throwing 302 ( moved temporarily ) ( i checked this through live HTTP headers )
    can any one please help me

    Sorry Dr Clap,
    I was asking the code if anyone have
    I tried the code below
    response.setStatus(301);
    response.setHeader( "Location", "http://www.new-url.com/" );
    response.setHeader( "Connection", "close" );It is working only for those URLs which has specific file name on it
    for eg :
    http://softwarewip3.corp.emc.com:1001/about_us -- Fails
    http://softwarewip3.corp.emc.com:1001/about_us/index.htm  -- Works Can any one please help me it is URGENT !!

  • Jsp parameters - url problem

    hello,
    I have a problem with the maximum length of an url.
    I have to submit a parameter (which is a list of elements) from a jsp to a servlet. But, for IE, there's a maximum length of the url and it doesn't allow a such longer parameter (for netscape, it's ok).
    I would like to have a button on my jsp which open another jsp which use the parameter of the first jsp. I have thought to use javabeans but I don't know how to keep a same javabean in several JSPs...
    Can you give me some ideas please ?

    // JSP 1
    <form name=fastaForm action=/EHTDb_interface/servlet/EXHServlet>
    <input type=hidden name=clNames value=<%=clNames%>>
    <!-- clNames is a String of 1 to several hundreds of characters long-->
    </form>
    // SERVLET (/EHTDb_interface/servlet/EXHServlet)
    String clNames = (String) request.getParameter("clNames");
    String redirect = "/result/fasta.jsp";
    Fasta f = new Fasta (clNames);
    request.setAttribute("fasta", f.getFasta());
    RequestDispatcher dispatcher;
    dispatcher=getServletConfig().getServletContext().getRequestDispatcher(redirect);
    dispatcher.forward(request, response);
    //JSP 2
    <% HashMap hmFasta =(HashMap) request.getAttribute ("fasta"); %>

  • Custom MAIN.JSP adding URL for email needs email var

    IDM 7.1
    Hello forum members!
    I have a very small request in this topic; I'm a newbie to IDM and started mods of forms/menus via BPE.
    I am customizing /idm/user/main.jsp to display an url where the user can send and email, rather than creating a workflow form, etc...
    Now, I can display the easy part which is the current logged in user, but how do I display in the main.jsp the user's email so I can attach it to the url.
    Here are my test lines:
    right after:
    <%@ include file="userHeader.jsp" %>
    <br>
    <%
    String loggedInUser = _wsSess.getUser();
    String urlparm = response.encodeURL( "/url/email.html?LANG=" + wps_lang + "&CO="wps_cntry"&USR="+loggedInUser );
    <a href="<%= urlparm %">>Click here to send email...</a></p>
    right before
    <%@ include file="userFooter.jsp" %>

    I tried the code above but no luck... my userID has no permissions to the view apparently...
    I keep getting errors... which java library should I include? I tried com.waveset.ui.FormUtil but no luck....
    =================
    org.apache.jasper.JasperException: An exception occurred processing JSP page /user/main.jsp at line 48
    45: <br>
    46: <%
    47: String loggedInUser = _wsSess.getUser();
    48: WSUser user = (WSUser)_wsSess.getObject(Type.USER, loggedInUser);
    AND THEN FURTHER DOWN...
    root cause
    com.waveset.util.WSAuthorizationException: View access denied to Subject am1234 on User: am1234.
    ===================
    THESE ARE THE LIBRARIES DEFINED AS WERE IN THE ORIGINAL
    <%@ page import="com.waveset.session.Session" %>
    <%@ page import="com.waveset.ui.util.RequestState" %>
    <%@ page import="com.waveset.ui.web.user.MainMenu" %>
    <%@ page import="com.waveset.ui.LoginHelper" %>
    <%@ page import="com.waveset.util.Util" %>
    <%@ page import="com.waveset.util.XmlUtil" %>
    <%@ include file="../includes/headStartUser.jsp" %>

  • Jsp struts url

    Hi All,
    I am using Java struts. We have several Struts-Jsps. when we browse from one jsp to another, the url is shown as below: All values are visible in the url
    http://localhost:8080/PSS/pim/location.do?page=1&methodName=fetchAll&showSearchPage=true&beGeoId=52468
    our requirement is we do not want the user to see the value of our parameters for e.g beGeoId=52468
    Reason is user might change the value 52468 to say 52400 and may get different page. How can we avoid user from doing this. what technique we can use?
    thanks,
    pp

    You could save the values in a browser cookie that your
    JSP could read. This would allow you to avoid stringing
    together a command for a JSP app. Have your JSP read
    the browser cookie to get the values you need from the
    client.
    Within a JSP application that has multiple JSP pages, you
    can use a JSP scope of session and store parms in a bean.
    But, if you link to another JSP app, you'll have to string
    together you command like your example or use a cookie.
    Have Fun!!
    John

  • Help with 301 redirect code - jsp in url

    I'm trying to set a 301 redirect in my jsp code (this is tomcat btw) using this:
    <%
    response.setContentType("text/html");
    response.setDateHeader("Expires", 0);
    response.setHeader("Location", "http://www.mysite.com/record/pleasehelpme /helpmeheretoo");
    response.setStatus(301);
    %>
    the pleasehelpme and helpmeheretoo need to use variable values i get from mysql which i would normally express in the application like
    <%=(((Recordset1_data = Recordset1.getObject("avariable"))==null || Recordset1.wasNull())?"":Recordset1_data)%>
    so what do i need to stick in those parts of the path in the url?
    it works great redirecting to a flat url but I need those variable (well, that's the point of this anyway).
    sticking the <%= recordset stuff %> is breaking since it's like a tag in a tag (i guess) - have tried variations on sticking println around (String)Recordset1.getObject("avariable") like
    "http://www.mysite.com/record/(out.println(String)Recordset1.getObject("avariable"))"
    and variations with curly braces and semicolons and everything but i keep getting
    Syntax error on token "avalue", invalid AssignmentOperator
    errors. (i'm obviously tring to figure out just one variable before i stick both in the path while i get this figured out).
    can someone hit me with a clue stick?

    And then finally I found a .php option (which I saved in my root directory)
    <?php
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: http://www.downtoearthlandscaping.ca/#!/page_Home");
    ?>
    I
    This works, does your server support php?
    You don't need:
    header("HTTP/1.1 301 Moved Permanently");
    Just this:
    <?php
    header("Location: http://www.downtoearthlandscaping.ca/#!/page_Home");
    ?>
    Saved as index.php
    The server will find index.php and the first page should be displayed.

  • Problems with sendredirect(url)

    Hi,
    I am using a sendredirect method in HttpServletResponse in order to redirect users from my site to other sites.
    I am using tomcat 5.x that is connected to IIS.
    The problem is that the statistics systems on the other sites do not see my users since there is no "Referer" field.
    What can I do? I tested it and saw no Referer field. How can I fix that?
    Thanks!

    You can always add the header manually before sending the redirect.

  • URL after sendRedirect and forward

    Hi,
              As I know, after execute response.sendRedirect("URL"),the URL in the
              browser will be changed.But in this case , it is still the original one.My
              server is NT4.0,Weblogic server 5.1 sp6,ie5
              step1:
              test.jsp
              <% response.sendRedirect("in1.jsp"); %>
              <jsp:forward page="in2.jsp" />
              the result URL is http://localhost:7001/MyApp/in1.jsp (Correct)
              step2: then change test.jsp to
              <jsp:forward page="in2.jsp" />
              <% response.sendRedirect("in1.jsp"); %>
              the result URL is http://localhost:7001/MyApp/test.jsp (Correct)
              step3: change test.jsp same as step1
              <% response.sendRedirect("in1.jsp"); %>
              <jsp:forward page="in2.jsp" />
              the result URL is http://localhost:7001/MyApp/test.jsp (incorrect)
              but the title of this page is http://localhost:7001/MyApp/in1.jsp - ...
              So, what's the matter with this one , is this a bug?
              Thank you for your attention.
              

    As to which one is best, there are situations where both are useful.
    A redirect has the disadvantage that it loses all request parameters/attributes (because it creates a new request)
    The advantage to it is that if the user refreshes the screen (using F5, or pushing refresh button) it only refreshes the page that was redirected to.
    If you do an internal forward,
    You might find this article of use: http://www.theserverside.com/patterns/thread.tss?thread_id=20936

  • How to Open URL value stored in a variable in JSP

    Hi all,
    I want to know how i can use value of a string variable in a JSP as url to open.
    <% String abc="some url value" ; %>
    then i want to open abc as URL in JSP
    Please suggest something on this.
    any help in advance will be highly appreciated.
    thanks,
    savdeep.

    thanks rahul but,
    I want to open the URL in
    <% String URLvariable="abc.htm" ; %>
    <% out.println("< a href=URLvariable>"+rs.getString("Some JSP value")+"</a>"); %>
    please suggest how should i open the above URL value stored in JSP variable.
    any help will be highly appreciated.
    thanks,
    savdeep.

  • Url from OA page - urgent plz

    Hi ,
    I have a URL in a seeded page which should open the file repository through the URL.
    my URL value is: \\ottfs1 which should open the file repository.But i am facing the problem in opening this URL.
    http:// is being appending to the url value.I am not sure why this http:// is being appending to the URLvalue.
    when i place my cursor on the url value it shows as
    javascript:windowHandle= window.open("http://\\\\ottfs1','Renderingpage',width=800','height=15,toolbar=yes)
    so i am unable to view the file repository.
    can any one support me on this to fix. thanks.

    Anand, again thank you for your valuable information. The page is now redirecting to "http://inkolsun04:8052/OA_HTML/Temp.jsp?url=www.google.com". I used pageContext.sendRedirect(navigate); option which is working fine.
    Now, there is a problem its opening a blank page. [Not giving page not found exception]. anyway I tried to redirect to a arbitary url "http://inkolsun04:8052/OA_HTML/xyz.jsp", which is also navigating to a blank page. No, page not found exception here also.
    So, may be my jsp file has not been compiled in proper way.
    Steps what I did ->
    created a jsp file "Temp.jsp" =
    *<head>*
    *</head>*
    *<body>*
    *<p>Temp.jsp</p>*
    *<% String getUrl= request.getParameter("url"); response.sendRedirect(getUrl);%>*
    *</body>*
    Put it in $OA_HTML. [for our case -> /CLIENTDEMO11i/vis11/CLIENT_NAME/apps/apps_st/comn/webapps/oacore/html ].
    Restarted the apache server.
    Now I don't know how to solve it. Please help me on this regard.

Maybe you are looking for

  • Macbook can no longer detect HP 2540

    The same computer and printer were working fine (routing through an Apple Airport Extreme). I recently reset my password on the airport, and the printer couldn't reconnect. I reset the printer (pushing two buttons simultaneously) and now I get nothin

  • Security Agent problem

    I am trying to run the Microsoft AutoUpdate software, but I cant seem to get past this last final part. tell application "Microsoft AutoUpdate" activate end tell tell application "System Events" tell process "AutoUpdate" tell window "Microsoft AutoUp

  • NI MAX sees GPIB controller/board, but hangs on Troubleshooting test/Scan

    Hello, I have a new PC (Win7, 64 bit) with a new PCI-E GPIB card and NI-VISA 14.0 (latest). I can't get the card to 'do' anything - it won't pass the troubleshooting self test, or scan for instruments, and the ibfind command in Interactive control do

  • Generate random string ABAP

    Does anyone have sample code to generate a random string of 12 characters? Urgently needed. Thanks very much for any replies.

  • ACE - VIP address on different subnet

    Hello, Is it possible to configure a VIP address that is different from the VLAN subnet where it is applied on? Fe: VIP is 10.10.10.1/24 on VLAN 10 Interface of ACE in VLAN 10 is 192.168.1.1/24 On the upstream routers, a static route points to the VI