How to get and set a session variable from backing bean?

Hi im using Jdev and i need to set and get a session variable from backing Bean.
Any idea?

the class :
package arq.resources;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
public class SesionSigef {
public FacesContext context;
public HttpSession session;
public SesionSigef() {
context = FacesContext.getCurrentInstance();
session = (HttpSession)(context.getExternalContext().getSession(true));
public Object getVariableSesion(String atributo){
return session.getAttribute(atributo);
public void setVariableSesion(String atributo,Object valor){
session.setAttribute(atributo, valor);
the example of use :
SesionSigef se = new SesionSigef();
DatosRec da = new DatosRec();
se.setVariableSesion("DatosRec", da);

Similar Messages

  • How to assign and display an attribute value from backing bean?

    Hello all,
    I am using Jdev 11g. I have a form page which has two inputText attributes The first one implements a valueChangeListener feature. When the user enters a value in the first field, a backing bean function will be invoked through the valueChangeListener . In this backing bean function, based on the value in the first field, I want to assign the value to the second field and display it on the page. Can somebody help me how to achieve this?

    Hi John,
    Here is small example.
    Create two string variables in your backing bean and generate accessors for them.
        private String text;
        private String text1;
        public void setText(String text) {
            this.text = text;
        public String getText() {
            return text;
        public void setText1(String text1) {
            this.text1 = text1;
        public String getText1() {
            return text1;
        }Bind this variables to the value property of the input texts you have. Add the valuechangedlistener for the first input text (and also set autosubmit to true for that item). Also, add the id of the first input text as partial triggers for the second input text. Like,
            <af:inputText label="Label 1"
                          valueChangeListener="#{backingBeanScope.backing_untitled1.textValueChanged}" autoSubmit="true"
            <af:inputText label="Label 2"
                          partialTriggers="it1"/>Finally, put the logic on your value changed listener. Like,
        public void textValueChanged(ValueChangeEvent vce){
            this.setText1("Hi " + vce.getNewValue());
        }Now, when you run the page and enter your name in the first input text, the second input text will display Hi <your_name>

  • How to get and set custom tag attributes

    How do i get and set custom tag attributes from a jsp page?

    Not sure if this is what your looking for, but....
    < taglibprefix:testtag attribute1="x" attribute2="y">
    ...of course, the attributes have to be defined in your taglib (.tld) file

  • Can I set a Session Variable from a Dashboard Prompt, using values that are

    Hi All
    Trying to set a Session Variable to an integer value, by letting users select a text value from the drop-down list on a Dashboard Prompt. The goal is to set the input parameter to the IndexCol function, but to provide the end users with a text description of what they are setting.
    Select Value Set Variable Value
    My 0
    My Team 1
    My Companies 2
    My Teams Companies 3
    Any suggestions on how to accomplish this? Certainly we could populate the drop-down from a data source, however I don't see how to populate a variable with something other than the values on the screen.
    The IndexCol function is referenced in a Filter in Answers, and I'm thinking to populate a Session variable using the (Presentation) variable value set from the prompt. But how to do this? I see a reference to a function NQSSetSessionValue(), but cannot find documentation on how it works.
    Any clue will be greatly appreciated.

    Hi kishore..
    Looks like the link u have sent uses advanced SQL tab to set session variables. I want to know if I can use "set variable NQ_SESSION.myvar= @something" in the "SQL results" -while creating a dashboard prompt-.
    Purpose: I want the session variable to be set based on whatever report that im currently in.
    And i dont want to use presentation variables because im using a reset button in my page.
    My reset script resets presentation variables and NOT session variables.
    Thanks in advance

  • How to get and set graph propertis using UIGraph instance

    I have added barGraph graph component on *.jspx and also added buttons like "Get properties" and "Set Properties". On "Get Properties" button action, I want to get all the attrributes of barGraph using UIGraph and also want to get "getGroupAttributes" and "getSeriesAttributes".
    I saw examples on gettiing the Group attributes using the click event on the graph.
    Is there any way to get the attributes on some button action like "Get Properties" without any click event on graph?

    [Copying the answer here from the internal forum discussion so that other customers can benefit]
    Hi Gopal,
    You can call getValue on the UIGraph to get the GraphDataModel, then to use the data access APIs from there.
    Once you get the DataAccess from the GraphDataModel, you can call getMemberMetadata to get the members on the row and column edge.
    This method is documented in the interface CDFDataAccess:,%20int,%20int,%20java.lang.String%29
    You should use the following constants for the series and groups:
    Use the method getEdgeExtent to find out how many members are in the series and groups:
    Method getLayerMetadata is the correct way to get the names of the layers, a.k.a "dimensions" displayed in the graph.
    DataAccess is used to read the data from the Graph. You set the data in the Graph by setting tabular data, using data binding by dragging and dropping from the data control palette, or by implementing a custom DataSource and setting it on the graph.
    However, implementing a custom data source is not trivial, and you should only use that approach if you can't use tabular data or regular binding against the available data controls.
    This doc chapter might help in understanding data source requirements for different Graph types:
    Hope this helps,

  • How to override the where clause (Bind Variables) in Backing Bean.

    I am using bind variables in VO and using exeutewithparam to pass the values to bind. Which is working fine.
    But what i want now to override the values pro grammatically from backing_bean of that page.
    How can i pass the values to bind variables from bean.
    M Niaz.

    Try this if it works. this is from 10g
    1)create value binding in the backing bean on any action
    FacesContext ctx=FacesContext.getCurrentInstance();
    ValueBinding vb= ctx.getApplication().createValueBinding("#{bindings['account_name1'].inputValue}");
    2) and then set the value for binding
    Now execute the method with method binding and execute it

  • How to get the selected value in SelectOneMenu in backing bean

    Hello all,
    I need your help. I want to have 2 select menus with the second menu's items list are populated based on the selection in the first menu. I don't know how to get the selected value in the backing bean so that I can based on that select menu to populate the second menu's item list. Basically I need to access to the UI Component of the first select Menu and retrieve its selected value.
    Could you help me out?
    Thank you very much in advance,

    Hi Lingo,
    There r two ways of getting the values into the list. First one is hardcoding the values and the second one is use the list and get the values into the list by firing a query in the database.
    Inorder to display the values in the second menu based on the first onces selection we need to add an attribute to the first selectonemenu known as valueChangeListener and we need to sumit the page.
    Here is the sample code
    <h:selectOneMenu id="catalogue"
                                  binding="#{urbean.catalogue}" onchange="submit()"
                                  <f:selectItem itemLabel="Select Catalogue" itemValue="" />
                                  <f:selectItems value="#{urbean.catalogueList}" />
    <h:selectOneMenu id="category"
                                  binding="#{urbean.category}">     <f:selectItem itemLabel="Select Category" itemValue="" />
                                  <f:selectItems value="#{urbean.categoryList}" />
                                  <                         </h:selectOneMenu>
    now in method called by valuechangelistener we need to write the similar code
    public void categoryValueChange(ValueChangeEvent event) {
    String rfnum = (String) event.getNewValue();
    List categoryList = new ArrayList();
    List tempList = new TablenameDAO().getActiveCatByCatalogueID(rfnum);
              for (int i = 0; i < tempList.size(); i++) {
                   Tablename tablename = (Tablename ) tempList.get(i);
                   String value = "" + tablename .getrfnum();
    String label = tablename .getname();
         if (label == null) {
                   label = "";
                   SelectItem item = new SelectItem(value, label);
    ///getActiveCatByCatalogueID (rfnum) should bring the records which r based on the rfnum
    if u follow this process i am damsure that u will get the values in to the secondlist based upon the first list
    Thanks & Regards

  • How to call the show method of Popup from backing bean?

    I wanted to display the results of a search form in a dialog that is placed in popup.
    That is The content of the popup will be rendered from the backing bean, dynamically .
    And so when the form is filled and the submit button is clicked, the form fields have to be submitted to the server, and the results are to be displayed in the dialog,after the PPR response has arrived, and not at the time of calling the PPR.
    Could you explain How this can be achieved?

    The fix for the popup in a template is to give the template an id say "template" and reference the popup in the JavaScript as "template:popupId", where popupId is the value of the af:popup's id attribute.
    Regarding DWR, Joe really did a nice job with this framework. I have to say he got my attention. The one issue though is that JavaScript is an absolute must when using DWR and other frameworks that have a heavy JavaScript tilt. Dealing with JS can be a bit of a hassle due to x-browser idionsyncrascies as well as slow exection of JS. That said I believe Joe has one of the best JS solutions around.
    On the flip side of this ADF Faces is trying to do something a bit different. Firstly, we want to avoid JS. The user should handle as little as JS as possible. In addition,
    ADF Faces has the benefit of a server-side component framework we want to leverage this to make sure there is a limited amount of JS execution on the client.
    So if you want to work with JS, DWR is a good solution. If you want to work with, Java, standards, and a great tooling environement ADF Faces is a better choice.
    Finally, "Reverse AJAX" is a marketing term for "Push". You probably have also heard the term Comet. There are some varations on the protocols used but all-in- all. We are talking about one thing, the ability for the server to "Push" information to the client. Luckily, we provide this ability in a feature called active data channels. You will see this feature in the next preview. By setting an attribute value in a pageDef trees, tables, and BAM components can recieve data from the server via "Push".

  • In Workflow, How to get and set table values at runtime.

    Hi All,
    I m having a doubt,
    here in my workflow, i have used a  object where in i have made a 'Z' method which is suppose to populate a table container.
    Actually after using std SOFC-COMPOSE activity my table which has 4 user id's contains only 1 user id who has runt that activity.
    So in order to get all 4 user's back in the container i made a 'Z' method, which will populate the values back in tht user_id's table.
    But it is not doing so.
    Can you please help me as to how to do it?
    I m sending u the code that i hav written in the method.
    There are 2 codes i tried.
    data : User_Release type table of zfitlevel-zuid,
           wa_user_release type zfitlevel-zuid.
    data: User type table of zfitlevel-zuid.
    swc_get_table container 'User_Release'  User_Release.
    wa_user_release = 'USNOSIJOH'.
    append wa_user_release to User_Release.
    wa_user_release = 'USNOSOSAT'.
    append wa_user_release to User_Release.
    wa_user_release = 'USNOANMER'.
    append wa_user_release to User_Release.
    swc_set_table container 'User_Release'  User_Release.
    and second :  Suppose User is the tabel that has correct values at run-time.
    data : User_Release type table of zfitlevel-zuid,
           wa_user_release type zfitlevel-zuid.
    data: User type table of ZUSRID.
    swc_get_table container 'User'  User.
    swc_get_table container 'User_Release'  User_Release.
    User_Release[] = User[].
    swc_set_table container 'User_Release'  User_Release.
    Please let me know if anyone can solve my doubt asap.
    Thanks & Regards,

    Thanks for the reply.
    But here in my case, there is a problem.
    The table container in Workflow wil hav dynamic entries.
    It will hav to pick it from other dynamic container elements (all single line) and append them in this container table.
    For eg:
    at runtime:
    User1 = 'USABC'
    User_table = 'USABC'
    after one of these user execute a compose mail activity of SOFM-COMPOSE,
    the User_table is left with only one user id who has executed the activity compose.
    suppose USABC executes it so after that the conatiner values are:
    User1 = 'USABC'
    User_table = 'USABC'
    Now i want that this table container shud hav all 4 values even after that activity for other purpose.
    So how can i achieve that?
    Thanks & Regards,
    Edited by: siri on Jul 9, 2008 8:32 PM

  • How to get and set the column order in SharePoint list forms

    I want to read the column order of the SharePoint list forms in SharePoint 2003 sites using any of the available web services and need to set the same order
    in the newly created list in SharePoint 2010.
    I am able to read the fields from SharePoint 2003 and creating the list with same fields in SharePoint 2010, but the column order is not maintaining in
    list forms.
    Also, I need to created the views from 2003 site to 2010 site.
    Please help me...
    Thanks in advance...

    Please try to use the following code to programatically change the order.
    SPList list = web.Lists["Example List"];
    if (list.ContentTypes.Count > 0)
    SPContentType ct = list.ContentTypes[0];
    string[] names = {"Example_x0020_One", "Example_x0020_Two", "Example_x0020_Three"};
    Here is a similar thread for your reference:
    Best Regards
    Dennis Guo
    TechNet Community Support

  • How to Get and Set personalization data from Iview with Java Webdynpro ?

    Hi All,
    I'm trying to get Iview properties from an Iview in the portal, did anyone knows how to do this?
    sample caode?

    You can use PCD API to access iView properties
    Check this link

  • How to get value for a global variable from an exel file?

    Hallo all,
    I am a beginner in LabVIEW and I have  a problem in reading datas from an exel file . I would like to import a group of data with timestamps from exel file to a global variable. for ex. speed, acceleration and position of 4 different sensors to each of its global variable.
    It will be very nice if anyone can give me some ideas.
    Thanking you in advance

    ...continued here

  • How to set List and Tree Binding Value manually from backing bean?

    Dear All,
    I somehow found this code to work so that I could set a value on my bindings from a managed bean.
      public void setBindingExpressionValue(String expression, Object value)
        FacesContext facesContext = getFacesContext();
        Application app = facesContext.getApplication();
        ExpressionFactory elFactory = app.getExpressionFactory();
        ELContext elContext = facesContext.getELContext();
        ValueExpression valueExp =
          elFactory.createValueExpression(elContext, expression, Object.class);
        valueExp.setValue(elContext, value);
      public class MyBean{
      private String employeeId;
      public void inAmethod(){
      }Now, I am thinking. What if I have a List or Tree Binding in my managed bean then how or what should I send
    to the expression value. Is it a List or Map?
    The first one was easy as it is just a string but how about when dealing with collection?
    JDEV 11g PS4

    a tree binding does not set the value of the tree but determines the selected node. The binding itself represents the collection model that shows the hierarchical tree structure. So your question does not apply to a tree

  • How do I get and set cookies with JSF?

    How do I get and set cookies in a JSF managed bean?
    Al Malin

    Below is how I did it...I am receptive to improvements.
    FacesContext facesContext = FacesContext.getCurrentInstance();
    HttpSession session = (HttpSession)facesContext.getExternalContext().getSession(false);
    HttpServletRequest request = (HttpServletRequest)facesContext.getExternalContext().getRequest();
    HttpServletResponse response = (HttpServletResponse)facesContext.getExternalContext().getResponse();
    String cookieName = "myCookieName";
    Cookie requestCookie = null;
    Cookie[] cookies = request.getCookies();"looking for cookie...");
    if (cookies != null)
    for (int i = 0; i < cookies.length; i++)
    if (cookies.getName().equals(cookieName))
    requestCookie = cookies[i]; + " = " + requestCookie.getValue());"done looking for cookie");
    Cookie responseCookie = new Cookie(cookieName, "myCookieValue");

  • How to set a session variable

    I would like to know how to set a session variable for the following purpose.
    At the top of my application I have a "Welcome <username>" I'd like it instead to have "Welcome <firstname> <lastname>".
    So the concept would be after the user logs in succesfully this session variable is dynamically set so it can be displayed.

    Hi Scott,
    I realize that I can set items etc in pages. The case I'm referring to is a reference in a template. My template has a "Welcome <user name>" ... so the code looks like "Welcome &APP_USER." Anyway to make it say "Welcome first_name last_name" in the template? Note I'll have to get the first/last names from a query

Maybe you are looking for

  • Parental controls - how can I remove the preview of apps on the iTouch that aren't appropriate?

    We recently bought 2 itouches for our 8 and 10 year old -- how can I remove the preview of inappropriate apps from showing up on their screens?  I've set the security of apps at age 4+, but the previews are still showing up?  Any advice on how to rem

  • My ipad2 mic is not working. Can someone please help me?

    I Recently discovered that the mic on my iPad 2 with iOS version 8.2 is not working. Please what can I do to get it working?

  • Question for Patrick

    Your online vids ( load fast and look great - I was wondering if you would be willing to explain the codec you're using... if not, thanks anyway for your help in this forum!

  • Can not install aperture

    Other apps install fine, but trying to purchase Aperture leaves me with the 'We could not complete your purchase.  The product distribution file could not be verified.  It may be damaged or was not signed." This happens on 2 of the macs that I might

  • Group mailing list adress

    Hi, maybe this is a stupid question but I have some trouble figuring it out. I have a mail server with several domains. The domain name is set to and the host name is set to Every e-mail user gets the mailadress [emai