How Can I use a Variable  in Data Controls query. Frank Kindly check...

Hii,
I am using JDeveloper 11g ADF BC.
My Requirement is that I hv a login screen which is taken from [http://blogs.oracle.com/shay/simpleJSFDBlogin.zip].
I hv attached BC in this application. I want to use the login usercode in the next pages after login screen. Next screen contains 3 list items which will be populating based on the user. So I created <af:selectOneChoice> using the BC( Just drag & dropped the column into the page from the data controls). But in the data control i want to use this usercode for passing the condition. Now Data is coming without any condition.
So How can I use the usercode in the Data controls query.
When I tried to display the usercode in the next page it is showing by binding the value. its code is follows
<af:outputText value="#{backing_getUser.uid}"
The program for checking the username & Password is follows.
package login.backing;
import oracle.adf.view.rich.component.rich.RichDocument;
import oracle.adf.view.rich.component.rich.RichForm;
import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.component.rich.layout.RichPanelFormLayout;
import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
import java.sql.*;
import java.util.List;
import java.util.Map;
import oracle.adf.view.rich.component.rich.output.RichMessage;
import oracle.jdbc.OracleDriver;
public class GetUser {
private RichInputText uid;
private RichInputText pid;
private RichCommandButton commandButton1;
private RichInputText inputText1;
private RichInputText inputText2;
public void setUid(RichInputText inputText1) {
this.uid = inputText1;
public void setPid(RichInputText inputText2) {
this.pid = inputText2;
public RichInputText getUid() {
return uid;
public RichInputText getPid() {
return pid;
public void setCommandButton1(RichCommandButton commandButton1) {
this.commandButton1 = commandButton1;
public RichCommandButton getCommandButton1() {
return commandButton1;
public String login_action() {
// Add event code here...
String user = this.getUid().getValue().toString();
// String pass = inputText2.getValue().toString();
String pid = this.getPid().getValue().toString();
Connection conn;
conn = getConnection();
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery ("SELECT usercode FROM guser where usercode = '"+user.toUpperCase()+"' and pwd=F_TEST('"+pid.toUpperCase()+"')");
if (rset.next()) {
conn.close();
return "good";
conn.close();
} catch (SQLException e) {
System.out.println(e);
return "bad";
public static Connection getConnection() throws SQLException {
String username = "ACCTS";
String password = "ACCTS";
String thinConn = "jdbc:oracle:thin:@SERVER1:1521:G5PS";
DriverManager.registerDriver(new OracleDriver());
Connection conn =
DriverManager.getConnection(thinConn, username, password);
conn.setAutoCommit(false);
return conn;
public void setInputText1(RichInputText inputText1) {
this.inputText1 = inputText1;
public RichInputText getInputText1() {
return inputText1;
public void setInputText2(RichInputText inputText2) {
this.inputText2 = inputText2;
public RichInputText getInputText2() {
return inputText2;
-----

Hi,
I didn't look at the example, but if you want to secure your application then you should use container managed security. Read this .
Anyway, you could add this before return "good"; in your login_action()
FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("username", user);Then, you can access this from anywhere in the application by using #{sessionScope.username}.
Pedja

Similar Messages

  • How can i use substitution variable

    Hai All
    This is my sql statement
    SELECT (TO_DATE(TO_CHAR(Intime,'DD-MON-YYYY')||' '||
    TO_CHAR(0815,'0000'),'DD-MON-YYYY HH24:MI')-intime) * 24*60
    from dail_att where to_char(intime,'hh24mi') between 0700 and 0815 ;
    Here my table name called Dailyattendance
    Intime field is declared as Date Type
    So now i have hardcoded 0815 and now my intime is subtracted from this time so i can calculate the employee
    coming late so how can i use substitution variable here to give the value at run time
    Ie i need to give 0815 instead or any other time at runtime
    Thanks In advance
    Srikkanth.M

    Where exactly are you planing to use it? Is sqlplus or at any other front end?
    One way is to use below given SQL
    SELECT   (  TO_DATE (   TO_CHAR (intime, 'DD-MON-YYYY')
                         || ' '
                         || TO_CHAR (:TIME_VAR, '0000'),
                         'DD-MON-YYYY HH24:MI'
              - intime
           * 24
           * 60
      FROM dail_att
    WHERE TO_CHAR (intime, 'hh24mi') BETWEEN 0700 AND 0815;*009*
    Edited by: 009 on Apr 6, 2010 2:15 AM

  • How can I use environment variables in a controller?

    Hi all,
    How can I use environment variables in a controller?
    I want to pass a fully qualified directory and file name to FileInputStream and would like to do it by resolving an env variable, such as $APPLTMP.
    Is there a method somewhere that would resolve this??
    By the way,Did anyone used the class of "oracle.apps.fnd.cp.request.RemoteFile"?
    The following is the code.
    My EBS server is installed with 2 nodes(one for current,and other is for application and DB).I want to copy the current server's file to the application server's $APPLTMP directory. But the result of "mCtx.getEnvStore().getEnv("APPLTMP")" is current server's $APPLTMP directory.
    Can anyone help me on this?
    private String getURL()
    throws IOException
    File locC = null;
    File remC = new File(mPath);
    String lurl = null;
    CpUtil lUtil = new CpUtil();
    String exten;
    Connection lConn = mCtx.getJDBCConnection();
    ErrorStack lES = mCtx.getErrorStack();
    LogFile lLF = mCtx.getLogFile();
    String gwyuid = mCtx.getEnvStore().getEnv("GWYUID");
    String tmpDir = mCtx.getEnvStore().getEnv("APPLTMP");
    String twoTask = mCtx.getEnvStore().getEnv("TWO_TASK");
    // create temp file
    mLPath = lUtil.createTempFile("OF", exten, tmpDir);
    lUtil.logTempFile(mLPath, mLNode, mCtx);
    Thanks,
    binghao

    However within OAF on the application it doesn't.
    what doesnt work, do you get errors or nothing ?XX_TOP is defined in adovars.env only. Anywhere else this has to go?
    No, it is read from the adovars.env file only.Thanks
    Tapash

  • How can we use Session Variable in Answers or Analysis?

    How can we use Session Variable in Answers or Analysis?

    Again, duplicate cross-posting!
    See rukbat 's post here: Re: BI Apps 7.9.6.3(Agent Issue)

  • How can we  use java variable in javascript code on JSP page?

    How can we use java variable in javascript code on JSP page?
    Pls help

    Think about it:
    JSP/Java is executed on the Server and produces HTML+JavaScript.
    Then that HTML+JavaScript is transfered to the client. The client now interpretes the HTML+JavaScript.
    Obviously there's no way to access a Java variable directly from JavaScript.
    What you can do, however, is write out some JavaScript that creates a JavaScript variable containing the value of your Java variable.

  • How can I use the Variable Delay VI (From DSP Module) to Deploy Variable Delay on Speddy-33

    Dears,
    I dont Understand How Can I Use the Variable Delay to Deploy Variable Delay on a Speedy-33 Kit

    Hello,
    Thank you for posting to the NI Forums!! You should be able to incorporate the Variable Delay.vi into your vi and then build as normal and the functionality of the vi should translate to the build. What type of build are you doing? Are you receiving any specific errors? Thanks!
    Regards,
    Margaret Barrett
    National Instruments
    Applications Engineer
    Digital Multimeters and LCR Meters

  • How can i use Order by inside a sub query in Oracle

    Hi!,
    Please help me, it's an urgent... how can i use Order by clause
    SELECT SalesProductKeyID,ActualUnitPrice,BillDateKeyID,ProductKeyID
    ,Qty,Profit,DD.dDate
    , (SELECT nvl(S.Qty,0) FROM Stock S , DateDimension DD1
    WHERE S.DateKeyID = DD1.DateKeyID AND
    S.ProductKeyID = SF.ProductKeyID AND
    DD1.dDate <= DD.dDate and rownum=1
    ORDER BY DD1.dDate DESC*) as StockQty
    , (SELECT nvl(SUM(Qty),0) from salesfact SF2,DATEDIMENSION DD2
    WHERE SF2.BillDateKeyID=DD2.DatekeyID AND SF2.ProductKeyID=SF.ProductKeyid
    AND DD2.dDate > DD.dDate
    AND DD2.dDATE=DD.dDate
    ) as TotalQtySold
    FROM SalesFact SF INNER JOIN DATEDIMENSION DD
    ON SF.billdatekeyid =DD.Datekeyid
    WHERE
    IsProfitCalculated = 1 AND
    IsSalesFactSuppPopulated =0 AND
    Qty > 0;
    kindly help
    Thank you.

    Actually I'm converting Procedures from SQL Server to Oracle.
    Actual Stored Procedure in SQL Server is as follows.
    SELECT --top 10000 
    SalesProductKeyID,ActualUnitPrice,BillDateKeyID,ProductKeyID
    ,Qty,Profit,DD.Date
    , (SELECT TOP 1 ISNULL(S.Qty,0) FROM dbo.Stock S , dbo.DateDimension DD1
    WHERE S.DateKeyID = DD1.DateKeyID AND
    S.ProductKeyID = SF.ProductKeyID AND
    DD1.Date <= DD.Date
    ORDER BY DD1.Date DESC) as StockQty
    , (SELECT ISNULL(SUM(Qty),0) from salesfact SF2,DATEDIMENSION DD2
    WHERE SF2.BillDateKeyID=DD2.DatekeyID AND SF2.ProductKeyID=SF.ProductKeyid
    AND DD2.Date > DD.Date
    AND DD2.DATE=DD.Date
    ) as TotalQtySold
    --INTO TEMP_Salesfact          
    FROM dbo.SalesFact SF INNER JOIN DATEDIMENSION DD
    ON SF.billdatekeyid =DD.Datekeyid
    WHERE
    IsProfitCalculated = 1 AND
    IsSalesFactSuppPopulated =0 AND
    Qty > 0

  • How can I use a variable in BEx of type date ?

    Hello,
    I have an infoprovider with a key figure of type "date" and I want to display for example all the data where the date is lower than a date entered by the user.
    So I want to create for that a date variable and use it in conditions.
    When I try with "manual entry", I can't get the type "date" : it proposes quantity, amount, number but not date.
    When I try with "customer exit", I can get the type "date" but when I get it on the selection screen, the date is seen as a number so it doesn't work.
    Does anybody have an idea.
    Thanks for your help.
    Regards,
    Vanessa Roulier

    Hi!
    if you are using a cube then there will be at least one time char. I think you can just add 0calday to your cube , even if you are not filling it.
      Once this is available in cube  it can be used in query (free chars) where we can define a variable on this 0calday. But we it will not have any effect on query results as you are not storing anything in your query.
    then in your conditions you create a variable with USEREXIT type. then in your ABAP code you can access the value stored in variable(which is entered by user) and copy it to the USEREXIT variable. Then your condition works because it is having a date type and the value is date.
    I don't see any problem in implementing this scenario.
    with regards
    ashwin

  • How can I use local variable in LabVIEW-Action?

    Hi All!
    There is local variable (for example "MyVariable") in local scope of project. There is Action-step, created by LabVIEW. One of input terminals step is "Sequence Context".
    How can I access to MyVariable by Sequence Context? Unbundle? It does't work.
    Thank you.

    On the TestStand palette there is a VI called TestStand - Get Property Value.vi.  Use that.  Attached is an image showing how to use it.  The trick is making it produce the correct data type.  Do that by right clicking on the VI and selecting Select Type.  Then you can choose the type.  I think in LV 2010 and TS 2010 it is a polymorphic VI and you can just change it.  I wrote an example here for Chaz: http://forums.ni.com/t5/NI-TestStand/How-to-execute-two-steps-in-parallel/td-p/1449874
    It's the second example that's attached.
    Hope this helps,
    jigg
    CTA, CLA
    teststandhelp.com
    ~Will work for kudos and/or BBQ~
    Attachments:
    AccessLocalVar.JPG ‏67 KB

  • How can I use more than one Data Provider in my web Apps

    I am trying to use two different data provider in my web apps to run two different queries from the same table ,the data provider A is working correctly but when I attempt to run data provider B ,It display an error page ,here is the error message : Exception Details :javax.servlet.ServletEx ception
    java.lang.RuntimeException: java.sql.SQLException : Cannot connect .Both dataSourceName and url properties are null.

    Hi,
    You can use more than one data provider in your application. However if you have defined a dataprovider for a particular table already, and wish to bind a component, select the component and use its context menu to Bind to Data...

  • How can i use Progressbar for loading data to DataGridView using DataTable

    I have a datatable which have 3 columns and set this datatable to be datasouce of datagridview.
    I want to add 100000 rows into this  table while
     table is adding , I want Progressbar to calculate and show the remaining
    percentage.
    How can i do this ?

    I've seen this done 2 different ways.
    You could either set the ProgressBar.Maximum to: 100, or  to QuantityToLoad. 
    example:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Public Class Form1
    Dim QuantityToLoad As Integer = 100000
    Dim increment As Double = 100 / QuantityToLoad
    Private Sub btnExample1_Click(sender As Object, e As EventArgs) Handles btnExample1.Click
    ProgressBar1.Value = 0
    ProgressBar1.Maximum = 100
    ProgressBar2.Value = 0
    ProgressBar2.Maximum = QuantityToLoad
    For i As Integer = 1 To QuantityToLoad
    'Some code
    'Some code
    'Some code
    'Done loading item
    ProgressBar1.Value = CInt(i * increment)
    ProgressBar2.Increment(1)
    Label1.Text = ProgressBar1.Value.ToString & "% complete."
    Label2.Text = CStr(Math.Round((ProgressBar2.Value / ProgressBar2.Maximum) * 100, 2)) & "% complete."
    Application.DoEvents()
    Next
    MsgBox("done")
    End Sub
    End Class
    “If you want something you've never had, you need to do something you've never done.”
    Don't forget to mark
    helpful posts and answers
    ! Answer an interesting question? Write a
    new article
    about it! My Articles
    *This post does not reflect the opinion of Microsoft, or its employees.

  • How can I use a variable for an interface log and error fle

    I want to use a variable for the interface's log and error file so that when I migrate from Dev to QA to Prod I don't have to do a lot of editing.
    Specifically on the "flow" tab for the "target", I want a variable to be the first part of the path for the log (\\sundev1\fnd1-hypd1) and join this with the rest (\update\log\logfile.log) within the LOG_FILE_NAME field.
    Thank you!

    Hi,
    It is quite simple....
    just use the <%=odiRef.getSchemaName("D")%> before the file name and configure both path in the topology linked to each context.

  • How can I filter a table from Data Control without enter query

    I have a table from a web service data control based on WSDL.
    I want to filter the table without input query at filter text box. Without filter text box, each would filter the table with a hardcoded query internally.
    For example, when user click A menu button then it filters the table where type = '1' and B menu button filters the table by type='2' and C menu button filters the table by type=' ' .
    How can I filter the table without enter query?
    Could anyone point me to a solution please.
    Thanks.
    jdev 11.1.5
    Edited by: 893364 on Oct 26, 2011 12:15 PM
    Edited by: 893364 on Oct 26, 2011 12:21 PM

    Hi,
    when you created the table, did you try selecting the "filter" option. Select the table and go to the Property Inspctor. In the tool bar of the Property Inspector there is an icon to change the configuration. Its adding filter filter fields for the user to search in.
    Option 2: The data of the Web Service actually is held in the iterators. If you wanted to filter the WebService query, I would not use the WS DC but a JAX-WS proxy in a POJO to fetch the WS Data. Then have the Data Control created from the POJO. You could have a method exposed on the POJO that allows you to filter the internally held data
    Frank

  • How can i use the ACL file to control the access from the other website?

    Hello all~
    My Sun one is 6.1 sp3 on Windows 2003 SE, and I am try to use the ACL file to control the access.
    My ACL file is below:
    version 3.0;
    acl "path=my_path_on_HD";
    deny absolute (all)
    (user = "anyone") and
    (dns = "*.my_site.com");
    deny absolute (all)
    (user = "anyone") and
    (dns = "*.other_site.net");
    Once I add the "deny", anyone include my site is decline for vist the path specify in the ACL file. But if remove the "deny", everyone include other one's website can access the file.
    Can anybody tell me how to make it work?

    I think you've misunderstood what the dns attribute is for. The dns attribute returns the hostname of the client accessing your website, not the hostname of the website that linked to your website.
    For example, when someone using the Comcast ISP goes to a malicious website at example.com that loads images from your website at www.amigoo.net, the dns attribute will be something like "c-1-2-3-4.ca.comcast.net", not "example.com". ACLs are used for authentication and authorization of clients (not the websites those clients chose to visit), and they don't provide the functionality you're looking for.
    If I understand correctly, you want to prevent websites other than amigoo.net from linking to files in your d:/webserver/imat/pics_upload directory. You can achieve this adding the following lines to your obj.conf configuration file:
    <Object ppath="d:/webserver/imat/pics_upload/*">
    <Client referer="*~*amigoo.net">
    PathCheck fn="deny-existence"
    </Client>
    </Object>

  • How can i use a string as a control for case structure?

    my vi is reading data. the output is a string,how can a string can control the case structure? because the there's a constructed vi in that case structure that wll perform a tast after the main vi read.
    Thank You
    (Can you please give me a simple example how can do this)

    Try this vi. You shouldn't have any problems just connecting a string to the case selector.
    BJD1613
    Lead Test Tools Development Engineer
    Philips Respironics
    Certified LV Architect / Instructor
    Attachments:
    string_to_control_case_structure.vi ‏10 KB

Maybe you are looking for

  • SAP CI on Solaris Cluster 3.2   AMDx86

    Hello, we migrate from HPUX to Solaris10 x86. On HPUX we run the SAP ERR6 ABAP only on NW7.0  in MC Serviceguard Cluster with Oracle as Database. On Solaris we use SolarisCluster 3.2. We are know almost at the End with or testsystem HUX on Solaris. L

  • Business rules do not show up in forms

    We are using EPM 11.1.2.0. Recently, we have noticed that any new business rules we have created and associated with certain forms-do not show up in the forms. We have verified security, location etc for the rules. Somehow they don't show up at all.(

  • IG Billing Type

    Hai, 1.please let me know flow of the steps for creating the Intercompany Credit memo? 2. In which instances we use B2(Reate correction) billing type? How to ccreate the B2 from the condition record? Thanx, Siva

  • DSRM black screen issue with 2012R2 DC running on 2012R2 Hyper-V

    Hi! I have been testing AD disaster recovery with few domain controllers (Server 2012R2), running on Server 2012R2 and Hyper-V. Everything OK unless I try to log in to Domain Services Recovery Mode. After username&passwd screen goes all black and not

  • Bridge issue, menu options missing

    My wife has been using bridge for just over a year. Recently photo's starting showing a lock next to them and the option to move or delete is missing.