Gettting the session value in doDML() of Impl.java

I'm using ADF BC, struts, JSP.
I have the logged in user in my session variable and I want to store that in the database in the timestampfields.
I am 'overriding' doDML' method in my Impl.java. In the 'insert' operation, I want to get the session value. How do you do that. I tried setCreatedBy(session.getAttribute("user")), but it says HttpSession object/class not found.
How do you get the session value in your Impl.java.
Thanks.

Hi,
You don't need to add any library or overwrite prepareSession() method. You may add values to BC session in any time and in any method in business components e.g in Application Module:
private void addToMySession(Integer currUser){
Hashtable userdata = getDBTransaction().getSession().getUserData();
if (userdata == null) {
userdata = new Hashtable();
userdata.put("CurrentUser", currUser);
Then you may get this value in any businnes component e.g. in EO:
protected void doDML(int operation, TransactionEvent e) {
if (operation == DML_INSERT) {
Hashtable userdata = getDBTransaction().getSession().getUserData();
Integer currUser = userdata.get("CurrentUser");
setUserId(currUser);
super.doDML(operation, e);
I hope that explained clearly :) and it helps.
Regards
Kuba

Similar Messages

  • Can we pass the session values to with  ExecuteParms

    hi jdev experts,
    Using jdev 11.1.1.5.0-adfbc
    normally what we do in execute with params. manullay write query something
    like ah:
    select * from employees where empolyeeid= :eid
    here
    eid is bindvariable.
    drag and drop in the type of  execute with params into jspx page it will works fine.
    but my requirement same only one thing is added.
    i will explain in details from start to end.
    i had employee login page.
    Username:100       // this username holds in session
    password:100
    login button
    enters into index page welcome "100"
    when hits search page search page opens
    search page means i write vo as :
    empsearchvo
    select * from employees where empolyeeid= :eid and salary = :sid
    bindvariable
    eid: (default value) adf.context.current.sessionScope.get('eid') in expersion
    sid:
    this vo exposed as execute with params with af:table
    my search page:
    eid: 100   -output text         // by default no need enter the session value showing here.
    sid :  10000  -inputtext        //user has to enter this details
    search (excutewithprams)
    af:table details
    employeeid  | salry | address  | and so on details.is this possible.?
    why am posting the thread means session value is not coming ui. so i cant get my result in af:table.
    can anyone help me? out.

    You should assign the session variable to the parameter at the binding layer of your page.
    Go to the binding tab of your JSF page, find the execute with params - look for the paramter and set the NDValue to point to your session value.
    Similar to this:
    https://blogs.oracle.com/shay/entry/passing_parameters_to_adf_appl

  • I need to add the values stored in the session object into the html textbox

    Dear Sir,
    i have been trying to create an edit employee details page
    What i have done till now is as follow:
    1. Got employee id from HTML page.
    2. Compared it with the id stored in the database.
    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.
    4. Dispatched the session values to another servlet EditEmpDetails2.java
    what i need to do now
    5. Now i need to set the session values in the text field of the html form
    6. I also need to be able to edit those vales and store the edited values in the database.
    Please help me as i have tried doing it for 1 week without any clues
    i have tried to create a html page which is something like this:
    <html>
    <head>
    <title>Edit Employee Details Page</title>
    <body BGCOLOR="red" text="black">
    <h1 ><font color="black">Edit Employee Details Page</font></h1>
    <form action = "EditEmpDetails" method="Get">
    <table width="50% align="center"
    <tr><td>Employee ID: </td>
    <td><INPUT TYPE="TEXT" name="employeeid"<br></td></tr>
    <tr><td><center><input type="submit" value="submit"></center></td></tr>
    <tr><td><center><input type="reset" value="reset" ></center></td></tr>
    </table>
    </form>
    </body>
    </html>
    design of my servlet EditEmpDetails.java
    public void EditEmpDetails1 extends HttpServlet
    public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    PrintWriter out = response.getWriter();
    response.setContentType("text/html");
    HttpSession session = request.getSession();
    String employeeid;
    String X = request.getParameter("employeeid");
    System.out.println("Employee iD:" + X);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con = DriverManager.getConnection("jdbc:odbc:murphy");
    String query = "Select * from users where employeeid=?";
    PreparedStatement stat = con.prepareStatement(query);
    System.out.println(stat);
    stat.setString(1,X);
    ResultSet rs = stat.executeQuery();
    while(rs.next())
    String Z = rs.getString(password);
    if(Z.equals(X))
    String A = rs.getString(1);
    session.setAttribute("employeeid", A);
    String B = rs.getString(2);
    session.setAttribute("firstname", B);
    String C = rs.getString(3);
    session.setAttribute("lastname", C);
    String D = rs.getString(4);
    session.setAttribute("gender", D);
    String E = rs.getString(5);
    session.setAttribute("dateofbirth", E);
    String F = rs.getString(6);
    session.setAttribute("address", F);
    String G = rs.getString(7);
    session.setAttribute("postalcode", G);
    String H = rs.getString(8);
    session.setAttribute("phone", H);
    String I = rs.getString(9);
    session.setAttribute("mobile", I);
    String J = rs.getString(10);
    String url = "/EditEmpDetao;s.java";
    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(url)
    dispatcher.forward(request,response);
    catch (Exception e)
    system.out.println(e)
    I do not know how to put the values stored in the session object into the html text box

    3. If the id is correct then pulled the record of the corresponding employee and stored it in the session object.do you really need to store this in session object?
    5. Now i need to set the session values in the text field of the html form which form? in a new html/jsp page? i suggest go for a JSP
    In your JSP page use JSP expression tags to put the session attributes.
    it's something like : <input type='text' name='employeeid' value='<%= session.getAttribute("employeeid") %>' >and you need to generateanother servlet for saving the details/modifications to the database.
    I think i m clear enough.
    if you need more clarifications. just try it and then post your problem.
    Diablo

  • Session geting null in AM Impl class

    All,
    In my root AM IMPL class i am setting the session variables as follows
            if(pAccountNumber!=null) getSession().getUserData().put("accountNumber",  pAccountNumber);
            System.out.println("User Account Number from Session is : " + getSession().getUserData().get("accountNumber")); //this value is getting printed
            if(pBranch!=null) getSession().getUserData().put("branch", pBranch);
            if(pItem!=null) getSession().getUserData().put("item", pItem);
            if(pOrganizationCode!=null) getSession().getUserData().put("organizationCode", pOrganizationCode);
            if(pCustomerId!=null) getSession().getUserData().put("customerId", pCustomerId);
            if(pCustomerName!=null) getSession().getUserData().put("customerName", pCustomerName);In my AM impl class extending the root Ampl class i am calling the getSession() like this
            ViewObjectImpl itemStockVo = getItemStock();
            _logger.fine("Account Number from Session : " + getSession().getUserData().get("accountNumber")); //this is printing as nullPlease advice what is wrong here ?
    thnks
    jdev 11.1.1.5

    Yes can be but as i have not disabled the AM pooling and the account name is coming null evne in the first go, i sense that may not be the issue (I may be wrong here).
    For your second part Timo, i am setting the session value as the default activity when the taskflow loads and i am trying to get it in the next view activity

  • Using Date Picker on form causes session values to be cleared on validation

    Got a really weird problem on a form (on a report). We have a basic form which has a date picker on. The form fires a number of bog standard validations when the Create button is clicked (values filled in, values are numbers etc).
    When a validation fails, the values inputted by the user are retained. So far so good. However, when the user selects a date, and a validation fails, all the session values are all cleared (not just the date picker) and they have to fill everything in again.
    At first we thought there must be a process resetting the page items - nothing. Also recreated the page from scratch and it still doesn't work. Strangely, the problem goes away if we change the date picker to a text field. Also, if the user doesn't select a date, the other session values are retained.
    Are we doing something daft here or is this a bug?

    Yes - we're using inbuilt validation to ensure it's a valid date. We tried turning this off and it makes no difference, the problem is still there.
    We tried changing the date picker to a text field and using the same validation (i.e. check it's a date) and this works fine. This is why we think it might be a bug.

  • Session value

    hi experts,
    am using jdev 11.1.1.5.0 - adfbc- oracle db10g.
    here i what i want.
    following season class >> scope is session scope..
      <af:inputText label="anni" id="pann"
                                  value="#{season.p_ann}"
                                  contentStyle="text-transform:uppercase;"
                                  required="false"
                                  shortDesc="anni"
                                  />
    public class season{
        String p_ann;
        public void setP_ann(String p_ann) {
            this.p_ann=p_ann;
        public String getP_ann() {
            return p_ann;
    }i want to get this value of getP_ann() in seasonEO > ann attribute section >> edit attribute wizard >> default value.
    in that place i want. the session value.
    how can get this.?

    hi all,
    thanks for all valuable suggestion, and one small sweet thanks to all spending time here for my thread.
    here i watched out all of the posts,
    helpfull resource for me. to achieve my task.
    Thread: Groovy expression to access the session scope variable in ADF 11g
    Groovy expression to access the session scope variable in ADF 11g
    Thread: set value in global variable. //important
    Re: set value in global variable.
    Thread: Use sessionScope as Binding Variable value //important
    Use sessionScope as Binding Variable value

  • Spreadsheet from Iframe in APEX 4.1 not using session values

    We recently upgrade to Apex 4.1 and now the spreadsheet option within an iframe is not using the session values to limit the records downloaded into the spreadsheet. This only happens with Internet Explorer running running under windows 7. I don't have control to change anything on the webserrver where the Apex Iframe is running. Is there any option within APEX that can be set so that the spreadsheet will only contain what is displayed on the form versus all the records. The spreadsheet download ignores any criteria that was applied the the report on the same page.
    Thanks,
    Nancy

    Hi Dan,
    thank you for your answer. I have the solution now from Kleber_M, this works.
    Dan McGhan wrote:
    1. Use bind variables in my query. It would look something like:
    SELECT *
    FROM region
    WHERE region LIKE '%'|| :P3_REGION ||'%'
    AND country LIKE '%'|| :P3_COUNTRY ||'%'
    AND city LIKE '%'|| :P3_CITY ||'%'
    This was only a mistake when writing the post, i forgot the colon. I use bind variables of course.
    2. Make sure you have a comma separated list of item names that the report depends on beneath the SQL Query where it says Page Items to Submit. This will make sure that the value of those items on the page are bound into session state prior to the query executing.I tried this, too, but without success...
    3. Use Dynamic Actions to perform the refresh action when any of the three items changes. This would be both more performant and a better experience for the end user than a full page refresh.How can i do this. This sounds good, because when refreshing the page often some items oder actions are done that i don´t want to.
    Regards,
    Matze

  • How To retain Session Value in OBIEE

    I have a requirement to pass session variable from one page to next page in the dashboard.
    Requirement :
    In Presentation Part:
    Prompt : Column1: Year
    Column2: Quarter
    I have to pass the Value selected in the dashboard prompt to the repository. To achieve this, I have stored the Year and Quarter Column value in 2 Request variables from the prompt.
    Request Variable1 : VarYear stores Year Value selected
    Request Variable2 : VarQuarter stores Quarter Value selected
    In Repository Part:
    1. I have created 02 session variables in repository with the same name as : VarYear and VarQuarter
    2. Under the Intitialization Block of Both Variables I have written a dummy Query as
    'SELECT PER_NAME_ENT_YEAR FROM W_DAY_D WHERE PER_NAME_ENT_QTR IS NOT
    NULL'
    3. Checked the Box to 'Enable any user to set the value' for both the session variables.
    4. Used the session variable to pass as a filter under the content tab of the LTS of Revenue Measure as follows:
    '"Oracle Data Warehouse".Catalog.dbo.Dim_W_DAY_D.PER_NAME_ENT_YEAR = VALUEOF(NQ_SESSION."VarYear") AND "Oracle Data Warehouse".Catalog.dbo.Dim_W_DAY_D.PER_NAME_ENT_QTR = VALUEOF(NQ_SESSION."VarQuarter")'
    Resolution : The session variables from the prompt is passing properly to the RPD and returning the result as expected for the current page(Both Prompt and the Report are in same page where I used the measure Revenue which is getting filtered in the LTS on the basis of Quarter & Year under Content Tab).
    Reuirement2 With Issue :
    I have to navigate from one page to another on click of Revenue measure value. The target page also contain the same Revenue measure as in First page. But On navigating from one page to another page the session value is getting lost and passing the by default value coming from the Session Initialization block insted of the value selected in the prompt.
    As per my understanding the session value should not be replaced untill a user log out from the application. But in my case for First page where I have both Promt and the Revenue measure the Prompt value is passing properly but When I am moving to second page where I have only the Revenue measure the session value which is already set early is replaced by Session IB query result.
    Please suggest me if there is any resolution for my issue.
    Thanks a Lot in advance.
    :)

    I've had this issue myself and here is what i found. The only way I could get it to work was to have the Prompts that populate the Session Variables on the pages. In other words if I had the prompt on one page and then used guided navigation to go to another dashboard page I needed to have the same prompts located on that page for the session values to get passed into. Since in my case I didn't want the prompts to display or the User to know I had to add Dashboard prompts in order to captures the passed Session Variable values, I placed the dashboard prompts for my Session Variables in a separate section and then hid that section from the User. I hid the section by selecting Properties - Custom CSS Style Options (HTML Only) and then clicked on the check box for Use Custom CSS Style. In the text box enter display:none which will cause the section to be hidden from the User. The prompts will then exist on the dashboard page to receive the session values and the User will never know it is there.
    Hopefully this helps.
    Eric
    http://www.BIConsultingGroup.com

  • How to get Session value in Custom OAF page

    Hi,
    Already existing Custom oaf page is there in that they seted  session value using the following API
    String s = (String)oapagecontext.getSessionValueDirect("page");
    here s is getting null value how can i get the session value is there any another method to get the session value in custom page
    please  anybody help me ASAP.
    Thanks,
    Krishna Mannala

    Hi,
    Is that value set anytime before you are trying to get that?
    Please provide relevant details and code here.
    Regards,
    Sandeep M.

  • [SOLVED]How can I setWhereClause using a session value ?

    I have a session value that I want to use to pass as the bind variable to my Where clause on a View object.
    I have dragged the view from the data control pallete onto my page as an ADF form.
    I need to be able to set the Where clause of this view programmatically but I don't know where I should do this. Basically on entering this page the where clause should get set programmatically to the session value.
    I thought about creating a static block in my page's backing bean and doing it there but how would I access the view object from there ?
    Or should I create a Service method that sets the where clause and does an executeQuery and expose that to my page and execute it from my page's backing bean ?
    cheers

    Hi Dom,
    If you are using Oracle's binding layer - you could add a binding for "ExecuteWithParams" to the pagedef (right-click the bindings folder, add action binding, pick your View Object, choose execute with parameters as action); use an EL expression based upon sessionScope as the value for the bind variable.Then, add an invokeAction to the pageDef (right-click executables folder, choose invokeAction), specifying your executeWithParams binding as the binds property.
    Hope this gets you started.
    John

  • Can I use my javascript to change the session state of an item?

    All,
    I currently have a page that has two regions: a report and a checkbox region. The checkbox region is full of checkboxes that are tied to each column in the report. I have javascript in the page HTML header that hides/displays the report column when they click the corresponding checkbox. The hiding and displaying columns works just fine.
    Here is my problem: my users need to export the report (with some columns hidden) as a CSV file. Unfortunately, the javascript function I use to hide/show the columns does not change the session value of the checkbox region and thus, APEX does not 'know' that some columns have been hidden. Because of this, APEX exports ALL columns.
    Can I add an onChange to my javascript that each time the user checks/unchecks a box, it adds/removes that item from the checkbox region's session value?
    Thanks!
    BoilerUP
    P.S. I do not want to submit the page - I would like for this to be done on the fly, just like the columns hiding/appearing with the javascript. Thanks!
    Message was edited by:
    BoilerUP

    Ok, I still cannot get this to work. I keep getting a javascript page error (yellow exclamation icon in I.E.) I have the following code in the HTML header:
    <script language="JavaScript" type="text/javascript">
    function va_GetCheckboxes(pName)
    var d=document;
    var l_return = "";
    var inputs=d.body.getElementsByTagName('INPUT');
    var l_el;
    for (var j=0;j<inputs.length;j++) {
         l_el = inputs[j];
         if (l_el.type=="checkbox" && l_el.name && l_el.name==pName
             && l_el.checked) {
                l_return += ":" + l_el.value;
    return l_return.substring(1);
    </script>I also have the following code in the HTML Form Element Attributes section for the checkbox item:
    onclick="html_HideBasedOnCheckBox(this,this.value);set_Some_Item('P2_COLUMN_HIDE_CHECKBOXES',that_string)"Do I need to replace "that_string" with something or is there something else that I'm doing wrong?

  • Edit session value after login

    I would like to edit the session value of a session that is set after a user logs in.
    Problem:
    I have a field 'date of birth' in my database: yyyy-mm-dd, but i need the age value instead in the session.
    I know how to calculate this but that is not the question, i need to know where to edit this value so that after a login the session is set to the age of the user instead of his/her date of birth value from the database.
    I hope you understand.
    Can someone please help me out...
    Thanks,
    Jim

    Hi Jim,
    <br />
    <br />nope, Adobe/Interakt are not participating here.
    <br />
    <br />However, I do *think* that converting these values *upon* login seems quite weird to do -- ADDT´s session variables are based on the "as is" contents of DB table fields, and what you´re asking for is a very special usage scenario which was even never asked for in the Interakt forums, so that´s why assumingly other forum particpants reading this keep scratching their heads as well.
    <br />
    <br />The only approach I can suggest for now, is to convert the session variables *after* login, and that´s quite easily possible -- on that very page that´s going to display the banner, it should be possible to initialize the abovementioned "calculate age from birthday" conversion routine and assign the session variable "current_age" to the PHP variable "$birthday_user", e.g. $birthday_user = $_SESSION['current_age'];
    <br />
    <br />Once you have this clearly assigned, all you´d have to do is to apply a "Show IF conditional region" that´s checking against the $birthday_user value, e.g.
    <br />
    <br /><?php<br />// Show IF Conditional region_check_user_age<br />if ($birthday_user < 20) {<br />?>
    <br />display banner for folks under 20
    <br /><?php<br />// else Conditional region_check_user_age<br />} else { ?>
    <br />display banner for folks older than 20
    <br /><?php }<br />// endif Conditional region_check_user_age<br />?>
    <br />
    <br />As the line breaks in the code posted above will most likely disappear as before, I´m attaching a text-only version
    <br />
    <br />Cheers,
    <br />Günter Schenk
    <br />Adobe Community Expert, Dreamweaver

  • WDScopeUtil - Session value clears soon problem

    Hi Experts,
    We are trying to set some value in session using Webdynpro, but its getting cleared after sometime. We are setting the Value in one WD application and using it in all other WD application.
    The method used to put and get is given below.
    Is there any other method which can be used so that the session value stays.
    Setting the Value using:
    WDScopeUtil.put(WDScopeType.CLIENTSESSION_SCOPE, "APP_NAME", appvalue1);
    Getting the Value from session:
    WDScopeUtil.get(WDScopeType.CLIENTSESSION_SCOPE, "BP_ID");
    Thanks

    Hi Mohamed,
    Could try the HttpSession method  instead of your session method.
    This is the set method,
          HttpServletRequest request = ((IWebContextAdapter).wDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();
          HttpSession session = request.getSession(true);
         session.setAttribute("XXX","Test1");
    and this one is get method,
    String getString = "";
    HttpSession session = wdContext.currentSessionElement().getHttpSession();
    getString = session.getAttribute("XXX").toString();
    Regards,
    Prabha

  • Renewing a session value on page render.

    Hi,
    Does anyone know of an easy way of renewing the session value when a page is loaded.
    I have an app that is mostly public so logging in is not required for most of it. When the user returns to the initial page (probably using the browser buttons) I need the page to generate a new session value.
    Can this be done in a simple url. I tried creating a process Before Header with
    owa_util.redirect_URL('f?p=APP_ID.:6');
    i.e. without the &SESSION. value, hoping that this would force a new session to be created, but it doesn't work.
    Any ideas?
    Cheers
    Yog

    Yog - what version of HTML DB? And why do you want a new session created?
    Scott

  • The session variable, NQ_SESSION.OU_ORG, has no value definition.Please have your System Administrator look at the log for more details on this error. (HY000)

    Hi All,
    I have created a user 'Bitest' and group 'Bi_Test_Group'. Assigned the user to the group and the group to BI consumer role.
    I gave access to only procurement and spend catalog folder reports and Dashboards.
    When I login to BI Presentation Services with above created user and open any procurement and spent catalog dashboard i am getting below error in every report.
    Its BI Apps 7.9.6.3 installation.I gave read  access to group to all procurement and spent subject area.
    Error Codes: OAMP2OPY:OPR4ONWY:U9IM8TAC:OI2DL65P:OI2DL65P 
    Odbc driver returned an error (SQLExecDirectW). 
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 23006] The session variable, NQ_SESSION.OU_ORG, has no value definition.Please have your System Administrator look at the log for more details on this error. (HY000) 
    SQL Issued: {call NQSGetQueryColumnInfo('SELECT Fact."PO Amount" FROM "Procurement and Spend - Purchase Orders"')}
    SQL Issued: SELECT Fact."PO Amount" FROM "Procurement and Spend - Purchase Orders"
    Please help me in resolving this issue and getting results on Dashboard.
    Thanks in advance
    Thanks,
    Sandeep

    Check your query or connection pool settings etc

Maybe you are looking for

  • Configure HS talk to mysql through ODBC

    Hello Running 10g rel2 on Linux 64bit. Need to dblink to mysql 5. Configured: /etc/odbc.ini [myodbc] Driver = /usr/lib64/libmyodbc.so Description = MyODBC 2.50 Driver DSN SERVER = 209.71.254.40 PORT = 3306 USER = posman Password = posman Database = p

  • Song doesn't show I can buy ringtone.

    Hi! I downloaded a song that I wanted as a ringtone and when I go to my library and find the song it doesn't say that I can use it as a ring tone (the little bell isn't there). Am I doing something wrong or can anyone give me some advice on how to do

  • Flash Builder can't Test or Debug

    Recently I've not been able to test or debug my Actionscript projects. Everytime I try I get the following error screen. I tried reinstalling Flash and the individual debuggers (do I need to use them to replace a file?) Current specs are: > Adobe Fla

  • How to sync with Mac in OS X 10.7 Lion?

    I just installed OS X 10.7 Lion and noticed the iSync app is gone? How do I sync my contacts and calendar between my Nokia N8 and my MacBook Pro? Solved! Go to Solution.

  • I have two podcast "folders" in the Library, and system crashes when I try to Refresh

    How can I remove the second listing for Podcasts from the iTunes Library - it appeared automatically when I subscribed to a new podcast and now when I try to refresh the old list (where all my podcasts were downloaded) iTunes crashes... repeatedly. T