Why getRequestDispatcher method cannot accept full URL?

Examples*
This code works well:
public void doPost(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException {
          String url = "/jsp/pageStart.jsp";
                /* requestDispatcher is NOT null */
          RequestDispatcher requestDispatcher = getServletContext()
                    .getRequestDispatcher(url);
          requestDispatcher.forward(request, response);
     }This code doesn't work, get NullPointerException, requestDispatcher is null:
public void doPost(HttpServletRequest request, HttpServletResponse response)
               throws ServletException, IOException {
          String url = "http://localhost:8080/mymvc/jsp/pageStart.jsp";
                /* requestDispatcher is null */
          RequestDispatcher requestDispatcher = getServletContext()
                    .getRequestDispatcher(url)
          requestDispatcher.forward(request, response);
Notes*
- JSP path is \src\main\webapp\jsp\pageStart.jsp
- I am sure, I can manually open 'http://localhost:8080/mymvc/jsp/pageStart.jsp', just copy and paste this url into address of new browser window.
- Base url is http://localhost:8080/mymvc/servlet/ControllerServlet
- I use Servlet mapping:
<servlet-mapping>
     <servlet-name>ControllerServlet</servlet-name>
     <url-pattern>/servlet/*</url-pattern>
</servlet-mapping>
<servlet>
     <servlet-name>ControllerServlet</servlet-name>
     <servlet-class>controller.ControllerServlet</servlet-class>
</servlet>
Questions*
1. Why getRequestDispatcher method cannot accept full URL?
2. Could you please explain to me the reason why ? and please provide me the better resolutions.
Thanks u in advance!

As per Java API documentation:
ServletContext#getRequestDispatcher(String path)
The pathname must begin with a "/" and is interpreted as relative to the current context root.
For details: [http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)|http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletContext.html#getRequestDispatcher(java.lang.String)]
ServletRequest.html#getRequestDispatcher(java.lang.String)
To allow RequestDispatcher objects to be obtained using relative paths that are relative to the path of the current request (not relative to the root of the ServletContext), the getRequestDispatcher method is provided in the ServletRequest interface. The pathname specified may be relative, although it cannot extend outside the current servlet context.
For details : [http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)|http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.html#getRequestDispatcher(java.lang.String)]

Similar Messages

  • Why do I have to type full URL???

    I used to be able to type in the name of a site without typing the full URL, now if it is a new site (not in history or bookmarked) I cannot just type in the name ie.... 'apple', I now have to type in 'www.apple.com'.
    This was not the case before, is this the new default of Safari 5, or have I accidentally turned something off in preferences?

    Now it just sits there for a while and gives an error message that it could not find the server.
    When that happens, click the Reload icon in the address bar.
    You're not dreaming. Safari users are reporting this issue.
    You can provide feedback here. http://www.apple.com/feedback/safari.html

  • Why won't Apple accept debit cards?  I ordered 2 new iPhones at ATT on Monday using my debit card.  I was just notified by ATT that Apple wont accept debit cards so my order cannot go through.  I don't use credit cards so I don't carry debt!

    Why won't Apple accept debit cards to buy an iPhone 5?  I ordered 2 new iPhones at ATT on Monday using my debit card.  I was just notified by ATT that Apple wont accept debit cards so my order cannot go through.  I don't use credit cards so I don't carry debt!  They (ATT) re-emphasized this is not their policy, but Apple's and that I would have the same problem if I went to Verizon.  Is this really the policy and if so why?  Apple has no problems accepting debit cards for my iTunes account?!

    I think this is an AT&T thing not an Apple policy, I had this battle with them before when the 4s came out.So this time I went directly to the Apple stor, I had no problem pre-ordering my Iphone5 on the 14th with my debit card, already shipped will be here the 21st. I'd go straight to the Apple store and purchase them there...

  • Why US app store cannot accept to pay in foreign visa card?

    Hello.
    I'm Korean but living in japan now.
    so maybe my english is not perfect. Sorry.
    My question is,
    Why US app store does not accept to pay in foreign visa card?
    US app store is the biggest app store and sometimes i want to buy one. But i can't.
    Because the US app sotre only accept US credit card. I actually use my korean credit card in japanese app store, why US app store doent accept it?
    (*In addition,
    Why to make account, i should write address. I can't understand. I think what  apple need is credit card infomation, not where i'm living.
    Because of that, It is troublesoem when i buy japanese gift card to my brother who lives in korea. I cannot understand why gift card cannot be gift.
    Anyway, if the usage of foreign visa card cannot be allowed,
    my next question is that how about app store does sell gift card in other coutry's apple store??
    As i mentioned, US app store is most biggest store. Many people who dont live US, even want to use US app.
    How about selling the gift card on each country's apple store?
    For example, korean apple store sells US gift card and korean gift card both. Korean who want to use US app store, can buy gift card in  korean credit card. It's same as selling ipad!
    Actually, i heard some people who lives in US, sell US gift card to those who want to use US app store.
    If so, i really hope apple sell gift card through apple store officially.
    Thank you.

    Because purchases via the App Store are quite independent of purchases from other media or means. So, if you want to re-install an app that was installed via Disk, then use the Disk. There is no way such apps can be reinstalled or updated via the App Store.
    Why? You'll need to ask Apple.
    Regards
    TD

  • I cannot get Adobe Forms Central to accept a URL link.

    I cannot get Adobe Forms Central to accept a URL link.  The URL is http://www.marriott.com/meeting-event-hotels/group-corporate-travel/groupCorp.mi?resLinkDa ta=Statewide%20Title%201%5Eatlma%60gdegdea%60135.00%60USD%60false%60;atlgi%60stostoa%60135 .00%60USD%60false%606/14/15%606/19/15%606/2/15&app=resvlink&stop_mobi=yes.  Please advise.

    Do the following please:<br><br>
    #Open Internet Explorer, go to Tools | Internet Options | Programs.<br><br>
    #Where you see the Email dropdown menu, change it to Outlook 2010.<br><br>
    #Apply/OK.<br>
    Your email client should now open links in any browser you've set as the default browser.

  • Why doesnt the iOS7 Safari show the full URL when you link thru anymore?

    The old Safari did this. It's useful to know the full URL.

    Please make it a feature we can turn off. 
    I get how Apple wants to simplify and streamline, but I need this info b/c of how I surf.   When I click on the address, at least keep it on the page instead of jumping to the blank page. It's very disconcerting. Even after using iOS for awhile now...I'm still not used to this.  In fact, I had has just enough of it and was browsing to see if it was a feature you could turn off in preferences. Apparently not, and apparently, I'm not the only one annoyed by it.

  • How to Display Full URL in Address Bar?

    I'm using Firefox 14.0.1 on a new computer running Windows 7 Home Edition. I cannot for the life of me figure out why my URLs are getting truncated. For instance, right now, all I can see in my address bar for this website is "https://support.mozil;" if I type in yahoo.com I end up with "http://www.yahoo.co." I can scroll through in the address bar to see the rest of the URL, but I'd like to see the whole thing at once!
    I know you can type about:config into the address bar and change the value of browser.urlbar.trimURLs to false, but I tried that and it doesn't do a thing. I have Firefox on my old computer, and it's not giving me the issue there. So perhaps I have an interfering plugin? The only new thing I have on this system is HP SimplePass (I can't stand HP software). Anyone know what might be causing the issue?

    I, too, had the truncated URL in the address bar. (Firefox 16.0.2 on Windows 7 Home Premium)
    These measures did not help:
    # about:config and change browser.urlbar.trimURLs to false
    # Help > Troubleshooting Information > Reset Firefox
    This measure did help:
    # uninstall HP SimplePass
    I had had the full URL in the address bar while running HP SimplePass, so I do not believe that they are inherently incompatible. I'm just saying these measures, in this order, gave me back the full URL.

  • How to get full URL in java?

    Hi,
    I am working in a spring & hibernate project. For the AJAX request to bookmark, I used RSH (Really Simple Framework) framework. So, my URL changes for the AJAX request as
    http://localhost:8080/courses#/medicaltranscription/cardiology
    If I bookmark this and open in a new window, I can’t get full URL in Servlet. If I use methods in Servlet, it gets only, upto http://localhost:8080/courses. I can’t get the whole URL. Please, help me to find a solution.
    Thank you

    The hash part is entirely client side. You cannot get it on the server side. You need to pass it as request parameter or as part of real URL.

  • SetFireActionForSubmit method cannot be invoked in OAImageBean

    hi,
    I have added an updateicon_enabled image to the seeded page (id:img2), through personlization,
    now i want to add fireAction to the above image programmtically i have usen the below code but it's giving error "setFireActionForSubmit method cannot be invoked in OAImageBean"
    public void processFormRequest(OAPageContext pageContext,OAWebBean webBean)
    super.processFormRequest(pageContext,webBean);
    OAApplicationModule am=pageContext.getApplicationModule(webBean);
    OAImageBean ib2=(OAImageBean)webBean.findChildRecursive("img2");
    Hashtable param1=new Hashtable(1);
    param1.put("update","update");
    Hashtable paramsWithBinds = new Hashtable(1);
    paramsWithBinds.put ("param2",
    new OADataBoundValueFireActionURL((OAWebBeanData)webBean,
    "{$Sequence}"));
    ib2.setFireActionForSubmit("update1",param1,paramsWithBinds,false,false);
    how can i over come this error...
    Help me out
    Thanks in advance
    Paa.

    Hi,
    I am not sure why this is not working, It works perfectly fine in 12.1.2
    I don't have access to R12.1.3 as of now. I don't think there should be any problem in 12.1.3 also.
    I could find out one more approach. Try this:
    OAImageBean ib2=(OAImageBean)webBean.findChildRecursive("img2");
    FireAction fireAction = OAWebBeanUtils.getFireActionForSubmit(ib2, "update1", params, paramsWithBinds,false, false);
    // make any additional changes to the FireAction object
    // finally set it on your bean
    ib2.setAttributeValue(PRIMARY_CLIENT_ACTION_ATTR, fireAction);
    Both are same. I just thought you can give it a try.
    Try deleting the image column and image added through personalization, create the image again bounce the server and check it.
    Regards.

  • API call to get FULL URL

    I can't seem to find an API call to simply return the full url of the current page.
    I just want to do the simplest (at least I think it should be simple) thing: Call a stored procedure (from a portlet) passing the current full url to the procedure. Nothing fancy.
    Is there such a thing? Hopefully, I have just overlooked it...
    TIA

    I've used two different methods to get the url of the page a portlet is currently on depending on the type of portlet it is.
    In a portal component's Additional PL/SQL Code section, use p_page_url. Example:
    BEGIN
    htp.p(p_page_url);
    END;In a custom PL/SQL portlet, use p_portlet_record.page_url. Example:
    schema.procedurename(p_portlet_record.page_url);

  • HT2731 Why itunes doesn't accept my payment card

    Why itunes doesn't accept my mastercard when i sign in with this Apple Id in iTunes Store in windows 8 ,  i have two mastercards of two different banks in India.
    iTunes says - " The payment card number you entered is not a valid payment card number"
    Currently i have Debit Master cards of banks
    1. State Bank Of India
    2. Punjab national Bank
    Please help me to create my apple id with iTunes store

    If you are trying to use debit cards then I don't think that they are still accepted as a valid payment method - they are not listed on this page and there have been a number of posts recently about them being declined. Do you have a credit card that you could use instead ? Credit cards are generally considered safer than debit cards.
    If you only have debit cards then you can try contacting iTunes support and see if they can help, but I don't think that you will be able to use them : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page

  • Why is my SMS Mailbox full after going to iOS 5?

    Ok so after "upgrading" to iOS 5 I get this message when I send messages "Your SMS mailbox is full. New messages cannot be recieved until you delete some messages". After hours on the phone with AT&T and Apple, I did figure some stuff out. 75,000 text message is the limitation of the SMS application. I found through google, an application called PhoneView from ecamm(not free) that will backup and all data on the iPhone but additional it tells you the number of messages. I had 101,732 messages on my iPhone 4. This is because I've had an iPhone since the original they were released in 2007. I've accrued 101,000 message in over 4 years time. At no point was this an issue until i downloaded iOS 5. iOS 4 had no problem with my amount of text messages. I was simply told to delete the messages by my helpful and knowledgable Apple Call Center rep. I wasn't explained why all of a sudden this is a problem. i have over 14GB of free space on my iPhone 4 but my "SMS Mailbox is full." So now since there is no application that has the rights to manage iPhone iOS 4 or higher (i.e. iOS 5) data/messages I have to go thru and manually delete and the 27,000 messages I don't need one conversation at a time. Thanks iOS 5! So this is my reward for being a loyal iPhone user since the beginning. Why is my SMS mailbox full at 75,000 messages? Is not the new iMessage service encouraging even more use on messaging? Please explain

    I think I found a solution!
    I've had this same issue since I upgraded last night.  I tried deleting messages to no avail.  I still had to turn my phone off and back on to receive messages and even then I didn't always receive all messages queued up.  Today I've been fiddling around with settings to see if I could make a difference.  My means were not very scientific, so I can't pinpoint exactly what made things work, but I'll try to recount the steps I took:
    1.  I had toggled off iMessage support which made no difference
    2.  I went into the iCloud settings (Settings->iCloud) and did the following:
         a.  Turn OFF bookmarks
         b.  Turn OFF "Find My iPhone"
         c.  Under "Storage & Backup" I turned OFF iCloud Backup
    3.  I then went back to the Messages settings (Settings->Messages) and turned iMessage back on.  Instantly I got a new text message notification. 
    Since performing these steps I've been able to send and receive text messages with no issues at all.  I have no clue if this will work for others, but thought I'd share.

  • Cannot find full download for RC build (30.0 RC2). Updater fails. Beta channel has my current build (30.0b9).

    Cannot find full download for RC build (30.0 RC2). Updater fails. Beta channel has my current build (30.0b9). Release channel has version 29.
    Updater always fails on this somewhat locked-down work machine.

    I note my beta is
    * mozilla-release - changeset - 193465:529a45c94e5a <br /> https://hg.mozilla.org/releases/mozilla-release/pushloghtml?changeset=529a45c94e5a
    And I agree on the beta download page and the ftp I see 30.0b9 offered
    * e.g. http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/latest-beta/win32/en-US/Firefox%20Setup%2030.0b9.exe
    Someone more knowledgeable may provide you with an answer but the quickest method may be simply to ask on Mozillazine
    * http://forums.mozillazine.org/viewforum.php?f=23

  • Seeing full URL in the address window

    When using Weblogic, is there a way to not show the full URL of pages within an app?
    After logging into an application, I can copy the URL displayed, open a new IE session, paste the URL in the address box, and be taken directly into the application without having to log into it. This seems to not provide the greatest security for an on-line app.

    Eh? Why not? Both IE windows are part of the same process, on the same computer, being run by the same guy. Not really a problem re: security.
    Try emailing the URL to someone else on a different computer, and see if they can open it. If so, that's a problem.
    To increase the security a bit you can not allow session identifiers on the URL (cookies only) and then require HTTPS for all connections.
    There are other things you can do but let's start there...

  • This static method cannot hide the instance method from...

    What means the error message "This static method cannot hide the instance method from Referee"?
    Referee.java is a interface. I implemented it in the class RefereeMyName.java and made a method in that class to be static. Thats why I received that error message.
    But can't I use static methods when I have implemented a interface in that class? I want to have a Player.java class which I want to access RefereeMyName.getTarget(). I cannot use a instance instead because I wouldn't receive a valid return value then (RefereeMyName is the client class).
    What is the solution?

    Hi,
    Well i do not think that you can do that b'cos that way you are not giving the same signature for the method as that exists in the interface. I do not know how other way it can be done but if something urgent for you then you can remove that method from that interface and only define in the class.
    Regards,
    Shishank

Maybe you are looking for