Cannot reliably use request.getRequestURL() in my backing bean

I am using jDev 11.1.2.3.0.
In my backing bean to my ADF JSF page fragment I get mixed results from different web browsers when trying to retrieve a URL from the request object. The java code I use in my bean is like this:
FacesContext fc = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest)fc.getExternalContext().getRequest();
String URL = request.getRequestURL().toString();
Depending on whether I use IE, Firefox or Chrome, sometimes the URL = null. What's wierder is that different computers in my office get different results. One computer can get URL = null in IE and FF, and another would get null using Chrome and IE. It's so bizzare, I don't even know where to start debugging this issue.
But I'm wondering if it's the way I am retrieving the request object using request = (HttpServletRequest)fc.getExternalContext().getRequest(); Is this the right way to get the request object?

Hi,
if you are in a page fragment then the request is partial anyway. So can you give us an idea of what the use case is for which you need the URL ? Maybe its easier to fix the desired use case implementation then to fix access to the URL just to find out you cannot use the result (the URL is not identifying the page fragment and thus doesn't allow redirects or bookmarks)
Frank

Similar Messages

  • Can I change the request params in my backing bean?

    I want to change the request params in the backing bean method.
    For example:
    <h:commandLink value="test" action"myBean.test">
    <f:param name="a" value="1" />
    </h:commandLink>
    When user click the link, myBean.test() will be invoked.
    Can I change the request param values in myBean.test()?
    I mean, if I can change the value of "a" to "2" or add a new param?
    Thanks!

    I'm not sure if You can change any request parameters...
    You can set e.g. a request attribute in the case that You get the request object from the faces context and set the attribute.
    something like this...
    FacesContext fc = FacesContext.getCurrentInstance();
    HttpServletRequest req =    HttpServletRequest)fc.getExternalContext().getRequest();
    req.getParameter("id");
    req.setAttribute("id", new Integer(2));

  • Using a backing bean in JDeveloper to assign bean class variables

    I am using JDeveloper 10 to make a jsp page that is a form full of inputs and buttons. JDeveloper then creates the setters and getters for you for the ids of the various inputs and buttons. I also have used JDeveloper to create a backing bean.
    The idea of this is to have the backing bean read in parameter(s) from an http source/link(when the form is loaded or instantiated) and assign those parameter(s) to one of the bean class local variables.
    The reason i want to do this is, is that when the form is loaded the first thing it will do is open up an available database(in the bean class constructor), then in the constructor call a function to do a database query that will return a result set that will then be used to fill up the form.
    That variable that is assigned by the backing bean will be the value of a unique database identifier for doing the sql query so that is why it is important that i get this value as the form loads.
    So simply i need to find out from someone how to do this. i am totally new to doing any jsp development or using managed beans and i have gotten far enough to launch the form, retrieve and write to the database using sql queries and all the rest.
    I just dont know enough about managed beans to make a decision on things like making the bean have a session scope. do i need request scope? if i change to request scope how do i make sure the database isn't being called every time the page changes or is refreshed?(when i had it as request scope the constructor was being called every time the page was reloaded and that isnt effecient at all, especially with multiple users). can you define more than one managed bean in one faces config file? do i have to manually change something in the jsp file to make sure things run smoothly?
    Just maybe things are easier than i see them to be and my only problem is that i just dont understand what i am doing. here is what my backing bean looks like now with just basic session scope.
    An example of course would be something like: http://host:port/context-root/faces/register.jsp?12345 - where 12345 would be the value that i would like to assign to a local variable in my bean class that can then be used for filtering out information via a query then filling up the form, all this happening at instantiation.
    <?xml version="1.0" encoding="windows-1252"?>
    <!DOCTYPE faces-config PUBLIC
    "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
    "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config xmlns="http://java.sun.com/JSF/Configuration">
    <managed-bean>
    <managed-bean-name>beanpackage</managed-bean-name>
    <managed-bean-class>beanpackage.beanclass</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    <!--oracle-jdev-comment:managed-bean-jsp-link:1register.jsp-->
    </managed-bean>
    </faces-config>
    This is what i have now, i've tried tons of stuff on the web like assigned value parameters but just am stuck on exactly what to do as nothing has seemed to work. Any help would be appreciated. Thanks in advance!

    Hi,
    don't think you will get a readily programmed solution to this (though I wish you luck). Here's how I would approach the managed bean issue
    - One managed bean that you configure from a java.util.HashMap. This bean should be in requestScope (should be okay here). Say the bean is called "formFields", then adding data to it can be done with the following EL #{formBean['attribute_name']}. You need to add this as the value Expression of the inputText field you create dynamically. The filed will then read and write to the HashMap
    - Create a managed bean in session scope to handle the database interaction. Put this into session scope (e.g. "database")
    - Create a managed bean that holds the action listener that handles the update, insert and delete actions (e.g. logic handler). This bean has a JSF reference to the root component in the page (or the form layout component to add the fields to)
    The "database" bean is referenced from the logic handler managed bean using the #{database} expression, which you resolve using a ValueBinding (ExpressionBinding in JSF 1.2). Or, you configure the bean as a managed property.
    The logic managed bean also needs to reference the formFields bean (similar to above) to access the contained filed names and attributes. If the filed attributes match column names in the database then you should be all set
    Frank

  • Backing bean not holding values!

    I have created a simple login page for an app I am creating. I have used JSPX, and created a backing bean which is registered as a managed bean. Just for interests sake (to check that things work), i initialise the userName and password attributes - and I see these defualt values in the gui (OK), however when I entered a user name and password, the values are not updated, so my login code (bound to the action of a commandButton) cannot get the values and log me in.
    my faces-config.xml has this snippet:
    <managed-bean>
    <managed-bean-name>LoginBean</managed-bean-name>
    <managed-bean-class>userinterface.backing.LoginBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    my JSPX has definitions like this:
    <h:inputText id="userName" value="#{LoginBean.userName}" required="true"/>
    my backing bean has the attributes defined:
    private String password = "testPass";
    private String userName = "testUser";
    i just dont understand what I am missing. From the documentation I have read, setting the value attribute by binding it the the backing beans attributes should be enough to update the values... but apparently not.
    Also, when I press "login" the username and password fields are cleared... is this normal behviour?
    I am sure my backing bean is correctly defined as the fields show with default values, and the command buttons worrk. Do I need to hook up the getters and setters in the JSPX page?
    Thanks for any insight - this is fun technology to play with, but trying to get some simple things up and running can be frustrating!
    /caj

    I found the problem eventually - the structure in my jspx document was incorrect, as I had mananged to split my from into two forms, and the submit commandButton was only submitting the form that the button resided on. The edited information was on the other form, and was thus not sumbitted. Once I merged the form into one, the whole thing worked perfectly!!
    I figured that I did something wrong - hope this mistake can help others.
    /caj

  • Role of backing beans in MVC design

    Hello,
    yet another JSF/MVC question. In short, I would like to know what the role of the backing beans are in an MVC design with JSF. The most simple answer would be that they are just the Controllers. But that doesn't seem enough.
    Suppose I have an application model, call it Ma, which is just an interface that represents a use case in Java. Ma doesn't know anything about a view or controller, it is just domain logic with application-specific state and behavior added. Now,
    - my backing bean uses Ma as its Model, acting as a true Controller by delegating requests to it
    - my backing bean also adds view-specific state (show/hide stuff and it also returns a List<SelectItem> for example) that I can't put on Ma, so it also acts as a view model Mv
    So, I could argue that I have an Mv-V-C design, where the backing bean is both C and Mv. My user interface V only queries Mv for its state.
    Usually I read that V and C are considered to be very tightly coupled, so then I would have an Ma-V-C design with the backing bean being C and part of V.
    Is it just a question of terminology or point of view, expressing the same idea twice?

    The way I think about it is that there are multiple layers of MVC.This kind of refers to my point-of-view question. So let's try two of them.
    The view itself can be thought of as containing MVC elements.When only looking at JSF (presentation layer) we have:
    - Model: backing beans (view model Mv)
    - View: view root and JSPs (query backing beans for state)
    - Controller: Faces servlet (dispatches requests to backing beans)
    In my "enterprise" quality applications, I will have three distinct layers.Taking a step back, let's look at the application layer (your "control layer", application logic behind interface) and the presentation layer.
    Then:
    - Model: application model Ma in application layer
    - View: backing bean (associated with UI components)
    - Controller: backing bean (dispatches requests to Ma)
    Agree?
    It's interesting that you call my application layer "control layer" since it seems more like a model to me, especiallly when you say:
    The control layer consists of business logic interfaces and their implementations.This said, the objects in this application layer do have some controller functionality as they orchestrate the interactions with the underlying domain model, just llike the backing beans do with the application model. So maybe you can take another step back and consider these application logic interfaces as the View and Controller for the underlying domain model. That is: in a layered MVC design every M can become the VC for an underlying (more general) layer?
    And I have seen this taken to extremes.Perhaps that's what I'm doing here :)

  • How to get selected items from a tree in backing bean without adfbc

    Hi ADF Experts,
    Below is my code for af:tree. My question is how can I get selected Items from the selectionListener (without adf bc) this uses formation of tree from backing bean.
    Using Jdev 11.1.1.7.0
    <af:tree var="node" value="#{pageFlowScope.MerchandizeBean.model}"
                      binding="#{pageFlowScope.MerchandizeBean.treeModel}"     id="tree" immediate="true" autoHeightRows="0"
                           styleClass="AFStretchWidth" rowSelection="multiple"
                           selectionListener="#{pageFlowScope.MerchandizeBean.treeNodeSelection}">
                    <f:facet name="nodeStamp">
                      <af:commandLink text="#{node.classDescription}"
                           actionListener="#{pageFlowScope.MerchandizeBean.createListManyItemForMerchandise}"           id="displayTable" partialSubmit="true">
                      </af:commandLink>
                    </f:facet>
                  </af:tree>
        public void treeNodeSelection(SelectionEvent selectionEvent) {
            // Add event code here...
            RichTree tree = (RichTree)selectionEvent.getSource();
                    TreeModel model = (TreeModel)tree.getValue();
                    //get selected value
    Thanks
    Roy

    Hi,
    in a multi select case, try
    RowKeySet rks = tree.getSelectedRowKeys();
    Iterator iter = rks.iterator();
    while(iterator.hasNext()){
    Object aKey = iterator.next();
    tree. setRowKey(aKey);
    Object rowData ? tree.getRowData();
      .... do something with the data here ...
    Frank

  • BindingContainer Reference in Backing bean

    Hi,
    When I use method call(method referred from backing bean) from task flow definition I get bindings null using below code
    DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
    Any pointers?
    Thanks
    RB

    Hi Frank,
    Thanks. Are you saying even binding container reference we can pass using the task flow parameter?
    Following is the use case I am trying to get the BindingContainer reference,
    1. I wrote custom method in backing bean which is called from task flow definition using method call activity
    2. To get the OperationBinding reference currently I am using the below code in backing bean
    public void customMethodCall(){
    DCBindingContainer bindings = (DCBindingContainer) BindingContext.getCurrent().getCurrentBindingsEntry();
    oracle.adf.model.OperationBinding opBinding =
    (oracle.adf.model.OperationBinding)bindings.getOperationBinding("CustomeMethod");
    opBinding .execute();
    3. In above code bindings returns always null if used/call it as method call in task flow definition
    Am I missing something??
    Regards
    RB

  • Backing Bean

    Current release jdeveloper adf
    I want to pass 2 column values from a table in formA and assign the passed values to 2 columns in a table in formB
    In FormA the values are WoOrderNo and WoTaskNo
    In FormB the columns are Wo_no and Task_no (these columns are hidden)
    Is my only option to use a backing bean?
    If so, then they way I would like to pass the 2 values using a 2 setPropertyListeners in formA using pageFlowScope.
    Have a backing bean update columns in FormB.
    I cann't find any doc's on how to do this.
    What is the best practice on how to accomplish my requirement.
    chuck

    Hello,
    Can you tell me how did you do it?
    thank you
    fwu

  • I have a Windows 8.1 machine.  I used a projecteor a while back in a Power Point presentation.  Now my menus for Adobe are very small and hard to read.  The print command is so compressed that I cannot read or use it.  How do I fix this problem?

    I used a projecteor a while back in a Power Point presentation.  Now my menus for Adobe are very small and hard to read.  The print command is so compressed that I cannot read or use it.  How do I fix this problem?

    There is no application called "Adobe" - you are either working with Adobe Acrobat or the free Adobe Reader. Open up the preferences for the application (Edit>Preferences), then go to the "General" category and modify the settings for "Scale for screen resolution". You will have to restart the application after you do that. Does that fix your problems?

  • WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found.

    I have two forests with a transitive on-way trust between them: PROD -> TEST (test trusts PROD). I had previously had kerberos authentication working with winrm from PROD to machines in TEST. I have verified the trust is healthy, I also verified users
    in TEST can use WINRM with kerberos just fine. Users from PROD cannot connect via kerberos to machines in TEST with winrm.
    I have verified the service has registered the appropriate SPNs. I ran dcdiag against all my PROD and TEST domain controllers and didn't find anything that would prevent kerberos from happening. I even tried disabling the firewall entirely on my TEST dcs
    but that didn't gain me anything.
    I've enabled kerberos logging but only see the expected errors such as it couldn't find a PROD SPN for the machine, which it shouldn't from what I understand, it should go to the TEST domain and find the SPN from there.
    I'm really out of next steps before I call PSS and hope someone here has run into this and could provide me some next steps.
    PowerShell Error:
    Connecting to remote server failed with the following error message : WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found.  
     Possible causes are:
      -The user name or password specified are invalid.
      -Kerberos is used when no authentication method and no user name are specified.
      -Kerberos accepts domain user names, but not local user names.
      -The Service Principal Name (SPN) for the remote computer name and port does not exist.
      -The client and remote computers are in different domains and there is no trust between the two domains.
     After checking for the above issues, try the following:
      -Check the Event Viewer for events related to authentication.
      -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
     Note that computers in the TrustedHosts list might not be authenticated.
       -For more information about WinRM configuration, run the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help topic.
        + CategoryInfo          : OpenError: (:) [], PSRemotingTransportException
        + FullyQualifiedErrorId : PSSessionStateBroken
    winrs Error:
    Winrs error:
    WinRM cannot process the request. The following error occured while using Kerberos authentication: The network path was not found.  
     Possible causes are:
      -The user name or password specified are invalid.
      -Kerberos is used when no authentication method and no user name are specified.
      -Kerberos accepts domain user names, but not local user names.
      -The Service Principal Name (SPN) for the remote computer name and port does not exist.
      -The client and remote computers are in different domains and there is no trust between the two domains.
     After checking for the above issues, try the following:
      -Check the Event Viewer for events related to authentication.
      -Change the authentication method; add the destination computer to the WinRM TrustedHosts configuration setting or use HTTPS transport.
     Note that computers in the TrustedHosts list might not be authenticated.
       -For more information about WinRM configuration, run the following command: winrm help config.

    Hi Adam,
    I'm a little unclear about which SPNs you were looking for, in which case could you confirm you were checking that on the computer object belonging to the actual destination host it has the following SPNs registered?
    WSMAN/<NetBIOS name>
    WSMAN/<FQDN>
    If you were actually trying to use WinRM to connect to the remote forest's domain controllers, then what you said makes sense, but I was caught between assuming this was the case or you meant another member server in that remote forest.
    Also, from the client trying to connect to this remote server, are you able to telnet to port 5985? (If you've used something other than the default, try that port)
    If you can't, then you've got something else like a firewall (be that the Windows firewall on the destination or a hardware firewall somewhere in between) blocking you at the port level, or the listener on the remote box just isn't working as expected. I
    just replied to your other winrm post with steps for checking the latter, so I won't repeat myself here.
    If you can telnet to it and the SPNs exist, then you might be up against something called selective authentication which has to do with how the trust was defined. You can have a read of
    this to learn a bit more about selective trusts and whether or not it's affecting you.
    Cheers,
    Lain

  • Job Mgmt : error "This component cannot be used" when sending job request

    Hi,
    When i try to create a job request (basic job request link from the Job Management Workcenter), I am having an error : "This component cannot be used".
    It seems the component is the number read from the ibase corresponding to the client and the sid. There seems to be ne problem on this side.
    But everything is correctly setup regarding Ibases and components.
    What's more when trying to create a ZLFJ (duplicated from SLFJ) in CRMD_ORDER, there is no problem.
    Any suggestion where it could come from ?

    Hello Hervé ,
    could you please provide me with some more information?
    When exactly do you get the message? When trying to submit the job request? Or when clicking on the link "Create Job Request" in the workcenter?
    If you get the message when submitting, please provide more information on the entered System (IBase). Maybe a screenshot could help.
    Best regards,
    Jonny

  • I just got an iphone and am trying to connect it to my itunes account.  Getting the message " This iphone cannot be used because the Apple Mobile Device service is not started.  How do I start it?  Have already been back to the store with it and no change

    I just got an iphone and am trying to connect it to my itunes account.  Getting the message " This iphone cannot be used because the Apple Mobile Device service is not started.  How do I start it?  Have already been back to the store with it and no change.

    http://tinyurl.com/3hs3g2u

  • HT201320 when trying to set up my email account, i enter add account tap in my details for my virgin media email account, after going through the veryfying, it comes back with cannot connect using ssl.

    when trying to set up my personal email account, following the on screen instructions, it comes back with CANNOT CONNECT USING SSL, do you want to try setting up the account without ssl? Yes or No

    Since Thunderbird does not run on iPads, what does this have to do with Thunderbird?

  • Case: When trying t work in a second desktop, a program cannot be used if open in the first desktop. The screen just moves back to the first deskt

    When I try to work in a second desktop, a program cannot be used if already open in the first desktop. The screen just moves back to the first desktop. Anybody else have this issue?

    Whether or not this behavior occurs depends upon various preference settings and upon how you try to access the application in question.  Personally, I like to organize my desktops according to project, so I regularly have windows from the same application spread out over several desktops. No problem.
    For example, I have a Safari window in Desktop 1 and I want a Safari window in desktop 2. If, while in desktop 2, I bring Safari to the front by clicking on the Dock icon, I can open a new window in the usual ways. I could also just control-click on the Safari icon in the dock to get a new window in desktop 2. 
    (The only application that is a little weird in this regard is Finder. You have to do the control-click on it or it will always switch to a space with a window open.)
    To make all this occur, I have Safari assigned to no desktops (control-click on Safari icon, then on Options) and in Mission Control preferences (in System Preferences) I have "When switching to an application..." UNchecked.
    (Note that, with these settings, if an application is already in front and you click on its icon - or click twice on the icon if the applcation is not in front - the OS will assume you are looking for another open window and will switch spaces to give you one.)
    Hope this helps.
    charlie

  • TS4079 Both my wife and I have iPhone 5 and we use Siri a lot. Ever since we upgraded to IOS 7 we found that frequently we get a reply from Siri something like "This is embarrassing but I cannot handle a request right now". Prior to IOS 7 this did not hap

    Both my wife and I have iPhone 5 and we use Siri a lot. Ever since we upgraded to IOS 7 we found that frequently we get a reply from Siri something like "This is embarrassing but I cannot handle a request right now". Prior to IOS 7 this did not happen.

    tonefox is probably right.  Server overload.  I also notice that when siri does respond correctly, it is slower.  My wife has a 4s and same story, and she has not upgraded to IOS 7.
    So it's not just you (if that makes you feel any better).

Maybe you are looking for