Retrieving database values

Hello
Can anyone let me know of some good sample application involving only servlet & JSPs to retrieve values from database. I am actually creating a jsp with all test cases & on hitting run button of a particular case(each case will have a button) should show the results of that test case in another JSP.
Any help appreciated.
Thanks

The API for database connectivity in java is called JDBC, which is part of the standard edition. Google for "java jdbc example", you'll get plenty of examples.
You talk about test cases, I would suggest you also take a look at JUnit, it's a framework specifically designed for developing test cases.
http://java.sun.com/products/jdbc/
http://www.junit.org/index.htm

Similar Messages

  • How to retrieve the value of last identity has been updated in a database?

    how to retrieve the value of last identity has been updated in a database

    Hi,
    Oracle 10g, FGA - Fine grained auditing, supports DML statements (9i only select).
    Set up FGA using the DBMS_FGA.ADD_POLICY procudure:
    sql> BEGIN
    DBMS_FGA.ADD_POLICY (
    policy_name => 'AUD_EMPLOYEE_SAL',
    object_schema => 'HR',
    object_name => 'EMPLOYEE',
    audit_column => SALARY',
    audit_condition => '',
    statement_type => 'UPDATE');
    END;
    NEXT:
    sql> SELECT dbuid, lsqltesxt FROM sys.fga_logs$;
    The database inserts the audit record into the FGA_LOG$ table using an autonomous transaction; even if you roll back the update statement, the update action will still be logged in this table. The fga_log$ tracks the session, machine id, timestamp, schema, scn, etc:
    SQL> desc fga_log$
    Name Null? Type
    SESSIONID NOT NULL NUMBER
    TIMESTAMP# DATE
    DBUID VARCHAR2(30)
    OSUID VARCHAR2(255)
    OSHST VARCHAR2(128)
    CLIENTID VARCHAR2(64)
    EXTID VARCHAR2(4000)
    OBJ$SCHEMA VARCHAR2(30)
    OBJ$NAME VARCHAR2(128)
    POLICYNAME VARCHAR2(30)
    SCN NUMBER
    SQLTEXT VARCHAR2(4000)
    LSQLTEXT CLOB
    SQLBIND VARCHAR2(4000)
    COMMENT$TEXT VARCHAR2(4000)
    PLHOL LONG
    STMT_TYPE NUMBER
    NTIMESTAMP# TIMESTAMP(6)
    PROXY$SID NUMBER
    USER$GUID VARCHAR2(32)
    INSTANCE# NUMBER
    PROCESS# VARCHAR2(16)
    XID RAW(8)
    AUDITID VARCHAR2(64)
    STATEMENT NUMBER
    ENTRYID NUMBER
    DBID NUMBER
    LSQLBIND CLOB
    SQL> spool off

  • How to retrieve the values from a LinkedList

    Hello,
    I have just put this question in java programming forums by mistake...I think that it should be here ...
    I have created a LinkedList to store the results of a query to a database.
    These reasults are decimal numbers and then I want to sum all these numbers to be able to make the average.
    But when I try to retrieve the values of the Linked List I always receive an incopatible types error..
    Here is an extract of my code in a jsp page.
    LinkedList Average = new LinkedList();
    String Media = rst.getString(10);
    Average.add(Media);
    int Size = Average.size();
    double Sum = 0.0;
    for (int i=0; i<=Size; i++)
                    double Result = Average.get(i)     
                  Sum = Sum + Result;
    }If I try to retrieve the value of only one node from the list , I can just putting <%=Average.get(i)%>...but..how can I retrieve all the values (they are decimal numbers) to be able to add them?

    If you want to sum all the values, is there any reason you just don't retrieve the sum from the database rather than the list of values?
    anyway
    List average = new LinkedList();
    while (rst.next()){
      // retrieve the number:
      String mediaString = rst.getString(10);
      Double media = Double.valueOf(mediaString);
      // or maybe like this if it is a number in the database
      Double media = new Double(rst.getDouble(10));
      average.add(media);
    doubleSum = 0.0;
    for (Iterator it = average.iterator(); it.hasNext(); ){
      Double result= (Double) it.next();
      doubleSum += result.doubleValue();
    }

  • Retrieve alert values for use as parameter in corrective action sql script

    I am trying to write a corrective action sql script to kill a session that is blocking other sessions. I have the "blocking session count" metric set and the alert is firing correctly.
    Is there any way to retrieve the sid and serial number from the alert generated and use it in a corrective action sql script?
    Here is the alert generated:
    Target Name=myproddb.world
    Target Type=Database Instance
    Host=myprodserver
    Metric=Blocking Session Count
    Blocking Session ID=SID: 522 Serial#: 5228
    Timestamp=Mar 4, 2008 5:57:12 PM EST
    Severity=Warning
    Message=Session 522 is blocking 1 other sessions
    Notification Rule Name=Testing Corrective actions
    Notification Rule Owner=sysman
    Clearly the sid, and serial # is contained within the alert Message field
    what I want to write for the sql script is :
    alter system kill session '%sid%,%serial_no%' immediate;
    and have GC pass in the sid and serial_no to the script.
    The "Target Properties" listed on the right of the Edit Corrective Action screen lists minimal details pertaining to the alert and certainly not the session sid, serial no.
    Generically, is there any way to retrieve the values from an alert and use them in a corrective action script or job?
    I've looked into getting the values from the mgmt$alert_history table, but I'm hoping that GC can pass the values to the sql script.
    thanks in advance for your help.

    Hi
    You can implementing a procedure like this.
    1. When a block session count alarms occurs, there is a column in the v$lock that you can examine.
    #!/bin/ksh
    #kill_block_session.sh
    #first export your variables
    export ORACLE_HOME=/oracle/product/10.2.0.3
    export ORACLE_SID=SIDNAME
    $ORACLE_HOME/bin/sqlplus "/ as sysdba" << EOF
    execute immediate killed_blocks;
    EOF
    # end
    The killed_blocks is a procedure:
    create procedure
    declare
    v_sid varchar2(15);
    v_serial varchar2(15);
    -- now a sql query that retrieve the sid and serial
    -- you can obtain these values from v$session and v$lock
    select vs.sid,vs.serial into v_sid,v_serial
    from v$session vs,v$lock vl
    where vs.sid=vl.sid
    and vl.block >0
    -- After this, you execute a dbms_put line with these
    -- values
    But you understant that this response action is very dangerous, because its possible that you kill sessions that the blocking are transitient.
    You must examine your enviroment and your application and establish the metric like UDM and not for only session blocking count.
    You must to see:
    - The type of block
    - The ctime time in the v$lock for to understatn the amount of time to determine that the block is need killed.
    - In my opinion you need a special UDM and deactivate the blocking sesion count
    If you want help to create this UDM send me a mail to [email protected]
    Regards
    Robert

  • OIM 11g: Error After starting OIM server :retrieving database connection

    Hi All,
    After patching OIM 11.1.1.5.0 to BP02 I am getting following error in logs of OIM and not able to see Import Deployment Manager File and..continuously this error bounce back
    Error
    <Error> <XELLERATE.DATABASE> <BEA-000000> <Class/Method: DBPoolManager/getConnection/Exception encounter some problems: Error while retrieving database connection.Please check for the following
    Database srever is up.
    DirectDB settings in configuration file are correct.>
    <Mar 16, 2012 6:50:31 AM EDT> <Error> <XELLERATE.DATABASE> <BEA-000000> <Class/Method: DirectDB/getConnection encounter some problems: Error while retrieving database connection.Please check for the follwoing
    Database srever is running.
    Datasource configuration settings are correct.
    java.sql.SQLException: java.sql.SQLException: Exception occurred while getting connection: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
    at com.thortech.xl.util.DirectDB$DBPoolManager.getConnection(DirectDB.java:441)
    at com.thortech.xl.util.DirectDB.getConnection(DirectDB.java:176)
    at com.thortech.xl.dataobj.util.ADPClassWatchDog.getMaxUpdateTimestamp(ADPClassWatchDog.java:50)
    at com.thortech.xl.dataobj.util.ADPClassWatchDog.run(ADPClassWatchDog.java:145)
    >
    <Mar 16, 2012 6:50:31 AM EDT> <Error> <XELLERATE.ADAPTERS> <BEA-000000> <ADPClassWatchDog: Error occured while getting the max adp_update timestamp>
    Earlier before patching to BP02 in weblogic Datasources we have
    Driver Class Name: oracle.jdbc.xa.client.OracleXADataSource
    But when I was providing this value in weblogic.profile during patching attribute name "operationsDB.driver=oracle.jdbc.xa.client.OracleXADataSource ", I am getting this error
    /data/oim/Oracle/Middleware/Oracle_IDM1/server/setup/deploy-files/setup.xml:204: java.lang.ClassCastException: oracle.jdbc.xa.client.OracleXADataSource cannot be cast to java.sql.Driver
    So I changed this value to "operationsDB.driver=oracle.jdbc.OracleDriver" and it runs fine. Patch completed successfully.
    Is there any issue with this Driver Class Name mismatch, so I am getting this error? I have also tried for all Datasources same Driver Class Name but invain.
    Regards,
    Amit

    Hi Bikash,
    Nothing is changed between network/firewall. From Database machine I am able to see tnsping running fine. From weblogic admin console I have checked the connectivity of different datasource is successfull. Right now I have these datasources, all have Driver Class Name=oracle.jdbc.OracleDriver.
    EDNDataSource
         EDNLocalTxDataSource
         mds-oim     
         mds-owsm
         mds-soa     
         oimJMSStoreDS
         oimOperationsDB     
         OraSDPMDataSource     
         SOADataSource     
         SOALocalTxDataSource
    You mean For all the datasources I need to make it oracle.jdbc.xa.client.OracleXADataSource. I make it this also but no success.
    Also tell me..Summary of Security Realms >myrealm >Providers >OIMAuthenticationProvider here also I need to provide Xadatasource Driver name.

  • How to retrieve checkboxes values?

    I am using a few checkboxes
    <form method="post" action="testgetPara.jsp">
    <input name="termcond1" type="checkbox" value="1" id="termcond" checked>
    <input name="termcond2" type="checkbox" value="2" id="termcond" >
    <input name="termcond3" type="checkbox" value="3" id="termcond" >
    <input type ="submit" name ="submit" value ="submit">
    </form>
    and hope to retrieve the "checked" values from these boxes
    so i do this
    <%int i = 0;
    //chkno is used only to retrieve the number of checked checkboxes
    String chkno[] = request.getParameterValues("chkdelbook");
                   //using a while loop to retrieve the value + execute it to the database.
    while (i < chkno.length)
    String isbn = request.getParameter("termcond");//get the specific array item
    out.println(isbn);
    //increment the i counter           
    ++i;
    %>
    but it doesn't seem to be working
    it return me with
    An error occurred between lines: 2 and 16 in the jsp file: /testgetPara.jsp
    Generated servlet error:
    C:\jakarta-tomcat-4.0.3\work\localhost\Testing\testgetPara$jsp.java:69: [] can only be applied to arrays. It can't be applied to java.lang.String.
         String isbn = request.getParameter("termcond")[i];//get the specific array item
         ^
    1 error
    this error
    may i know how to solve it?

    but it give me a java.lang.NullPointerException
    i have same id for my checkboxes, different name and
    values for them
    but it just doesnt work.NPE might be because tehere is no parameters named 'hobbies'
    having same ID is not same as having same NAME (see the difference ID vs NAME)
    if you had
    <form>
    <br>java<input type="checkbox" name="hobbies" value="java">
    <br>haskell<input type="checkbox" name="hobbies" value="haskell">
    <br>prolog<input type="checkbox" name="hobbies" value="prolog">
    <input type="submit">
    </form>
    and it would appear something like this:
    java [X]
    haskell[X]
    prolog[_]
    [submit]
    then you could probably write some code for it like this:
    String[] hobbies = request.getParameterValues("hobbies");
    for (int j = 0; j < hobbies.length; j++) {
    %>
    Your hobby is: <%= hobbies[j] %><br>
    <%
    }and it's output would hopefully look somewhat like this:
    Your hobby is: java
    Your hobby is: haskell
    of course i have not tryed that code nore looked methods up from API recently, so it might have some minor bugs.

  • Inserting blank values and retrieving blank values

    I really want to Insert blank values into Oracle database,and also want to retrieve blank values from table.
    When I try to insert blank values ,Its inserting null values.
    I don't want to insert null for blank.
    Please provide me solution for this.
    Thank you

    user631179, logically if you have a descrition or other printable
    character column where the value is blanks you do not have a value.
    The data item is logically unknown or non-existent, hence NULL.
    You can assign blanks (spaces) for NULL in the querying program
    like SQLPlus does on display. The Pro*C and other language tools
    provides null indicator bytes for this purpose.
    UT1 > l
      1  select fld1, fld2, rpad(nvl(fld4,' '),10,' '), length( rpad(nvl(fld4,' '),10,' '))
      2* from marktest
    UT1 > /
    FLD1             FLD2 RPAD(NVL(F LENGTH(RPAD(NVL(FLD4,''),10,''))
    one                 1                                          10
    TWO                 2 USER51                                   10
                        4 USER51                                   10HTH -- Mark D Powell --
    Message was edited by: Mark to try to keep the test from requiring scrolling
    mpowel01

  • Failure: Cannot connect to retrieve Database/current.zip: Internal Server E

    Hello
    I have installed an update connection proxy and I have registered it
    smpatch get
    patchpro.backout.directory - ""
    patchpro.baseline.directory - /var/sadm/spool
    patchpro.download.directory - /var/sadm/spool
    patchpro.install.types - rebootafter:reconfigafter:standard
    patchpro.patch.source - https://getupdates1.sun.com/
    patchpro.patchset - current
    patchpro.proxy.host - ""
    patchpro.proxy.passwd **** ****
    patchpro.proxy.port - 8080
    patchpro.proxy.user - ""
    patchsvr setup -l
    Patch source URL: file:/patchsvr
    Cache location: /export/home/proxycashe
    I also did smpatch analyze > file
    and I downloaded the patches (*.jar) and copied them to
    /patchsvr/Patches
    But I don't really now from where to get the files: current.zip and detectors.jar
    I searched for them on the server and I found :
    /var/sadm/spool/cache/Database/https%3A%2F%2Fgetupdates1.sun.com%2F%2FDatabase%2Fcurrent.zip
    /var/sadm/spool/cache/https%3A%2F%2Fgetupdates1.sun.com%2F%2Fdetectors.jar
    and I copyed them in /patchsvr/Database and /patchsvr/Misc
    On an update connection client I did:
    #smpatch set patchpro.patch.source=http://192.168.0.71:3816/solaris/
    #smpatch analyze
    Failure: Cannot connect to retrieve Database/current.zip: Internal Server Error
    Can you please help me.
    Thanks.

    On the proxy I cannot execute:
    # rm /var/sadm/spool/patchsvr/*current.zip
    # rm /var/sadm/spool/patchsvr/*detectors.jar
    because /var/sadm/spool/patchsvr/ is empty.
    # patchsvr setup -l
    Patch source URL: file:/patchsvr
    Cache location: /export/home/proxycashe
    On the client:
    I removed the current.zip and detectors.jar
    # smpatch get
    patchpro.backout.directory - ""
    patchpro.baseline.directory - /var/sadm/spool
    patchpro.download.directory - /var/sadm/spool
    patchpro.install.types - rebootafter:reconfigafter:standard
    patchpro.patch.source http://192.168.0.71:3816/ https://getupdates1.sun.com/
    patchpro.patchset - current
    patchpro.proxy.host - ""
    patchpro.proxy.passwd **** ****
    patchpro.proxy.port - 8080
    patchpro.proxy.user - ""
    # smpatch analyze -C patchpro.log.level=3 -C patchpro.debug=true
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /xml/motd.xml
    ... ... File path portion of URL is /xml/motd.xml
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    ... Caught IO Exception.
    ((HttpURLConnection)connection).getResponseCode() : 404
    ((HttpURLConnection)connection).getResponseMessage() : motd.xml not found
    Error: Unable to download document : "xml/motd.xml"
    Cannot connect to retrieve motd.xml: motd.xml not found
    Unable to display any message of the day notices from Sun Microsystems. Refer to the log file for additional information.
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /detector/detectors.jar
    ... ... File path portion of URL is /detector/detectors.jar
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    Last Modified Date read: Thu Jan 01 02:00:00 EET 1970
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /database/current.zip
    ... ... File path portion of URL is /database/current.zip
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    Key 1 : Content-Type = application/java-archive
    Key 2 : Content-Length = 3750071
    Key 3 : content-disposition = attachment; filename=detectors.jar
    Key 4 : Date = Thu, 26 Jul 2007 05:26:25 GMT
    Key 5 : Server = Apache Tomcat/4.0.5 (HTTP/1.1 Connector)
    Key 6 : Content-length = 3750071
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    Key 1 : Content-Type = application/zip
    Key 2 : Content-Length = 323247
    Key 3 : content-disposition = attachment; filename=current.zip
    Key 4 : Date = Thu, 26 Jul 2007 05:26:26 GMT
    Key 5 : Server = Apache Tomcat/4.0.5 (HTTP/1.1 Connector)
    Key 6 : Content-length = 323247
    Last Modified Date value written to /var/sadm/spool/cache/Database/http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip.lmd is 0
    Date format for this value: Thu Jan 01 02:00:00 EET 1970
    Last Modified Date file updated : /var/sadm/spool/cache/Database/http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip.lmd
    Last Modified Date value written to /var/sadm/spool/cache/http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar.lmd is 0
    Date format for this value: Thu Jan 01 02:00:00 EET 1970
    Last Modified Date file updated : /var/sadm/spool/cache/http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar.lmd
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    Effective proxy host : ""
    Effective proxy port : "8080"
    Effective proxy user : ""
    ... Submitting download request against a GUUS server
    ... ... Hostname of URL is 192.168.0.71
    ... ... Filename of URL is /entitlement/
    ... ... File path portion of URL is /entitlement/
    Defining request header : IF_MODIFIED_SINCE... valueThu Jan 01 02:00:00 EET 1970
    ... Caught IO Exception.
    ((HttpURLConnection)connection).getResponseCode() : 404
    ((HttpURLConnection)connection).getResponseMessage() : default not found
    Error: Unable to download entitlement information using the update server proxy.
    Cannot connect to retrieve : default not found
    # ls -laR /var/sadm/spool/cache
    /var/sadm/spool/cache:
    total 7358
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 .
    drwxr-xr-x 3 root sys 512 Jul 19 00:25 ..
    drwxr-xr-x 2 root root 512 Jul 26 08:25 Database
    drwxr-xr-x 2 root root 512 Jul 26 08:26 entitlement
    -rw-r--r-- 1 root root 3750071 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar
    -rw-r--r-- 1 root root 14 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2Fdetectors.jar.lmd
    drwxr-xr-x 3 root sys 512 Jul 19 00:35 updatemanager
    drwxr-xr-x 2 root root 512 Jul 26 08:26 xml
    /var/sadm/spool/cache/Database:
    total 662
    drwxr-xr-x 2 root root 512 Jul 26 08:25 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..
    -rw-r--r-- 1 root root 323247 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip
    -rw-r--r-- 1 root root 14 Jul 26 08:25 http%3A%2F%2F192.168.0.71%3A3816%2F%2FDatabase%2Fcurrent.zip.lmd
    /var/sadm/spool/cache/entitlement:
    total 4
    drwxr-xr-x 2 root root 512 Jul 26 08:26 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..
    /var/sadm/spool/cache/updatemanager:
    total 6
    drwxr-xr-x 3 root sys 512 Jul 19 00:35 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..
    drwxr-xr-x 2 root sys 512 Jul 19 00:35 analysis.results
    /var/sadm/spool/cache/updatemanager/analysis.results:
    total 4
    drwxr-xr-x 2 root sys 512 Jul 19 00:35 .
    drwxr-xr-x 3 root sys 512 Jul 19 00:35 ..
    /var/sadm/spool/cache/xml:
    total 4
    drwxr-xr-x 2 root root 512 Jul 26 08:26 .
    drwxr-xr-x 6 root sys 512 Jul 26 08:25 ..

  • How to display the contents of the database values which are retrived.

    how to display the contents of the database values which are retrived in servlets and i am able to display the contents in the servlets and if forward to jsp using requestdespatcher,the values are to be shown in jsp one below the other.please suggest me in these........the servlet code is as shown
    while(rs.next()){
                        buffer.append(rs.getString(1));
                        buffer.append(rs.getString(2));
                        buffer.append(rs.getString(3));
                        buffer.append(rs.getString(4));
                        buffer.append(rs.getString(5));
                        buffer.append(rs.getString(6));
                        buffer.append(rs.getString(7));
                        buffer.append(rs.getString(8));
                        buffer.append(rs.getString(9));
                        buffer.append(rs.getString(10));
                        request.setAttribute("result1",buffer);
                        RequestDispatcher rq=request.getRequestDispatcher("/results.jsp");
                        rq.forward(request,response);
    in jsp iam using the getAttribute to retrieve the values as shown
    <% StringBuffer sb=(StringBuffer)request.getAttribute("result1"); %>
    <%= sb %>
    but getting the results in the stretch,i need to display the result one below the other.

    if you load it all into the buffer that is going to be very difficult. I would suggest loading it into some sort of collection. I like using an ArrayList.
    Then pass the arraylist.
    you will then on the jsp iterate through the arrayList using what every you want.. el, logic tags, scriplets.
    so something like
    ArrayList arrayList = new ArrayList();
    while(rs.next()){
    arrayList.append(rs.getString(1));
    //or possibly an arrayList of String arrays
    //maybe using nested for loops.  Inner for loop adds result to string[] then //outer adds string[] to arrayList.
    //can be done any number of ways based on your expected result set.

  • Multipe select list -  default database value

    How can i achieve preselected Values in a multiple-select item based on values in the database ?
    Thanks a lot!

    Hi,
    In that case you will have to change the 'Default Value Type' to PL/SQL Expression, and dynamically retrieve the values from the DB at runtime, probably from a Table.
    Are you sure this is the cleanest way to achieve what you're trying to do?
    Cheers,
    Mike

  • Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View

    Todd,
    Let me try to explain you this time. I have a text field in a TiledViewBean.
    When I display the page, the text field
    html tag is created with the name="PageDetail.rDetail[0].tbFieldName" say
    five times/rows with same name.
    The html tags look like this.
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    When the form is submitted, I want to get the text field values using the
    method getTbFieldName().getValues() which
    returns an array object[]. This is in case where my TiledViewBean is not
    bound and it is working fine.
    Now in case when my TiledView is bound to a model, it creates the html tags
    as follows.
    <input type=text name="PageDetail.rDetail[0].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[1].tbFieldName" value=""
    maxlength=9 size=13>
    <input type=text name="PageDetail.rDetail[2].tbFieldName" value=""
    maxlength=9 size=13>
    Now when I say getTbFieldName().getValues() it returns only the first
    element values in the object[] and the rest of the
    values are null.
    May be we need to create a utility method do get these values from
    requestContext.
    raju.
    ----- Original Message -----
    From: Todd Fast <toddwork@c...>
    Sent: Saturday, July 07, 2001 3:52 AM
    Subject: Re: [iPlanet-JATO] Re: Retrieving all Values from a Tiled View
    Raju.--
    I wanted to know how the getValues() method works the reason being,
    when the tiled view is NOT bound to a model, it populates all the
    fields with the same name as some thing likeI'm afraid I don't understand your point--can you please clarify? Do you
    mean "value" instead of "name"?
    What are you trying to do? What behavior are you expecting but notseeing?
    >
    Without further clarification, I can say that the setValues() methodsNEVER
    populates data on multiple rows of a (dataset) model, nor does it affect
    multiple fields on the same row. Perhaps what you are seeing is theeffect
    of default values. Model that derive from DefaulModel have the ability to
    carry forward the values set on the first row to other rows in lieu ofdata
    in those other rows. This behavior is for pure convenience and can be
    turned off, and it is turned off for the SQL-based models.
    Todd
    [email protected]

    Hi,
    I wanted to know how the getValues() method works the reason being,
    when the tiled view is NOT bound to a model, it populates all the
    fields with the same name as some thing like
    PageDetail.rDetail[0].tbFieldValue
    PageDetail.rDetail[0].tbFieldValue
    in which case, the getValues() method works fine.
    But in case where the tiled view is bound to a model, it populates
    with different field names such as,
    PageDetail.rDetail[0].tbFieldValue
    PageDetail.rDetail[1].tbFieldValue
    in this case, the getValues() doesn't work. Any soultion to this?
    We are using Moko 1.1.1.
    thanks in advance,
    raju.
    --- In iPlanet-JATO@y..., "Todd Fast" <toddwork@c...> wrote:
    Does anyone know of is there a single method to get all values of a
    display
    field in a tiled view without having to iterate through all the
    values ie
    resetTileIndex() / nextTile() approach.
    ie Something that returns an Object[] or Vector just like ND returned a
    CspVector. I tried using the getValues() methods but that allways returns
    a
    single element array containing the first element.
    (I think now, that method is used for multi selecteable ListBoxes)Actually, no. We can add this in the next patch, but for now, I'd recommend
    creating a simple utility method to do the iteration on an arbitrary model
    and build the list for you.
    Todd

  • Retrieving ALL values from a single restricted user property

    How can I retrieve ALL values of a single restricted user property from within
    a .jpf file?
    I want to display a dropdown list within a form in a JSP which should contain
    all the locations listed in the property 'locations'. I ever get just the default
    value when I access the property via
    ProfileWrapper pw = userprofile.getProfileForUser(user);
    Object prop = pw.getProperty("ClockSetup", "Locations");

    Well, the code you've got will retrieve the single value of the property
    for the current user. You're getting the default value because the
    current user doesn't have Locations property set, so the ProfileWrapper
    returns the default value from the property set.
    I assume you want to get the list of available values that you entered
    into the .usr file in Workshop. If so, I've attached a
    SetColorController.jpf, index.jsp, and GeneralInfo.usr (put in
    META-INF/data/userprofiles) I wrote for an example that does just this.
    It uses the PropertySetManagerControl to retrieve the restricted values
    for a property, and the jsp uses data-binding to create a list from that
    pageflow method.
    For a just-jsps solution, you can also use the
    <ps:getRestrictedPropertyValues/> tag. I've attached a setcolor-tags.jsp
    that does the same thing.
    Greg
    Dirk wrote:
    How can I retrieve ALL values of a single restricted user property from within
    a .jpf file?
    I want to display a dropdown list within a form in a JSP which should contain
    all the locations listed in the property 'locations'. I ever get just the default
    value when I access the property via
    ProfileWrapper pw = userprofile.getProfileForUser(user);
    Object prop = pw.getProperty("ClockSetup", "Locations");
    [att1.html]
    package users.setcolor;
    import com.bea.p13n.controls.exceptions.P13nControlException;
    import com.bea.p13n.property.PropertyDefinition;
    import com.bea.p13n.property.PropertySet;
    import com.bea.p13n.usermgmt.profile.ProfileWrapper;
    import com.bea.wlw.netui.pageflow.FormData;
    import com.bea.wlw.netui.pageflow.Forward;
    import com.bea.wlw.netui.pageflow.PageFlowController;
    import java.util.Collection;
    import java.util.Iterator;
    * @jpf:controller
    * @jpf:view-properties view-properties::
    * <!-- This data is auto-generated. Hand-editing this section is not recommended. -->
    * <view-properties>
    * <pageflow-object id="pageflow:/users/setcolor/SetColorController.jpf"/>
    * <pageflow-object id="action:begin.do">
    * <property value="80" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action:setColor.do#users.setcolor.SetColorController.ColorFormBean">
    * <property value="240" name="x"/>
    * <property value="220" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="action-call:@page:index.jsp@#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
    * <property value="240,240,240,240" name="elbowsX"/>
    * <property value="144,160,160,176" name="elbowsY"/>
    * <property value="South_1" name="fromPort"/>
    * <property value="North_1" name="toPort"/>
    * </pageflow-object>
    * <pageflow-object id="page:index.jsp">
    * <property value="240" name="x"/>
    * <property value="100" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="forward:path#success#index.jsp#@action:begin.do@">
    * <property value="116,160,160,204" name="elbowsX"/>
    * <property value="92,92,92,92" name="elbowsY"/>
    * <property value="East_1" name="fromPort"/>
    * <property value="West_1" name="toPort"/>
    * <property value="success" name="label"/>
    * </pageflow-object>
    * <pageflow-object id="forward:path#success#begin.do#@action:setColor.do#users.setcolor.SetColorController.ColorFormBean@">
    * <property value="204,160,160,116" name="elbowsX"/>
    * <property value="201,201,103,103" name="elbowsY"/>
    * <property value="West_0" name="fromPort"/>
    * <property value="East_2" name="toPort"/>
    * <property value="success" name="label"/>
    * </pageflow-object>
    * <pageflow-object id="control:com.bea.p13n.controls.ejb.property.PropertySetManager#propSetMgr">
    * <property value="31" name="x"/>
    * <property value="34" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="control:com.bea.p13n.controls.profile.UserProfileControl#profileControl">
    * <property value="37" name="x"/>
    * <property value="34" name="y"/>
    * </pageflow-object>
    * <pageflow-object id="formbeanprop:users.setcolor.SetColorController.ColorFormBean#color#java.lang.String"/>
    * <pageflow-object id="formbean:users.setcolor.SetColorController.ColorFormBean"/>
    * </view-properties>
    public class SetColorController extends PageFlowController
    * @common:control
    private com.bea.p13n.controls.ejb.property.PropertySetManager propSetMgr;
    * @common:control
    private com.bea.p13n.controls.profile.UserProfileControl profileControl;
    /** Cached possible colors from the User Profile Property Set definition.
    private String[] possibleColors = null;
    /** Get the possible colors, based upon the User Profile Property Set.
    public String[] getPossibleColors()
    if (possibleColors != null)
    return possibleColors;
    try
    PropertySet ps = propSetMgr.getPropertySet("USER", "GeneralInfo");
    PropertyDefinition pd = ps.getPropertyDefinition("FavoriteColor");
    Collection l = pd.getRestrictedValues();
    String[] s = new String[l.size()];
    Iterator it = l.iterator();
    for (int i = 0; it.hasNext(); i++)
    s[i] = it.next().toString();
    possibleColors = s;
    catch (P13nControlException ex)
    ex.printStackTrace();
    possibleColors = new String[0];
    return possibleColors;
    /** Get the user's favorite color from their profile.
    public String getUsersColor()
    try
    ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
    return profileControl.getProperty(profile, "GeneralInfo", "FavoriteColor").toString();
    catch (P13nControlException ex)
    ex.printStackTrace();
    return null;
    // Uncomment this declaration to access Global.app.
    // protected global.Global globalApp;
    // For an example of page flow exception handling see the example "catch" and "exception-handler"
    // annotations in {project}/WEB-INF/src/global/Global.app
    * This method represents the point of entry into the pageflow
    * @jpf:action
    * @jpf:forward name="success" path="index.jsp"
    protected Forward begin()
    return new Forward("success");
    * @jpf:action
    * @jpf:forward name="success" path="begin.do"
    protected Forward setColor(ColorFormBean form)
    // set the color in the user's profile
    try
    ProfileWrapper profile = profileControl.getProfileFromRequest(getRequest());
    profileControl.setProperty(profile, "GeneralInfo", "FavoriteColor", form.getColor());
    catch (P13nControlException ex)
    ex.printStackTrace();
    return new Forward("success");
    * FormData get and set methods may be overwritten by the Form Bean editor.
    public static class ColorFormBean extends FormData
    private String color;
    public void setColor(String color)
    this.color = color;
    public String getColor()
    return this.color;
    [GeneralInfo.usr]
    [att1.html]

  • How to retrieve 2 values from a table in a LOV

    Hi
    I'm pretty new to APEX. I try to retrieve two values from a table using a LOV. I have a table named DEBIT with then columns SITE, NAME and KEY
    I want to display NAME to the user in a list. When the user select an item from the list, I want to retrieve the data of the SITE and KEY column of this item in order to launch an SQL command based on this two values.
    How to retrieve thes two values whant the user chooses an item from the list ?
    I apologize for my english, being french.
    Regards.
    Christian

    Christian,
    From what I understood about your requirement, you want a 'select list with submit' which displays "NAME" and based on the value selected, you want to get the corresponding values for "SITE" and "KEY" from the table.
    <b>Step 1: Create a select list with submit, say P1_MYSELECT </b><br><br>
    Use something like this in the dynamic list of values for the select list: <br>
    SELECT NAME display_value, NAME return_value
    FROM DEBIT<br><br>
    <b>Step 2: Create a page process of type PL/SQL block. Also create 2 hidden items P1_KEY and P1_SITE. </b><br><br>
    In the PL/sQL, write something like:
    DECLARE
      v_key DEBIT.KEY%TYPE;
      v_site DEBIT.SITE%TYPE;
      CURSOR v_cur_myvals IS
              SELECT KEY, SITE
              FROM DEBIT
              WHERE NAME = :P1_MYSELECT;
    BEGIN
      OPEN v_cur_myvals;
      LOOP
              FETCH v_cur_myvals
              INTO  v_key,v_site;
              EXIT WHEN v_cur_myvals%NOTFOUND;
    :P1_KEY := v_key;   
    :P1_SITE := v_site; 
      END LOOP;
      CLOSE v_cur_myvals;
    END; <br><br>
    Then you can use these values for whatever purpose you need to.
    Hope this helps.

  • Retrieving checkbox values from JSP

    In my program I have an 'ADD' form.
    In that form I ask the question "Do you have a car?"
    with a single checkbox for reply.
    The code I use is below.
    Can anyone tell me how to set the checkbox to 'ticked' or 'unticked' in my
    main jsp by sending paramters from the ADD form's checkbox??
    ADD FORM...
    <form action='post' method='servlet/controller?task=addEmployee'>
    <input type'text' name='emplpoyee'>
    <input type='checkbox' name='car' value='true'>
    <input type='submit' name='submit' value='Add'>
    </form>
    Through a class I retrieve the values posted
    public Page doTask() {
    Employees employee = new Employees();
    employee.setName(request.getParameter("name"));
    employee.setCar(Boolean.getBoolean(request.getParameter("car")));
    try{
    String submit = request.getParameter("submit");
    if(submit.equals("Add")){
    model.addEmployee(employee);
    Page nextPage = new Page("/servlet/Controller?task=GetAllEmployeesTask");
    return nextPage;
    This class sends the parameters to my main JSP where
    this information is inserted. ('employees.jsp')
    my name is retrieved so...
    <= employees.getName()>
    how would I retrieve/set a checkbox value

    request.getParameter("car")
    the thing is that the browser will not send unchecked checkbox values. so you can only know it was checked by the presense or absense of the value.

  • Retrieving all values from hashmap in order you put them in

    Hi guys,
    I want to retrieve all values from a HashMap in the order I put them in.
    So I can't use the values() method that gives back a collection and iterate over that.
    Do you guys know a good way to do that ?

    You can just do something like this:
    class OrderedMap
        private final Map  m_rep = new HashMap();
        private final List m_keys = new ArrayList();
        public Object get( final Object key )
            return m_rep.get( key );
        public Object put( final Object key, final Object value )
            final Object result = m_rep.put( key, value );
            if ( result != null )
                m_keys.add( key );
            return result;
        public Object remove( final Object key )
            final Object result = m_rep.remove( key );
            if ( result != null )
                m_keys.add( key );
            return result;
        public Iterator keyIterator()
            return m_rep.iterator();
    }Then use it like this:
       for ( Iterator it = map.keyIterator(); it.hasNext(); )
           final Object value = map.get( it.next() );
       }This will be in the order you put them in. However, if you want to do this correctly, you should implement the Map interface and add all the methods. Another thing you can do is download the JDK 1.4 source, learn how they did and do it the same way for 1.2.
    R.

Maybe you are looking for

  • White Screen at power up

    Lately, when I press the power button, the screen simply turns white and nothing happens.  I have to then press and hold the power button to power off then start over to power it back up.  This only seems to have started after installing Mountain Lio

  • Short content DVD won't play

    I've had this problem for years, and I've finally decided to ask. Every time I make a short content DVD with under about 10 minutes of content, my finished Encore DVD won't play in some players.  The amount of data written by Encore is visibly small

  • Comparisons?

    Has anyone had experience with the Apple 30" display and any of either the Eizo, LaCie or high end NEC monitors. Would you care to comment on any comparison you care to make?

  • Having trouble with synching (iTunes/iPhone) & Security software

    I use ZoneAlarm Security Suite on my PC.  Ihave been using iTunes/iPhone successfully for a couple of years with this software, but after the most recent iPhone o/s upgrade I get communications errors that prohibit my iPhone from syching properly.  I

  • Keep getting Application Error

    Keep getting "Application Error 523 Reset" on home screen. Need help please!