Exception ussing location.href

Hi, from a JSP page I pass a form to a Servlet where I access to a MySql DataBase.
If happend some thing, I show an alert javacript and I want to redirect again to the JSP page. But I obtain an error.
Inthe Servlet I use:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        // BD conection     
        MyConnection ManageBD = new MyConnection();
        boolean existe = ManageBD.confirmLogin(login);
        if ( true == existe )     // SI HAY USUARIO CON ESE login (LO COMUNICAMOS Y RECARGAMOS PAGINA)
                out.println("<script>");
                out.println("<!--");
                        out.println("alert(\"Ya existe un usuario con ese login\");");
                        out.println("location.href = \"../admin/manage/add.jsp?miga="+request.getParameter("miga")+"&lang="+request.getParameter("lang")+"\";");
                out.println("-->");
                out.println("</script>");
        }else
                ....          If I post out.println("location.href = \"../admin/manage/add.jsp?mig.... The browser goes to add.jsp but loads an exception:
excepci�n
org.apache.jasper.JasperException: 1
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
causa ra�z
java.lang.ArrayIndexOutOfBoundsException: 1
     org.apache.jsp.admin.manage.add_jsp._jspService(add_jsp.java:266)
     org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
     org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
     org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
     javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/5.0.28.Why this error??

It's resolved.
It was necessary to pass a variable in the location.href that then add.jsp page needed.

Similar Messages

  • Trying to open a page in IE-tab using javascript, script type="text/javascript" window.location.href="chrome://coralietab/content/container.html?url=0,myurl" /script Error:Component returned failure code:0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href]

    I am trying to open a page in IE-tab using javascript like this, <script type="text/javascript"> window.location.href = "chrome://coralietab/content/container.html?url=0,myurl" ;</script>.Error occured : [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMLocation.href]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame ::myurl :: load :: line 234" data: no] I have IE-Tab plug-in installed..when I open the same link manually in mozilla,it works fine and page gets opened in Ie-tab.

    The only way this might be possible is by using the HostContainer object
    to access the HTML page and do it from there.

  • Location.href not working in firefox. Is there any alternative script for that?

    window. location.href not working when i try to submit an ajax form.
    I am a programmer. This code works on all browser except firefox.
    Any solution for this? or any alternative code for location.href?

    A good place to ask advice about web development is at the mozillaZine "Web Development/Standards Evangelism" forum.
    *http://forums.mozillazine.org/viewforum.php?f=25
    The helpers at that forum are more knowledgeable about web development issues.<br>
    You need to register at the mozillaZine forum site in order to post at that forum.

  • Javascript with window.location.href no longer working in Content Editor in Sharepoint 2010 where users have IE8

    I have recently found that when using a Sharepoint 2010 Content Editor web part to house some Javascript that the window.location.href (or window.location) is not working when the end users have IE8 installed on their PC's.  We have confirmed
    that the window.location.href is working if the users are on IE7 or Google Chrome with the same Javascript.  In addition, we added alert() to the javascript to ensure that it was infact running, which the alerts appeared on the screen with no issues. 
    The result that I am receiving in IE8 is that when the window.location.href is set to the url that the user should be directed to, it simply refreshes the current page and leaves the user where they originally were.
    I have seen the posts to have my site setup as a Trusted Site, but this is not an option for our company as they defined all internal Sharepoint sites as trusted already.  Besides this, having all users go into their Internet Options is not really a
    solution but a means to annoy your users.
    What I am looking for is a permanent solution that I can make within my javascript that will work for both IE7 and IE8 users within a Sharepoint 2010 environment.  If anyone has any suggestions, please let me know.  Thanks in advance.
    Below is a snipet from my javascript code for review:
    <script type="text/javascript">
    function RedirectUrl() {
    alert('button pressed');
    var tb = document.getElementById("tbSearch").value;
    var cs = document.getElementById("sfield").value;
    var url = "";
    if (tb != "") {
    url = "FilterName=" + cs + "&FilterMultiValue=*" + tb + "*";
    if (cs == "Request%5Fx0020%5FID1"){
    alert("Request%20ID%20Search.aspx?" + url)
    window.location.href = "Request%20ID%20Search.aspx?" + url;
    else {
    window.location.href = "All%20Requests.aspx?" + url;
    else {
    return false;
    function ClearUrl() {
    window.location.href = "All%20Requests.aspx";
    </script>
    <br/>
    <span style="font-family: calibri; color: #000066; font-size: 14pt; font-weight: bold">Search</span>
    <br/>
    <span style="font-family: calibri; color: black">Search Field: </span>
    <select id="sfield" style="font-family: calibri; font-size: 10pt">
    <option value="Request%5Fx0020%5FID1">Request ID</option>
    </select> &#160;
    <span style="font-family: calibri; color: black">Search Text: </span>
    <input id="tbSearch" onkeypress="if (event.keyCode == 13) document.getElementById(&#39;btnSearch&#39;).click()" style="font-family: calibri"/>
    <button id="btnSearch" onclick="return RedirectUrl();" type="submit" style="font-family: calibri">Search</button>
    <button id="btnClear" onclick="return ClearUrl();" type="submit" style="font-family: calibri">Clear Search</button>
    <br/>
    <br/>
    <span style="font-family: calibri; color: #000066; font-size: 14pt; font-weight: bold">Search Results - All Requests</span>
    <br/>

    Hi,
    According to your post, my understanding is that the window.location.href not worked in IE 8.
    I think the issue
    is likely due to the value of your variables. If they contain special or invalid characters, those needs to be passed through
    encodeURIComponent before being assigned to window.location.href.
    http://stackoverflow.com/questions/18278777/window-location-href-not-working-on-ie
    http://stackoverflow.com/questions/6297291/window-location-problem-in-ie
    You can also use the following methods to check whether it works.
    Window.navigate();
    Winodw.history.back();
    Self.location.href;
    Top.location;
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Problem with location.href

    hi
    I want to create a widget but got a problem with a link. This is the html code.
    <body>
    <input type="text" id="temporaryinbox_textbox">
    <select id="language">
    <option value="">en</option>
    <option value="de/">de</option>
    <option value="es/">es</option>
    <option value="it/">it</option>
    </select>
    <input type="submit" value="Check" onclick="location.href = 'http://www.temporaryinbox.com/' + document.getElementById('language').value + 'inbox.php?inbox=' + document.getElementById('temporaryinbox_textbox').value;">
    <input type="submit" value="Random email" onclick="createRandomEmail();">
    <input type="text" id="temporaryinbox_textbox2" size="25" onclick="document.getElementById('temporaryinbox_textbox2').select();">
    </body>
    On Windows with Firefox it works but on OS X as a widget it loads the target in to the widget. How can I make load it into a new Safari window? Or set it, that the default browser will be used….
    Thanks for your help
    iMac Intel 17"   Mac OS X (10.4.6)  

    Hi Samira,
    DI has by nature some constraints, one is its memory leaks another one is the time of instanciation... I can keep going with some others like memeory consumption and not thread safe.
    Servers technologhies are, starting by the historical one DI-Server and its companion which is B1WS and finishing by one which is the way to go: B1if (you can call scenario as web services).
    What I meant by implementing a connection's cache mechanism, is to limit the number of connections and deconnections (the main issue with DI-API), but definitively I would try to go outside of this... But this is my personal point.
    Regards,
    Eric

  • Ошибка в функции YtFlv2Mp3.DocOnLoad. TypeError: oDoc.location.href.startsWith is not a function

    When I try to open my web browser or a new webpage then it writes out the next in a pop-up window: Ошибка в функции YtFlv2Mp3.DocOnLoad. TypeError: oDoc.location.href.startsWith is not a function. I hope that the problem can be solved.

    Thank you so much! Arigatou! Danke schön! Köszönöm!

  • Javascript's window.location.href stopped working on FF 17.0.1

    I used window.location.href to navigate pages in my application. Suddenly it's not working anymore with upgrade to v 17.0.1
    Still works in v16... but most of the company users upgraded to v17, and now it's a big proglem
    WHAT TO DO?

    The piece of code that I have is something like
    "<a id="action_url" href="/abc/xyz" name="action_url">Data</a>"
    abc/xyz is a struts action

  • Help setting up Window.location.href to open a file, and 1 other issue

    Hey there,
    I am a student currently working on a school project where I must make a website. I am trying to set up: window.location.href="C:\Users\*PCNAME*\Desktop\*SITE*"; in that fashion to open up a local file on my HDD, so when I click a specific area, it opens that page from my local files. This setting works with opening web pages like "http://www.google.com" just fine, but when I attempt to instead open up a file location I am given an error.
    Also, my other question is how to have more than 1: <script type="text/javascript"> function LinkTo(){, so that I can have 2 seperate buttons on my web page linking to 2 seperate sites.
    Here is a link to the PasteBin with my code: http://pastebin.com/Eawy2hcL
    Basically, I am wondering how to set up window.location.href to open  up a page located in my files rather than from the internet like Google or Facebook; and, I am wondering  how to have multiple LinkTo scripts set up so different buttons link to different pages and how to link those buttons to each script. I am new to Dreamweaver, so forgive me if anything is blindingly obvious! 

    Okay, I'll try to explain better. Btw, thanks for the bottom part. Figured out I am not supposed to put the full location of the file, only the page (index.html), not C:\Users\*NAME*\etc...
    Anyways, I am wanting multiple scripts.
    Basically, I want the left cell to, when clicked, go to NewCars.html, and the right cell to link to UsedCars.html. It is a table that I have configured to be clicked anywhere in the cell rather than just having to click the words to go to a link. The code is:
    <table width="100%" border="1">
      <tr>
        <td style="cursor:pointer;cursor:hand;" onClick="LinkTo()" width="50%" bgcolor="#C5B8B8"><h2 style="text-align: center">Shop New</h2></td>
        <td style="cursor:pointer;cursor:hand;" onClick="LinkTo()" width="50%" bgcolor="#C5B8B8"><h2 style="text-align: center">Shop Used</h2></td>
      </tr>=-
    </table>
    I have the LinkTo script set up, but I don't know how to add another LinkTo script that goes to a different page so that way the first LinkTo script for the"Shop New" cell takes you to the NewCars page, while the "Shop Used" cell takes you to the ShopUsed page.

  • Webhelp vulnerable during XSS cross site scripting audit. Reason - document.location.href

    Online help created by team is going through a security vulnerability check now. It has been found that after integration of webhelp with the application,document.location.href  is a vulnerable point as per XSS cross site scripting. Please your thoughts and any methods you have that can contain this situation. Its urgent, please help.

    This thread is now locked. See the duplicate post.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • Why does user_pref("capability.policy.default.Location.href", "allAccess"); no longer work in FireFox 4? How can I re-enable this feature?

    On upgrading to FireFox 4 from 3.6.15, I noticed that my capability.policy.default items in the prefs.js file were no longer working (the custom site that I run locally needs access to this attribute, amongst others) - how can I go about returning this feature back on?
    Example CAPS entry:
    user_pref("capability.policy.default.Location.href", "allAccess");
    I've had to downgrade again to 3.6.15 until I can get this to work.
    Tested on Windows XP (SP3), and using existing/new profiles in FF 4.0 and using prefs.js and user.js - nothing can get the Javascript code to read the location.href and getting an error generated in the error console.
    Also tested on Mac OS X 10.6.7 with FF 4.0 - still no luck getting capability.policies to work.
    Please help...

    I've been beating my head against this problem for a few hours, and I finally solved it. I'd been trying to set a capability policy using the "magic" default policy, and nothing would work - I could disable properties and functions of the Window object, but not the Location object.
    It turns out that if I set a custom policy name, and named the specific sites I wanted the policy to apply to, it works! The only hitch is that you'll have to build a whitelist of sites that are allowed to have this kind of access, instead of allowing any site to access it by default. I think this is prudent security policy, in order to prevent XSS attacks.
    So, for your case, instead of this:
    user_pref("capability.policy.default.Location.href", "allAccess");
    use this instead:
    user_pref("capability.policy.policynames", "hrefaccess");
    user_pref("capability.policy.hrefaccess.sites", "http://example.com http://www.example.com");
    user_pref("capability.policy.hrefaccess.Location.href", "allAccess");
    I haven't tested this code, but a similar implementation for my problem did the trick. I hope this helps!

  • Fastest way to remove html tags except url in href from string using java

    Hi All,
    Please suggest the, fastest way to remove html tags (stripe) except url in href of an anchor tag from string using java.
    Please help me with the best solution as I use parser but it's taking time to remove the html tags from string of file.
    I want the program should give the performance as 1 millisecond for 2kb file.
    Please help me out... Thanks in advance

    Hi,
    how can I replace the anchor tag in a string, by the url in the href of that anchor tag by using jsoup,
    e. g.
    <code>
    suppose input text is :
    test, string using, dsfg, 1:14 PM, < a t a r ge t="_ablank" s t y l e = " color: red" h r e f = " h t t p : / / t e s t u r l . c o m / i n d e x . j s p ? a = 1 2 3 4 " > s u p p o r t < / a >, s c h e d u l a r t a g , < a t a r g e t = " _ vbblank " s t y l e = " c o l o r : g r e e n " h r e f = " h t t p : / / t e s t u r l g r e e n . c o m / i n d e x . j s p ? a = a s d f a s df 4 " > s u pp o r t r e q < / a > a s d f pq r
    then out put text should be :
    test, string using, dsfg, 1:14 PM, http://testurl.com/index.jsp?a=1234, schedular tag, http://testurlgreen.com/index.jsp?a=asdfasdf4 asdf pqr
    </code>
    Please help at the earliest..
    Thanks in advance
    as this text editor is not supporting html anchor tag the example is not displaying correctly
    Edited by: 976815 on Dec 17, 2012 5:17 AM

  • Javascript issue calling location.href

    Hi
    I am calling a javascript function from the click event of a command button.
    function test1() {
    // alert('Simple alert');
    location.href='/context/faces/test';
    //window.location='/context/faces/test';
    The redirection is not working here from the method. If I uncomment alert in the method and accept the alert the rediredirection is happening. Any one tell me the issue here ? Is there any other way to have the redirection using javascript ?
    THanks
    Suneesh

    Suneesh,
    What "doesn't work" about it? On Page 2, you can have a command button/command link that has an Action method that returns a navigation/control flow case which returns you to Page 1.
    One thing to be aware of... if you are using ADF Task Flows, you must run the page using the task flow URL, not by running the JSPX page's URL. In JDev, test by right-clicking Page 1 in the task flow diagram and choosing Run.
    John

  • Placing information before ".htm" using Java "location.href"

    Or it could be that I'm going about this wrong.
    I'm setting up a testing environment, and am looking to get
    the emails pointing in the right direction, but from the production
    files. The user clicks the "email" link in the topic, and the
    result from
    var mailBody = 'File Location: ' + location.href;
    returns
    File Location: ///file/HelpServer/Topic34.htm
    in the email. With our testing, what I'm wanting is to have
    the result be
    File Location: ///file/HelpServer/Topic34test.htm
    So is there a way to modify the above code to get the word
    "test" in there before the ".htm"? I've been messing with the \b
    and $08 codes for backspace, but those just return small squares in
    the email.
    Any ideas?

    Thanks, Roger, that worked great!

  • PAMS__RESRCFAIL exception when locating or attaching to queue

    Hello
    Recently I got a task to integrate part of our software with external partner which is using MessageQ communication.
    I did some coding and got stuck while attaching to a queue.
    Calling functions pams_locate_q and pams_attach_q throws error/exception:
    pams_locate_q: PAMS__RESRCFAIL, Failed to allocate resource
    pams_attach_q: PAMS__RESRCFAIL, Failed to allocate resource
    I can't understand a cause of this error. Queues are in operation and running. External partner software can connect and execute all normal operations on that queue. No problem at all even if they use the same pams_attach_q function supplying the same parameters.Server has gigas of free space, lot of free RAM, running Windows Server 2003. All other apps work correctly.
    Also, machine that is running my soft is the same which holds all queues and have BEA MessageQ 5.0 installed.
    It doesnt matter if I connect via PSYM_ATTACH_BY_NAME or PSYM_ATTACH_BY_NUMBER, always the same error. Supplying incorrect queue name or number produces the same errors.
    So, my idea is this error is more general one.
    Do you have any hints what the heck could be wrong here?

    Sounds the environment issue at big chance, please check them. When you application failed to attach on BMQ context, it will report RESRCFAIL.
    You can post more detailed info and/or reproducer here for more help. You also can reach me via mail: [email protected] if those info are confidential.
    Regards,
    Leo

  • I'm creating a public website and i have a javascript code that works on all browser except firefox. What should i do?

    Hi,
    I'm creating a public website that has a simple javascript button that will just set an asp.net dropdown value. It works on all browser except firefox...
    website: http://healthcareaustralia-web.sharepoint.com/Doctors/DailyShifts1.aspx
    So when you click on reset button it doesn't set the dropdowns to ALL
    this is the code:
    function resetFilters()
    var dropdown = document.getElementById('ctl00_PlaceHolderMain_DropDownList1');
    var ans = "All";
    dropdown.value = ans.value;
    document.location.href = "/Doctors/DailyShifts1.aspx";
    }

    hello, when i test it with current firefox versions, all works as expected: i choose custom dropdown values & select "filter", when i click "reset" next all dropdowns default back to "all" and the list gets refreshed.
    maybe try to [[Clear the cache - Delete temporary Internet files to fix common website issues|clear the cache]] & and reload the page or for other common troubleshooting steps refer to [[Websites look wrong or appear differently than they should]].

Maybe you are looking for

  • Installation on Ubuntu 10.04, Lucid Lynx

    Hi all, this is my first post here. :D I've just successfully installed on Ubuntu 10.04, Lucid Lynx, and wanted to share the steps that it took and summarize the information I gathered from plenty of Google searches and searches of this forum; maybe

  • Will I lose all of my documents saved on my Time Capsule if I reset it in order to get the Airport wireless router working again?

    Hello I am having problems with my Time Capsule (2nd Gen) and being able to get the wireless signal working throughout my house.  I have concluded the only step I need to try to fix this is to reset the Time Capsule.  My concern is that if I reset th

  • Vector a photo?!?

    Hey everybody...WhatsUp?! Listen, quick ?.... How can I convert a photo (.jpg) to vector based using Illustrator without losing quality? This is especially important because I've started printing a lot of large-format stuff, i.e. wall-scapes billboar

  • Adobe Dreamweaver CS3 Silent Install

    I have followed adobe's instructions on how to perform a silent install with the preserialization built in to the silent install. I recieve an exit code 6 when trying to use the Application Override file that Adobe has provided. Any suggestions?

  • Is there a good step-by-step proces for archiving photos to DVD or Blu-Ray?

    Hello What's the step-by-step process for taking a project and backing it up to Blu-Ray? My library is pretty big, and I need to back it up. I'd like to be able to have Aperture still show the thumbnails when I launch (and still be able to search wit