Session value to JavaBean

i have a value and set it to session. I can get it by session.getAttribute(" xxx") at another jsp page, Can I pass the value into a java class to perform some task ?

Sorry about that, i do not know about the HttpSession
I have this in a.jsp page
String sRand="";
for (int i=0;i<4;i++){
String rand=String.valueOf(random.nextInt(10));
sRand+=rand;
g.setColor(new Color(20+random.nextInt(110),20+random.nextInt(110),20+random.nextInt(110)));//???????????????????????????????
g.drawString(rand,13*i+6,16);
session.setAttribute("rand",sRand);
in JSF a inputText for user enter value
in Validator file i write this
public void validateCode(FacesContext context, UIComponent toValidate,Object value) {
          String code = (String) value;
// is it declare HttpSession code here? But how i specify the session is from the a.jsp page
          if (!rand.equals(code)) {
               throw new ValidatorException(new FacesMessage("Invalid"));
          }

Similar Messages

  • GetParameter, setAttribute and session values

    I am having a problem forwarding values to a jsp from my servlet.
    This problem only occurs when multiple users are accessing the same pages to make a payment.
    The value is passed from the page to the servlet.
    The servlet gets the value using a getParameter.
    //Get the value from the previous page
    String DocTotal = request.getParameter("DocTotal");
    logger.debug("DocTotal: " + DocTotal);
    //set the value to pass to next page
    request.setAttribute("payAmount", DocTotal);
    displayTemplate(CREDITCARDPAYMENT);
    displayTemplate code follows.
    RequestDispatcher rd = getServletContext().getRequestDispatcher(template);
    rd.forward(req, res);
    I then set the value in the request object to pass to the next page.
    This all seems to work fine for a single user but when I I have more than one user, one user will get a null for value being passed on the next page and the other user will not get the page displayed.
    It is like my session values are getting stomped on by the other user.

    The changes that you have suggested seem to work, but I still have a problem.
    One user seems to be able to get the data passed successfully to the next jsp, but the other just gets a blank screen. If the user with the blank screen refreshes they get the screen with the data. It is as if the servlet hangs up when calling the page. I am not sure.
    Here is the code that is being accessed with formatting.
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    req = request;
    res = response;
    HttpSession session = req.getSession(true);
    logger.debug("Made it to the doPost method of DownloadUtilServlet!");
    logger.debug("session: " + session);
    String cmd = req.getParameter("cmd");
    logger.debug("cmd equals: " + cmd);
    if ((cmd != null) && cmd.equalsIgnoreCase("forwardPaymentInfo")){
    XCBillerCenterItem bci = null;
    try{
    logger.debug("XCConfig.CCUSER: " + XCConfig.CCUSER);
    bci = new XCBillerCenterItem(XCConfig.CCUSER);
    catch(Exception e) {
    logger.debug("XCBillerCenterItem Create: " + e);
    String ccList = bci.getCCTypes();
    req.setAttribute("ccList", ccList);
    logger.debug("cmd equals: " + cmd);
    String DocTotal = req.getParameter("DocTotal");
    logger.debug("DocTotal: " + DocTotal);
    req.setAttribute("payAmount", DocTotal);
    displayTemplate(CREDITCARDPAYMENT);
    }//User has paid, proceed to download
    else if ((cmd != null) && cmd.equalsIgnoreCase("downloadreportfilter")){
    displayTemplate(DOWNLOADREPORTFILTER);
    else{       
    GetParameters(req, res, session);
    public void displayTemplate(String template)
    try
    RequestDispatcher rd = getServletContext().getRequestDispatcher(template);
    rd.forward(req, res);
    catch(Exception e)
    e.printStackTrace();

  • Get a insert session value for SQL query at report

    Hi friends
    I created a global temp table and procedure to support web search form.
    and a search result report. The procudure
    gets search result from multip tables and
    insert into temp table --recordsearch. I can get value from temp table  by call procedure
    at SQL*Plus.
    However, I can not get this value by web report.
    How can I get this insert session value and pass to SQL query for report?
    Thanks,
    Newweb
    CREATE GLOBAL TEMPORARY TABLE recordsearch
    (emp_id          VARCHAR2(200),
    ssn               VARCHAR2(9),
    fname          VARCHAR2(200),
    lname           VARCHAR2(200),
    m_name          VARCHAR2(200)
    ) ON COMMIT PRESERVE ROWS;

    it possible that your web form does not have a persistent, dedicated connection. if you have connection pooling for example, multiple sessions will see the same instance of the GTT, so if one deletes it, then nobody sees it (or you can see others data). if the connections are not persistent, then they can disconnect between calls, deleting the GTT table.

  • How to pass session variable value with GO URL to override session value

    Hi Gurus,
    We have below requirement.Please help us at the earliest.
    How to pass session variable value with GO URL to override session value. ( It is not working after making changes to authentication xml file session init block creation as explained by oracle (Bug No14372679 : which they claim it is fixed in 1.7 version  Ref No :Bug 14372679 : REQUEST VARIABLE NOT OVERRIDING SESSION VARIABLE RUNNING THRU A GO URL )
    Please provide step by step solution.No vague answers.
    I followed below steps mentioned.
    RPD:
    ****-> Created a session variable called STATUS
    -> Create Session Init block called Init_Status with SQL
        select 'ACTIVE' from dual;
    -> Assigned the session variable STATUS to Init block Init_Status
    authenticationschemas.xml:
    Added
    <RequestVariable source="url" type="informational"
    nameInSource="RE_CODE" biVariableName="NQ_SESSION.STATUS"/>
    Report
    Edit column "Contract Status" and added session variable as
    VALUEOF(NQ_SESSION.STATUS)
    URL:
    http://localhost:9704/analytics/saw.dll?PortalGo&Action=prompt&path=%2Fshared%2FQAV%2FTest_Report_By%20Contract%20Status&RE_CODE='EXPIRED'
    Issue:
    When  I run the URL above with parameter EXPIRED, the report still shows for  ACTIVE only. The URL is not making any difference with report.
    Report is picking the default value from RPD session variable init query.
    could you please let me know if I am missing something.

    Hi,
    Check those links might help you.
    Integrating Oracle OBIEE Content using GO URL
    How to set session variables using url variables | OBIEE Blog
    OBIEE 10G - How to set a request/session variable using the Saw Url (Go/Dashboard) | GerardNico.com (BI, OBIEE, O…
    Thanks,
    Satya

  • Passing Session Values to the Tabular Form Element of a Report Column

    Hello,
    I'm running application express version 2.0 with a 10.2.0.2.0 database on a 32 bit windows box. I'm trying to figure out sneaky a way to pass the &APP_PAGE_ID., #APP_PAGE_ID# or V('APP_PAGE_ID'); as an element attribute of a Report Tabular Form Element set to display as a Select List (named LOV).
    It seems that whatever option I choose, the Element Attributes field will only render the literal value of what I have entered. This is part of the solution but I would like to find a way to pass the current page id.
    What I'm trying to do is utilize the ONCHANGE attribute to redirect to a report page in my application when the value from a Select List (named LOV) is selected.
    I could work around this by creating my own table output with PL/SQL and HTP.P commands but would really be interested in finding out if I can use the reporting structures which are already available through Application Express.
    Any ideas?
    Thanks.
    Justin.

    Thanks for the response Earl. To clarify this is what I've done and what I hope to achieve:
    I currently have a LOV for my application that identifies a number of database report types: DB Options, DB Parameters, DB Version, and so on.
    I have an application express report being generated for the databases I'm monitoring and it displays as follows:
    - HOST -- DBTYPE -------- DBNAME - DBREPORTS
    =====================================
    - SVR 1 - Oracle 9.2.0.1 - DEV -------- [LOV HERE]
    - SVR 2 - Oracle 9.2.0.7 - TST --------- [LOV HERE]
    I am displaying the LOV on my report the the options under the reports attribute tab in my application builder. I insert my LOV select list by editing the DBREPORTS column and set the "Display As:" option under Tabular Form Element to "Select List (named LOV)"; I have also added my LOV to the "Named LOV" option under List of Values.
    So far this achieves everything I would expect and works quite well (a select list with my report types appears in my monitor report for each DB that is returned).
    What I'm interested in doing now is opening a DBREPORT for a given database by simply choosing the report type from my LOV. I can set the "Element Attributes" option under Tabular Form Element to execute a javascript call for any valid event (in my case I'm using ONCHANGE).
    My only issue is that I cannot find a way to pass any session values from my page to my Element Attribute. If, in the Element Attributes field I enter:
    onchange="alert(this.value);" //my dialogue box will display the value of my current selection when I choose a report type.
    What I'd love to be able to do is something like:
    onchange="alert('&APP_PAGE_ID.');" //so my current page id is written to the element.
    Unfortunately, only my literal text seems to be rendered. Rather than having my dialogue come back with my page number, say 75, I receive the literal value &APP_PAGE_ID.
    Notwithstanding any quote issues, I've tried to dump a test html attribute to my source html by entering any of the following in the Element Attributes field:
    test=&APP_PAGE_ID.
    test=#APP_PAGE_ID#
    and as a shot in the dark knowing that I'm not using PL/SQL:
    test=V('APP_PAGE_ID');
    In every case when I view source I see the literal value of what was entered in the Element Attributes field (ie "test=&APP_PAGE_ID." instead of "test=75").
    What makes things a little more frustrating is that I can drop &APP_PAGE_ID. into the Column Heading field (ex My Heading &APP_PAGE_ID.), it renders as I would expect; "My Heading 75". If we could find a solution to this, I could see a number of slick uses for this type of functionality.
    Hope this helps,
    Thanks.
    Justin.

  • 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.

  • In Jsp TagLib how can I get the Attribute value (like JavaBean) in jsp

    Dear Friends,
    TagLib how can I get the Attribute value (like JavaBean) in jsp .
    I do this thing.
    public void setPageContext(PageContext p) {
              pc = p;
    pc.setAttribute("id", new String("1") );
              pc.setAttribute("first_name",new String("Siddharth")); //,pc.SESSION_SCOPE);
              pc.setAttribute("last_name", new String("singh"));
    but in Jsp
    <td>
    <%=pageContext.getAttribute("first_name"); %>
    cause null is returing.
    Pls HELP me
    with regards
    Siddharth Singh

    First, there is no need to pass in the page context to the tag. It already is present. How you get to it depends on what type of tag:
    Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/SimpleTagSupport.html]SimpleTagSupport
    public class MyTag extends SimpleTagSupport
      public void doTag()
        PageContext pc = (PageContext)getJspContext();
        pc.setAttribute("first_name", "Siddharth");
        pc.setAttribute("last_name", "Singh");
        pc.setAttribute("id", "1");
    }Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html]TagSupport or it's subclass [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/BodyTagSupport.html]BodyTagSupport the page context is aleady declared as an implicit object:
    public class MyTag extends TagSupport
      public void doStartTag()
        pageContext.setAttribute("first_name", "Siddharth");
        pageContext.setAttribute("last_name", "Singh");
        pageContext.setAttribute("id", "1");
    }In each case, this sort of thing should work:
    <mytags:MyTag />
    <%= pageContext.getAttribute("first_name") %>I

  • 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 display Session value of an item  using Javascript?

    Hello All,
    I have a file browse item and I browse some file and click on upload, i run this javascript :
    function passBack()
    javascript:doSubmit('UPLOAD');
    alert('hi');
    var var_flag = $x('P91_FILE');
    alert(var_flag.value);
    opener.document.forms["wwv_flow"].f05[3].value = var_flag.value;
    close();
    </script>
    It dispalys 'hi ' as per the first alert.
    For the second alert it shows the file path value . ( C:\test\test1.sql).
    I need the file session value to be displayed here
    Like the following :
    F477093380/test1.sql
    and then I need to pass that value to parent page. and close the child page.
    Any idea?
    Thanks in advance.
    Regards,
    Archana

    Archana,
    I'm not sure about javascript, but u can use a sql query on the "APEX_APPLICATION_FILES" view to obtain that.
    Something like:
    SELECT id,NAME
      FROM APEX_APPLICATION_FILES;

  • 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

  • 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.

  • Need to store multiple session values in flex

    Hi,
         I need to store multiple session values in flex based on the user who logged in.
    For Example, if a user logged in as an administrator and in another windows another user logged in as guest, i need to maintain two seperate session for the two different users.
    Is it possible for maintaining different sessions.
    Expecting your valuable response.
    Thanks
    Jude Paul

    Look at Shared Objects. You can store this information in them by creating a unique object for each type of user.

  • 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

Maybe you are looking for

  • PCS no longer sees Bluetooth Widcomm driver

    Hi I have a 6230i and a Safecom BT dongle using the Widcomm 1.4.2 build 10 BT driver s/w on Vista. This all used to work OK, but after installing PCS v6.85.14.1, the Nokia Connection Manager now no longer shows the Bluetooth (Widcomm) option - just t

  • Oracle on SuSE Linux 6.0-6.1-6.2

    If you are installing Oracle 8.0.5.0, Oracle 8.0.5.1,Oracle 8.1.5 (8i),Oracle WebDB 2.0.5.6.1,or Oracle OAS 4.0.7 please check the following page out for instructions... http://www.suse.de/~mha/oracle/ null

  • Crystal Report Font ISSUE in PDF

    Use the CR9 and CR2008 open the same report template file and export it as pdf file. The font format in the two pdf files are different. I compared the font size using File-Options (Fonts used in this document), In the pdf file created by CR9, it is

  • Clients no received ip address from Non-root APs

    I have 3 AP,  one roor and Non-root. The Root AP is connected to ADSL modem which provide DHCP. the clients form root AP received IP without problem, but whe I try to associate to  non-root AP I can not receive ip from DHCP. What it could be the reas

  • Ratpoison border color

    Well, I dabbled in openbox and fluxbox for a while, but have switched back to ratpoison 'cos despite its flaws, its mouseless charm is lovable Anyway, although I haven't changed my ratpoisonrc from before, my border around urxvt is now white instead