Returning XMLType to JSP

Hello, all.
I have a stored function that returns XMLType data to a JSP page, similar to the example in the Oracle XML DB Developer's Guide (13-4). My schema was developed with great help from this forum and is referenced here:Re: unique constraint defined in xsd
My problem is I am getting the following error when I try to access the returned data in the jsp page:
java.lang.ClassCastException: oracle.sql.OPAQUE
     at querymaps.jspService(querymaps.jsp:45)
I cannot quite figure out how to get to the returned data.
Here is the stored function and a sample of data the same select statement returns:
CREATE OR REPLACE FUNCTION getMaps(userName varchar2)
RETURN XMLTYPE
AS
xmlDoc XMLTYPE;
BEGIN
SELECT extract(OBJECT_VALUE, '/mapset/map') into xmlDoc
FROM mapsetxml
WHERE existsNode(OBJECT_VALUE,'/mapset['''|| username ||''']')=1;
RETURN xmlDoc;
END;
<map>
<mapname>Florida</mapname>
<layer>
<layername>Counties</layername>
<layerid>counties</layerid>
<service>base</service>
<visible>1</visible>
<ftype>polygon</ftype>
</layer>
<placemark>
<placename>Florida</placename>
<envelope>
<minx>-186185.234572</minx>
<miny>2709914.999735</miny>
<maxx>596332.812876</maxx>
<maxy>3464678.999670</maxy>
</envelope>
</placemark>
</map>
The JSP scriplet code is nearly right from the sample- I am using a dataSource connection, so I don't know if that is the problem, or not.
<%
Connection conn=null;
CallableStatement stmt = null;
String dSrcName="jdbc/localDS";
String userName="tester";
XMLType xmlRes = null;
InitialContext ctxt = new InitialContext();
DataSource ds = (DataSource) ctxt.lookup(dSrcName);
conn = ds.getConnection();
try {        
stmt=conn.prepareCall("{ ? = call getmaps(?)}");
stmt.registerOutParameter(1, OracleTypes.OPAQUE,"SYS.XMLTYPE");
stmt.setString(2, userName);
stmt.execute();
xmlRes = (XMLType) stmt.getObject(1);
if (xmlRes != null) {
String mapString = xmlRes.getStringVal();
out.println("The map xml for :"+userName+" is "+mapString);
} catch (SQLException se) {
out.println(se.getMessage());
} catch (Exception e) {
out.println(e.getMessage());
} finally {
stmt.close();
conn.close();
%>
Thanks again.

Given the follow
SQL> var schemaURL varchar2(256)
SQL> var schemaPath varchar2(256)
SQL> --
SQL> begin
  2    :schemaURL := 'http://localhost:8080/public/mapset.xsd';
  3    :schemaPath := '/public/mapset.xsd';
  4  end;
  5  /
PL/SQL procedure successfully completed.
SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
  2  /
Call completed.
SQL> declare
  2    res boolean;
  3    xmlSchema xmlType := xmlType(
  4  '<?xml version="1.0" encoding="UTF-8" ?>
  5  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  6             xmlns:xdb="http://xmlns.oracle.com/xdb"
  7             version="1.0" xdb:storeVarrayAsTable="true">
  8    <!-- definition of simple types -->
  9    <xs:simpleType name="nameType">
10      <xs:restriction base="xs:string">
11        <xs:minLength value="1"/>
12        <xs:maxLength value="50"/>
13      </xs:restriction>
14    </xs:simpleType>
15    <xs:simpleType name="boolType">
16      <xs:restriction base="xs:unsignedByte">
17        <xs:minInclusive value="0"/>
18        <xs:maxInclusive value="1"/>
19      </xs:restriction>
20    </xs:simpleType>
21     <xs:simpleType name="minxType">
22      <xs:restriction base="xs:string">
23      </xs:restriction>
24    </xs:simpleType>
25     <xs:simpleType name="minyType">
26      <xs:restriction base="xs:string">
27      </xs:restriction>
28    </xs:simpleType>
29     <xs:simpleType name="maxxType">
30      <xs:restriction base="xs:string">
31      </xs:restriction>
32    </xs:simpleType>
33     <xs:simpleType name="maxyType">
34      <xs:restriction base="xs:string">
35      </xs:restriction>
36    </xs:simpleType>
37    <xs:simpleType name="usernameType">
38      <xs:restriction base="xs:string">
39        <xs:minLength value="7"/>
40        <xs:maxLength value="8"/>
41      </xs:restriction>
42    </xs:simpleType>
43    <xs:simpleType name="emailType">
44      <xs:restriction base="xs:string">
45        <xs:minLength value="19"/>
46        <xs:maxLength value="63"/>
47      </xs:restriction>
48    </xs:simpleType>
49     <!-- definition of complex types -->
50  <xs:complexType name="envType">
51      <xs:sequence>
52        <xs:element name="minx"  type="minxType" minOccurs="1" xdb:SQLName="MINX" />
53        <xs:element name="miny" type="minyType" minOccurs="1" xdb:SQLName="MINY"/>
54        <xs:element name="maxx"  type="maxxType" minOccurs="1" xdb:SQLName="MAXX" />
55        <xs:element name="maxy" type="maxyType" minOccurs="1" xdb:SQLName="MAXY"/>
56      </xs:sequence>
57    </xs:complexType>
58   <xs:complexType name="placemarkType">
59      <xs:sequence>
60        <xs:element name="placename"  type="nameType" minOccurs="1" xdb:SQLName="PLACENAME"/>
61        <xs:element name="envelope" type="envType" minOccurs="1" xdb:SQLName="ENVELOPE"/>
62      </xs:sequence>
63    </xs:complexType>
64    <xs:complexType name="layerType">
65      <xs:sequence>
66        <xs:element name="layername"  type="nameType" minOccurs="1" xdb:SQLName="LAYERNAME" />
67        <xs:element name="layerid"  type="nameType" minOccurs="1" xdb:SQLName="LAYERID" />
68        <xs:element name="service" type="nameType" minOccurs="1" xdb:SQLName="SERVICE"/>
69        <xs:element name="visible" type="boolType" xdb:SQLName="VISIBLE"/>
70        <xs:element name="ftype" type="nameType" xdb:SQLName="FTYPE" minOccurs="1" maxOccurs="1"/>
71      </xs:sequence>
72    </xs:complexType>
73     <xs:complexType name="mapType">
74      <xs:sequence>
75        <xs:element name="mapname"  type="nameType" minOccurs="1" xdb:SQLName="MAPNAME"/>
76        <xs:element name="layer"  type="layerType" minOccurs="1" maxOccurs="unbounded" xdb:SQLName="LAYER" />
77        <xs:element name="placemark" type="placemarkType" minOccurs="1" maxOccurs="unbounded"  xdb:SQLName="PLACEMARK"/>
78      </xs:sequence>
79    </xs:complexType>
80    <xs:complexType name="mapsetType" xdb:SQLType="mapset_t">
81      <xs:sequence>
82        <xs:element name="username"  type="usernameType" minOccurs="1" xdb:SQLName="USERNAME" />
83       <xs:element name="map" type="mapType" minOccurs="1" maxOccurs="unbounded"  xdb:SQLName="MAP" xdb:SQLCollType="MAP_V"/>
84       <xs:element name="startmap" type="nameType" minOccurs="1" maxOccurs="1" xdb:SQLName="STARTMAP"/>
85       <xs:element name="startplace" type="nameType" minOccurs="1" maxOccurs="1" xdb:SQLName="STARTPLACE"/>
86      </xs:sequence>
87    </xs:complexType>
88   <!--definition of main element -->
89    <xs:element name="mapset" type="mapsetType" xdb:defaultTable="MAPSETXML">
90      <xs:unique name="mapNameKey">
91         <xs:selector xpath=".//map"/>
92         <xs:field xpath="mapname"/>
93      </xs:unique>
94    </xs:element>
95    </xs:schema>');
96  begin
97    if (dbms_xdb.existsResource(:schemaPath)) then
98      dbms_xdb.deleteResource(:schemaPath);
99    end if;
100    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
101  end;
102  /
PL/SQL procedure successfully completed.
SQL> begin
  2    dbms_xmlschema.registerSchema
  3    (
  4      :schemaURL,
  5      xdbURIType(:schemaPath).getClob(),
  6      TRUE,TRUE,FALSE,TRUE
  7    );
  8  end;
  9  /
PL/SQL procedure successfully completed.
SQL> declare
  2    nested_table_name varchar2(32);
  3  begin
  4    select table_name
  5      into nested_table_name
  6      from user_nested_tables
  7     where table_type_name = 'MAP_V'
  8       and parent_table_name = 'MAPSETXML';
  9
10     execute immediate 'rename "'|| nested_table_name ||'" to MAP_TABLE';
11
12  end;
13  /
PL/SQL procedure successfully completed.
SQL> desc MAPSETXML
Name                                      Null?    Type
TABLE of SYS.XMLTYPE(XMLSchema "http://localhost:8080/public/mapset.xsd" Element "mapset") STORAGE Object-relational TYPE "mapset_t"
SQL> --
SQL> desc MAP_TABLE
Name                                      Null?    Type
SYS_XDBPD$                                         XDB.XDB$RAW_LIST_T
MAPNAME                                            VARCHAR2(50 CHAR)
LAYER                                              LAYER7525_COLL
PLACEMARK                                          PLACEMARK7528_COLL
SQL> --
SQL> --
SQL> create or replace trigger VALIDATE_MAPSET
  2  before insert or update on MAPSETXML
  3  for each row
  4  begin
  5     :new.object_value.schemaValidate();
  6  end;
  7  /
Trigger created.
SQL> insert into MAPSETXML values ( xmltype('<mapset>
  2  <username>tester1</username>
  3  <map>
  4  <mapname>Florida</mapname>
  5  <layer>
  6  <layername>Counties</layername>
  7  <layerid>counties</layerid>
  8  <service>base</service>
  9  <visible>1</visible>
10  <ftype>polygon</ftype>
11  </layer>
12  <placemark>
13  <placename>Florida</placename>
14  <envelope>
15  <minx>-186185.234572</minx>
16  <miny>2709914.999735</miny>
17  <maxx>596332.812876</maxx>
18  <maxy>3464678.999670</maxy>
19  </envelope>
20  </placemark>
21  </map>
22  <startmap>test</startmap>
23  <startplace>Tallahassee</startplace>
24  </mapset>
25  ').createSchemaBasedXML('http://localhost:8080/public/mapset.xsd'))
26  /
1 row created.
SQL> commit
  2  /
Commit complete.
SQL> set long 100000
SQL> --
SQL> select * from MAPSETXML
  2  /
SYS_NC_ROWINFO$
<mapset>
  <username>tester1</username>
  <map>
    <mapname>Florida</mapname>
    <layer>
      <layername>Counties</layername>
      <layerid>counties</layerid>
      <service>base</service>
      <visible>1</visible>
      <ftype>polygon</ftype>
    </layer>
SYS_NC_ROWINFO$
    <placemark>
      <placename>Florida</placename>
      <envelope>
        <minx>-186185.234572</minx>
        <miny>2709914.999735</miny>
        <maxx>596332.812876</maxx>
        <maxy>3464678.999670</maxy>
      </envelope>
    </placemark>
  </map>
  <startmap>test</startmap>
SYS_NC_ROWINFO$
  <startplace>Tallahassee</startplace>
</mapset>
SQL> CREATE OR REPLACE FUNCTION getMaps(userName varchar2)
  2  RETURN XMLTYPE
  3  AS
  4  xmlDoc XMLTYPE;
  5  BEGIN
  6    SELECT extract(OBJECT_VALUE, '/mapset/map') into xmlDoc
  7    FROM mapsetxml
  8    WHERE existsNode(OBJECT_VALUE,'/mapset['''|| username ||''']')=1;
  9    RETURN xmlDoc;
10  END;
11  /
Function created.
SQL> select getMaps('Florida') from dual;
GETMAPS('FLORIDA')
<map>
  <mapname>Florida</mapname>
  <layer>
    <layername>Counties</layername>
    <layerid>counties</layerid>
    <service>base</service>
    <visible>1</visible>
    <ftype>polygon</ftype>
  </layer>
  <placemark>
    <placename>Florida</placename>
GETMAPS('FLORIDA')
    <envelope>
      <minx>-186185.234572</minx>
      <miny>2709914.999735</miny>
      <maxx>596332.812876</maxx>
      <maxy>3464678.999670</maxy>
    </envelope>
  </placemark>
</map>
SQL>The following Java code
package com.oracle.st.xmldb.otn;
import com.oracle.st.xmldb.pm.common.baseApp.BaseApplication;
import com.oracle.st.xmldb.pm.examples.GetResourceByResourceID;
import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleTypes;
import oracle.sql.RAW;
import oracle.xdb.XMLType;
import oracle.xdb.dom.XDBDocument;
public class T415572 extends BaseApplication {
    public T415572() {
    public void doSomething(String[] Args) throws Exception
      OracleCallableStatement  statement = null;
      boolean result;
      statement = (OracleCallableStatement) getConnection().prepareCall("{ ? = call getmaps(?)}");
      statement.registerOutParameter(1,OracleTypes.OPAQUE,"SYS.XMLTYPE");
      statement.setString(2,"Florida");
      result = statement.execute();
      XMLType xml = (XMLType) statement.getObject(1);
      statement.close();
      XDBDocument doc = (XDBDocument) xml.getDOM();
      doc.writeToOutputStream(System.out);
      doc.close();
      getConnection().close();
    public static void main (String[] args)
     try
       BaseApplication example = new T415572();
       example.initializeConnection();
       example.doSomething(args);
     catch (Exception e)
       e.printStackTrace();
}results in
C:\TEMP>
C:\Oracle\JDeveloper\jdk\bin\javaw.exe -client -classpath C:\xdb\JDeveloper\Classes;C:\Oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar;C:\Oracle\product\10.2.0\db_1\LIB\xmlparserv2.jar;C:\Oracle\product\10.2.0\db_1\RDBMS\jlib\xdb.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\jakarta-slide-webdavlib-2.1.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\commons-httpclient.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\commons-logging.jar;C:\xdb\JDeveloper\jakarta-slide-webdavclient-bin-2.1\lib\jdom-1.0.jar -Dcom.oracle.st.xmldb.pm.ConnectionParameters=C:\\xdb\\jdeveloper\\SimpleExamples\\LocalConnection.xml -Dhttp.proxyHost=www-proxy.us.oracle.com -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=192.168.0.77|localhost|192.168.1.1|*.oracle.com|*.us.oracle.com -Dhttps.proxyHost=www-proxy.us.oracle.com -Dhttps.proxyPort=80 -Dhttps.nonProxyHosts=192.168.0.77|localhost|192.168.1.1|*.oracle.com|*.us.oracle.com com.oracle.st.xmldb.otn.T415572 -mx2048M
ConnectionProvider.establishConnection(): Connecting as SCOTT/TIGER@jdbc:oracle:oci8:@(description=(address=(host=localhost)(protocol=tcp)(port=1521))(connect_data=(service_name=ORA10GR2.xp.mark.drake.oracle.com)(server=DEDICATED)))
ConnectionProvider.establishConnection(): Database Connection Established
<map>
  <mapname>Florida</mapname>
  <layer>
    <layername>Counties</layername>
    <layerid>counties</layerid>
    <service>base</service>
    <visible>1</visible>
    <ftype>polygon</ftype>
  </layer>
  <placemark>
    <placename>Florida</placename>
    <envelope>
      <minx>-186185.234572</minx>
      <miny>2709914.999735</miny>
      <maxx>596332.812876</maxx>
      <maxy>3464678.999670</maxy>
    </envelope>
  </placemark>
</map>
Process exited with exit code 0.The code also works fine when modified to work with the thin driver...
Message was edited by:
mdrake

Similar Messages

  • Using return statement in jsp

    Hi all,
    I am using return statement in JSP page after a redirect to stop executing that page. If the data bean is not present then it must go to previous page. When this return statement is executed the previous page is displayed but url in browser remains same. Why it is so ?. Is there any other way to tell a JSP page to stop executing and redirect to another page.
    rgds
    Antony Paul

    Hi Antony,
    do you use the "forward()" method or the "redirect()" method???
    rgds
    Howy

  • Result of function returning XMLType truncated in query

    Oracle 10.2.0.2.0
    myFunc() is a function returning XMLType
    The query:
    select myFunc() from dual;
    return XML about 2Kb
    If I try to run the following query:
    select XMLElement("Test",(myFunc())) from dual;
    then I get a pice of XML with strange symbols at the end (like this L#sП)
    in 9.2.8.0 all works properly. What I should do?

    CREATE TABLE test_data
    (loan_id VARCHAR2(12) NOT NULL,
    workparty_id NUMBER,
    property_id NUMBER,
    contact_id NUMBER,
    primary_flag NUMBER,
    gen_comment VARCHAR2(4000),
    last_updated DATE,
    user_name VARCHAR2(50),
    deleted_flag NUMBER,
    cont_role_id NUMBER,
    contact_person_id NUMBER);
    CREATE TABLE test_data2
    (contact_id NUMBER,
    name VARCHAR2(44));
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10541,12439,11445,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,6,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10542,12439,10697,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,2,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10543,12439,2070,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,10,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10544,12439,2070,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,11,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',10545,12439,10527,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,19,33512);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12694,12439,11218,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,20,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12695,12439,11219,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,20,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12696,12439,11566,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,20,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11141,12439,10066,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,7,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11142,12439,11215,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,30,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11143,12439,11216,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,5,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',11150,12439,10433,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,3,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',12307,12439,1984,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,25,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',23792,12439,11217,1,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,15,NULL);
    INSERT INTO test_data (LOAN_ID,WORKPARTY_ID,PROPERTY_ID,CONTACT_ID,PRIMARY_FLAG,GEN_COMMENT,LAST_UPDATED,USER_NAME,DELETED_FLAG,CONT_ROLE_ID,CONTACT_PERSON_ID)
    VALUES('TEST_L1',87283,12439,14014,0,NULL,TO_DATE('2008-10-17 12:53:32', 'YYYY-MM-DD HH24:MI:SS'),'testuser',0,32,NULL);
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11218,'11218user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10433,'10433user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11217,'11217user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10066,'10066user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(14014,'14014user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11219,'11219user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11566,'11566user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11445,'11445user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10527,'10527user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11215,'11215user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(10697,'10697user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(2070,'2070user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(11216,'11216user');
    INSERT INTO test_data2 (CONTACT_ID,NAME)
    VALUES(1984,'1984user');
    commit;
    create or replace function myFuncXML return xmltype is
    ret xmltype;
    begin
    select
    XMLElement("WorkingParties",
    XMLAgg(
    XMLElement("Items",
    XMLForest(
    wp.workparty_id "ID",
    wp.loan_id "LoanID",
    wp.property_id "PropertyID",
    wp.contact_id "ContactID",
    wp.cont_role_id "ContRoleId",
    null "ParentContactID",
    wp.gen_comment "Description",
    wp.primary_flag "PrimaryFlag"
    ) into ret
    from test_data wp
    where
    nvl(wp.deleted_flag,0) <> 1 and
    wp.property_id = 12439
    and exists (select contact_id from test_data2 where contact_id = wp.contact_id)
    return ret;
    end;
    This sql returns - ok
    select myFuncXML from dual;
    This sql - fail
    select
    XMLElement("Test_root",
    myfuncxml
    from dual;
    if I comment line
    and exists (select contact_id from test_data2 where contact_id = wp.contact_id)
    in function - all works fine

  • How to return xmlType from Webservice generated with JDev and PL/SQL

    Hi,
    I have generated an PL/SQL package that's returning a value as xmlType.
    With JDeveloper I'm deploying this package as a webservice. When invoking the webservice from a webbrowser the result looks like:
    <?xml version="1.0" encoding="UTF-8" ?>
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SOAP-ENV:Body>
    <ns1:testXmltypeResponse
    xmlns:ns1="http://app/webservice.wsdl"
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <return xsi:type="xsd:string">
    <ROWSET>
    <ROW>
    <TODAY>12-OCT-07</TODAY>
    </ROW>
    </ROWSET>
    </return>
    </ns1:testXmltypeResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    The problem is that the <return> tag contains 'xsi:type="xsd:string"'. And now the webservice response is not valid XML because the return value contains XML and not a string.
    The solution would be, when invoking the webservice if the xsi:type would be missing from the result tag or would contains xsd:any. I tried editing the WSDL in JDeveloper and changing the type to xsd:any. After deploying and calling the WSDL from the webbrowser it contains this type. But when invoking the method from the webbrowser it still returns xsd:string as type.
    How can I get rid of this type in the <return> or change it.
    My JDeveloper version is 10.1.3.3.0 The Oracle database and 9iAS are 10.2.
    Thanks in advance,
    Thijs

    What version are you on?
    Works fine for me on my 11g:
    SQL> create or replace procedure testxml (clob_out out clob)
      2  is
      3     l_clob   clob;
      4     l_ctx    dbms_xmlquery.ctxhandle;
      5  begin
      6     l_ctx := dbms_xmlquery.newcontext ('select * from dual');
      7     l_clob := dbms_xmlquery.getxml (l_ctx);
      8     clob_out := l_clob;
      9     dbms_xmlquery.closecontext (l_ctx);
    10  end testxml;
    11  /
    Procedure created.
    SQL>
    SQL> variable vout clob;
    SQL>
    SQL> exec testxml (:vout)
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print vout
    VOUT
    <?xml version = '1.0'?>
    <ROWSET>
       <ROW num="1">
          <DUMMY>X</DUMMY>
       </ROW>
    </ROWSET>But definitely you can optimize your proc a bit: Try
    create or replace procedure testxml (clob_out in out nocopy clob)
    is
       l_ctx    dbms_xmlquery.ctxhandle;
    begin
       l_ctx := dbms_xmlquery.newcontext ('select * from dual');
       clob_out := dbms_xmlquery.getxml (l_ctx);
       dbms_xmlquery.closecontext (l_ctx);
    end testxml;
    /

  • EBS ISG using custom PL/SQL functions that return XMLType

    Hi,
    We have a custom PL/SQL package that we use for interfacing systems and some of the functions in this package ruturn an XMLType. We want to deploy the package functions as web services through the ISG, but it is not working as expected. When deployed through the ISG, the functions with XMLType return type produce a null response from the ISG (they work fine when called in SQL or PL/SQL; functions with non-XMLTypes work fine).
    If we change the return type to CLOB (and use getClobVal() on the XMLType) then we get a response from the ISG, but it changes all the angle-brackets in the CLOB (which is still arbitrary XML text) to &lt; &gt; ...
    What is the proper way to get the complex XMLType output through the ISG? Anyone have any more experience?
    Thanks,
    --Walt                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Alex,
    For the predicate groups that are indexed/stored, the exact operator types (as in equality, inequality, like etc) that are indexed are specified while assigning the default index parameters. In the following example, exf$indexoper is used to specify the list of indexed operators.
    BEGIN
      DBMS_EXPFIL.DEFAULT_INDEX_PARAMETERS('Car4Sale',
        exf$attribute_list (
           exf$attribute (attr_name => 'HorsePower(Model, Year)',
                          attr_oper => exf$indexoper('=','<','>','>=','<='),
                          attr_indexed => 'FALSE')    --- stored predicate group
    END;
    /You can find more information about exf$indexoper at
    http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28419/t_expfilobj.htm#ARPLS153
    Could you confirm that you chose to index 'is null' and 'is not null' while assigning the default index parameters ? This information is available in OPERATOR_LIST column of the USER_EXPFIL_DEF_INDEX_PARAMS view.
    Hope this helps,
    -Aravind.

  • Returning ResultSet to jsp from servlet

    Hi,
    I am trying to return a ResultSet (generated in servlet) to a jsp page, but get a "java.lang.ClassCastException" error. Here is my description of what i'm doing....
    I have a search screen (SearchInventory.jsp) that the user goes to to perform the search based on a few variables. When the search button is clicked, i go to a servlet (SearchInventory.java) which gets a ResultSet. In the servlet, i am storing the ResultSet into a bean object, and finally use the RequestDispatcher to redirect to the .jsp page. (and get the "java.lang.ClassCastException" error).
    Here is the relevant code from all parts of the app:
    SearchInventory.java:---------------------------------------------------------------------
    SearchBean sbean=new SearchBean();
    String QueryStr="select ProdName from products";
    Statement stmt=conn.createStatement();
    rs=stmt.executeQuery(QueryStr);
    sbean.setSearchRS(rs);
    req.getSession(true).setAttribute("s_resbean",sbean);
    HttpSession session=req.getSession(true);
    session.setAttribute("s_resbean",rs);
    req.setAttribute("sbean",rs);
    String url="/SearchInventory.jsp";
    RequestDispatcher dispatcher=getServletContext().getRequestDispatcher(url);
    dispatcher.forward(req,res);
    SearchBean.java:
    public class SearchBean extends HttpServlet{
    private int searchFlag=0;
    private static ResultSet searchRS;
         public void setSearchRS(ResultSet rs){
              this.searchRS=rs;
    And finally, the .jsp page..SearchInventory.jsp:
    <%@ page language="java" import="java.lang.*,java.sql.*,javax.sql.*,PopLists.PopInvLists,beans.SearchBean"%>
    <jsp:useBean scope="session" id="s_resbean" class="beans.SearchBean" />
    ResultSet search=(ResultSet)request.getAttribute("s_resbean");
    If i don't cast it to type ResultSet, i get the following error, which leads me to believe that i should be casting it to a Result Set.
    C:\Apache\tomcat_4.1.29\work\Standalone\localhost\DBTest\SearchInventory_jsp.java:75: incompatible types
    found : java.lang.Object
    required: java.sql.ResultSet
    ResultSet search=request.getAttribute("s_resbean");
    Please help...
    Thanks in advance,
    Aditya.

    Yikes...i realized some of my many problems...i'm using setAttribute multiple times here...(shown by arrows at the end)
    sbean.setSearchRS(rs);
    req.getSession(true).setAttribute("s_resbean",sbean);//<--
    HttpSession session=req.getSession(true);
    session.setAttribute("s_resbean",rs);//<--
    req.setAttribute("sbean",rs);//<--
    I've tried using one at a time since, and it still doesn't work. How exactly should i be setting the attribute. I don't think any of the methods listed above are completely correct...cause it's never worked!:(
    Is anything that i've done correct? (ie. bean/jsp). I'm really starting to doubt myself now. I've been reading up on this, and some people say that one shouldn't return a ResultSet to the jsp, but instead return an ArrayList. Is this correct? If so, how do i convert an ResultSet to an ArrayList?
    -Aditya.

  • Return rowset to JSP Page

    In producing a report table, for example, I'd like to have the JSP page access the
    rowset from the Bean and then walk through the rowset a row at a time, formatting
    output. All the examples I've found create the table code in the servlet. I'd like to
    avoid that, creating the html in the JSP page only.

    hi,
    I think You can do it in this way.
    Store the values that you get from rowset in a hash table and set the return type of your bean method to hashtable. When you call the method in jsp assign the return value to a hash table. From there you can manipulate the objects in hash table.
    Hope this works,
    chandu

  • Navigation problems on SLD - always returning on index.jsp

    Hello, we are working with System Landscape Directory without the SAP Portal, and we have a lot of navigation errors.
    Every time we try to mantain any option (for example; add new system landscape) the browser always returns to home SLD page (index.jsp)... So is not possible to configure anything, only start/stop server.
    Somebody has been with this or similiar problem sometimes?
    Our Relesase is Netweaver 2004 SP14 for abap and java stack.

    For example, when we try to add a system lanscape:
    On home page, we click to System Landscapes.
    On System Landscape Browser, click on New Landscape,
    On popup asking the name, we put for example 'LNDSC1' and ok.
    Then the system lanscape is not created and the browser returns me to home page again.
    When we try to add a new technical systems, the SLD has the same behaviour as before...
    Another example:
    On Administration tab, when we try to import CIM models and data, after we introduce the name of the import file and click on 'Import file'.. the page returns to home page again without messages..
    I'm using user j2ee_admin. I'm not sure if is the correct users..

  • Returning ResultSets to jsp

    Hi,
    I'm using a javabean that returns a resultset from oracle and i need that resultset to execute another query so i can return the data to a jsp. My problem is it will only execute through a while loop once as i have passed it to a String. Does anyone have any idea how i could go about this? So far I've been using while loops eg.
         result = select.executeQuery("select * from score where stu_score = 10 and level_id = 1");
              while(result.next())      
    String s = result.getString("stu_id");
    System.out.println(s);
    result = select.executeQuery("Select stu_name from Student where stu_id = '"+s+"'");
    while(result.next())
         String r = result.getString("stu_name");
         System.out.println(r);
    This will return one stu_id and one stu_name. Any ideas?

    Hi,
    You are getting results from the database and storing them in result. Inside your outermost while loop you are overwriting the same object i.e. result, by saying
    result = select.executeQuery("Select stu_name from Student where stu_id = '"+s+"'");
    That is why you only get one stu_id and one stu_name. Outside the first while loop, declare another ResultSet object, call it result2, and use that one inside.
    However, I strongly recommend not to run such code in a jsp. Do this in a servlet, and set your results that you get through the resultsets in a data transfer object, store it in the request or session, and then get it in the jsp. Also, remeber to close your resultset, statment, and connection objects, otherwise you will suffer from the open cursors problem - eventually! And above all, that is the right way of doing stuff.
    Hope this helps.

  • Oracle error -6508 returned when executing JSP

    The JSP program executes a stored procedure from a package. I've recompiled the package after some changes. The JSP returns -6508 error when it is executing the procedure. The error is returned only after recompiling the stored package. What could be the problem?

    Hi,
    ORA-6508 error is returned when the stored procedure cannot be found.
    ORA-06508 PL/SQL: could not find program unit being called
    Cause: An attempt was made to call a stored program that could not be found. The program may have been dropped or incompatibly modified, or have compiled with errors.
    Action: Check that all referenced programs, including their package bodies, exist and are compatible.
    Please check the package signature and the specifications.
    Thanks,
    Rashmi.

  • XMLElement() returns 'XMLTYPE()'

    Hi. I'm a newbie to Oracle XML, and I'm having trouble just getting off the ground. I would expect the following SQL statement:
    select xmlelement("dummy",dummy) result from dual;
    to return
    RESULT
    <dummy>X</dummy>
    but instead it returns
    RESULT()
    XMLTYPE()
    Any idea why?
    I'm running Oracle Database version 10.2.0.2.0 and SQL*Plus version 9.0.1.4.0.
    Thank you.

    Yes, you are using a version of SQL*PLUS (9.1.x) that is linked with pre 9.2 OCI libraries. These libraries do not understand XMLType. Please make sure that you use SQL*PLUS 9.2.0.3.0 or later. I would strongly recommend that you use a SQL*PLUS version that is equal or newer than your database..
    BTW
    select xmlelement("dummy",dummy).getCLOBVAL() result from dual
    should work as this will series the XML into a CLOB on the server and then send the client a CLOB

  • 10g XMLTABLE - can I return XMLTYPE col as well as extract specific columns

    Hi,
    (This is for version 10.2.0.4)
    Currently, we have a giant XML column which contains many parts to it. We split those into individual parts via XMLSEQUENCE and then loop through to extract information from two other XMLTYLE columns. I'd like to be able to use XMLTABLE to join the XMLTYPE columns to each other in one SQL statement, as I think it should be more efficient. (We're having issues when the big XML column has 400 or more parts in it - looping and doing extract values on two xmltype columns 400+ times is proving slow going!)
    Anyway, what I'd like to do is use XMLTABLE to produce a table-like structure for each column, then join them so that 1st part in col1 = 1st part in col2 = 1st part in col3.
    I've looked around at the documentation and google, but I'm getting stuck at one particular point - I would like to return both the XMLTYPE and specific extracted values from that XMLTYPE as part of the XMLTABLE on each column. I just can't seem to find a way to do it.
    Here's an example (that I've nabbed from http://thinktibits.blogspot.com/2011/03/oracle-xmltable-example-part-1.html ) that will hopefully explain more clearly what I'd like to do, taking just one column to start with:
    CREATE TABLE xml_test
    (NOTEBOOK XMLTYPE);
    insert into xml_test values ('<?xml version="1.0" encoding="UTF-8"?><Product Type=''Laptop''><Notebook Brand="HP" Model="Pavilion dv6-3132TX Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i7</Processor><RAM>4 GB</RAM></Notebook><Notebook Brand="HP" Model="HP Pavilion dv6-3032TX Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i7</Processor><RAM>6 GB</RAM></Notebook><Notebook Brand="Toshiba" Model="Satellite A660/07R 3D Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i7</Processor><RAM>4 GB</RAM></Notebook><Notebook Brand="Toshiba" Model="Satellite A660/15J Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i5</Processor><RAM>6 GB</RAM></Notebook></Product>');
    commit;
    SELECT NOTEBOOKS1.*
      FROM xml_test PO,
           XMLTable('//Notebook' PASSING PO.NOTEBOOK) notebooks1;
    COLUMN_VALUE                                                                                                                                          
    <Notebook Brand="HP" Model="Pavilion dv6-3132TX Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i7</Processor><RAM>4 GB</RAM></Notebook>
    <Notebook Brand="HP" Model="HP Pavilion dv6-3032TX Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i7</Processor><RAM>6 GB</RAM></Notebook>
    <Notebook Brand="Toshiba" Model="Satellite A660/07R 3D Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i7</Processor><RAM>4 GB</RAM></Notebook>
    <Notebook Brand="Toshiba" Model="Satellite A660/15J Notebook"><Harddisk>640 GB</Harddisk><Processor>Intel Core i5</Processor><RAM>6 GB</RAM></Notebook>
    4 rows selected.
    SELECT NOTEBOOKS2.*
      FROM xml_test PO,
           XMLTable('//Notebook' PASSING PO.NOTEBOOK
           COLUMNS  row_num for ordinality,
                    "BrandType"    CHAR(10) PATH '@Brand',
                    "ProductModel" CHAR(50) PATH '@Model',
                    "Harddisk" CHAR(10) PATH 'Harddisk',
                    "Processor" CHAR(20) PATH 'Processor',
                    "RAM" CHAR(10) PATH 'RAM') AS NOTEBOOKS2;
       ROW_NUM BrandType  ProductModel                                       Harddisk   Processor            RAM      
             1 HP         Pavilion dv6-3132TX Notebook                       640 GB     Intel Core i7        4 GB     
             2 HP         HP Pavilion dv6-3032TX Notebook                    640 GB     Intel Core i7        6 GB     
             3 Toshiba    Satellite A660/07R 3D Notebook                     640 GB     Intel Core i7        4 GB     
             4 Toshiba    Satellite A660/15J Notebook                        640 GB     Intel Core i5        6 GB     
    4 rows selected.What I'd like is to have the COLUMN_VALUE contents from the first select to appear as a column in the second select - is it possible?
    At worst case, I could do a join, only that produces a cartesian product because I don't know how to label the rows from within the first query's XMLTABLE (if I used rownum in the query itself, does that guarentee to come out in the same order as the XMLTABLE results? Would part 1 always be labeled row 1, part 2 row2, etc?).
    I hope that makes some sort of sense - I'm not up on XML terms, sadly.
    ETA: If there's no way of doing this via XMLTABLE, is there any other way of achieving it?
    Edited by: Boneist on 02-Dec-2011 17:14

    Hi,
    Define an additional XMLType projection in the COLUMNS clause with PATH = '.' (the context item) :
    SQL> set long 500
    SQL>
    SQL> SELECT x1.*
      2  FROM xml_test t
      3     , XMLTable('/Product/Notebook' PASSING t.notebook
      4         COLUMNS rn FOR ORDINALITY
      5               , BrandType      VARCHAR2(10) PATH '@Brand'
      6               , ProductModel   VARCHAR2(50) PATH '@Model'
      7               , Harddisk       VARCHAR2(10) PATH 'Harddisk'
      8               , Processor      VARCHAR2(20) PATH 'Processor'
      9               , RAM            VARCHAR2(10) PATH 'RAM'
    10               , NoteBook_node  XMLType      PATH '.'
    11       ) x1
    12  ;
            RN BRANDTYPE  PRODUCTMODEL                                       HARDDISK   PROCESSOR            RAM        NOTEBOOK_NODE
             1 HP         Pavilion dv6-3132TX Notebook                       640 GB     Intel Core i7        4 GB       <Notebook Brand="HP" Model="Pavilion dv6-3132TX Notebook">
                                                                                                                          <Harddisk>640 GB</Harddisk>
                                                                                                                          <Processor>Intel Core i7</Processor>
                                                                                                                          <RAM>4 GB</RAM>
                                                                                                                        </Notebook>
             2 HP         HP Pavilion dv6-3032TX Notebook                    640 GB     Intel Core i7        6 GB       <Notebook Brand="HP" Model="HP Pavilion dv6-3032TX Notebook">
                                                                                                                          <Harddisk>640 GB</Harddisk>
                                                                                                                          <Processor>Intel Core i7</Processor>
                                                                                                                          <RAM>6 GB</RAM>
                                                                                                                        </Notebook>
             3 Toshiba    Satellite A660/07R 3D Notebook                     640 GB     Intel Core i7        4 GB       <Notebook Brand="Toshiba" Model="Satellite A660/07R 3D Notebook">
                                                                                                                          <Harddisk>640 GB</Harddisk>
                                                                                                                          <Processor>Intel Core i7</Processor>
                                                                                                                          <RAM>4 GB</RAM>
                                                                                                                        </Notebook>
             4 Toshiba    Satellite A660/15J Notebook                        640 GB     Intel Core i5        6 GB       <Notebook Brand="Toshiba" Model="Satellite A660/15J Notebook">
                                                                                                                          <Harddisk>640 GB</Harddisk>
                                                                                                                          <Processor>Intel Core i5</Processor>
                                                                                                                          <RAM>6 GB</RAM>
                                                                                                                        </Notebook>
    I'm not sure I understand the rest of your requirement.
    Do you want to further break the generated XMLType into a set of relational rows, or repeat the operation on different columns from the same base table?

  • Assertion failed when returning to a jsp

    Hi,
    I am using JSF Final and Struts-faces (nightly). This error is bizarre because it's an error on the view tag.
    I'm getting this error message when something fails in the resulting action and I send it back to the same jsp using getInputForward():
    javax.faces.FacesException: Assertion Failed
         com.sun.faces.util.Util.doAssert(Util.java:1300)
         com.sun.faces.taglib.jsf_core.ViewTag.getComponentType(ViewTag.java:236)
         javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:1022)
         javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:1045)
         javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:732)
         javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:425)
         com.sun.faces.taglib.jsf_core.ViewTag.doStartTag(ViewTag.java:105)
         org.apache.jsp.jsp.timesheet.timeSheetEntry_jsp._jspx_meth_f_view_0(timeSheetEntry_jsp.java:280)
    ...my jsp is:
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-faces" prefix="s" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <body>
    <table>
        <tr>
            <!-- HEADER -->
            <td colspan='2' class="pageHeader">
                <%@ include file="../header.jsp" %>
            </td>
        </tr>
        <tr>
            <!-- MENU -->
            <td class="menu">
                <%@include file="../menu.jsp"%>
            </td>
            <!-- Content -->
            <td class="main">
                <f:view>       
                <s:html locale="true">
                <head>
                    <!-- Page Title -->
                    <title>Time Sheet Entry</title>
                    <s:base/>
                    <s:stylesheet path="/css/stylesheet.css"/>
                </head>
           <s:form action="/timesheet/timeSheetEntryForm" id="thisForm">
              <h:panelGrid
                       id="switchDays"
                       columns="3"
                    styleClass="form-background"
                 columnClasses="summary-left,summary-center,summary-right">
                        <h:panelGroup>
                        <h:outputText value="Number:"/>
                        <h:outputText id="employeeNum" value="#{TimeSheetForm.timeSheet.employee.number}">
                        </h:outputText>
                        </h:panelGroup>
                        <h:panelGroup>
                        <h:outputText value="Name:"/>
                        <h:outputText value="#{TimeSheetForm.timeSheet.employee.name}"/>                                           
                        </h:panelGroup>
                        <h:panelGroup>
                        <h:outputText value="Date:"/>
                        <h:outputText id="date" value="#{TimeSheetForm.timeSheet.date}">
                            <f:convertDateTime dateStyle="full"/>
                        </h:outputText>                   
                        </h:panelGroup>
                        <h:panelGroup>
                        <h:outputText value="Total:"/>
                        <h:outputText id="totalTime" value="#{TimeSheetForm.totalTime}">                       
                        </h:outputText>
                        </h:panelGroup>
                        <h:panelGroup>
                        <h:outputText value="Status Is Currently:"/>
                        <h:outputText id="status" value="#{TimeSheetForm.timeSheet.timeSheetStatus.status}"/>                                           
                        </h:panelGroup>
                        <h:panelGroup>
                        <h:outputText value="Status Will Change To:"/>
                        <h:selectOneMenu id="newStatus" value="#{TimeSheetForm.timeSheet.timeSheetStatus.id}">                       
                           <f:selectItems value="#{TimeSheetForm.status}"/>
                        </h:selectOneMenu>
                        </h:panelGroup>
                        <h:outputText value=" "/>
                        <h:outputText value=" "/>
              </h:panelGrid>
            <c:if test = "${employee.id == TimeSheetForm.timeSheet.employee.id}">
              <h:panelGrid id="days"
               columns="7">
                <h:outputLink id="sunday" value="/tss/faces/timesheet/timeSheetEntry.do?dayOfWeek=1">
                    <f:verbatim>Sunday</f:verbatim>
                </h:outputLink>
                <h:outputLink id="monday" value="/tss/faces/timesheet/timeSheetEntry.do?dayOfWeek=2">
                    <f:verbatim>Monday</f:verbatim>
                </h:outputLink>
                <h:outputLink id="tuesday" value="/tss/faces/timesheet/timeSheetEntry.do?dayOfWeek=3">
                    <f:verbatim>Tuesday</f:verbatim>
                </h:outputLink>
                <h:outputLink id="wednesday" value="/tss/faces/timesheet/timeSheetEntry.do?dayOfWeek=4">
                    <f:verbatim>Wednesday</f:verbatim>
                </h:outputLink>
                <h:outputLink id="thursday" value="/tss/faces/timesheet/timeSheetEntry.do?dayOfWeek=5">
                    <f:verbatim>Thursday</f:verbatim>
                </h:outputLink>
                <h:outputLink id="friday" value="/tss/faces/timesheet/timeSheetEntry.do?dayOfWeek=6">
                    <f:verbatim>Friday</f:verbatim>
                </h:outputLink>
                <h:outputLink id="saturday" value="/tss/faces/timesheet/timeSheetEntry.do?dayOfWeek=7">
                    <f:verbatim>Saturday</f:verbatim>
                </h:outputLink>
              </h:panelGrid>
              </c:if>
                <h:outputLink value="mailto:[email protected]">
                    <f:verbatim>Suggestion or Comment or Bug Report</f:verbatim>
                </h:outputLink>
              <s:message key="time.sheet.motd"/>
              <h:dataTable
                var="entry"
                value="#{TimeSheetForm.timeEntry}"
                styleClass="form-background"
                headerClass="form-header"
                columnClasses="form-field">
                <h:column>
                  <f:facet name="header">
                    <h:outputText value="Start Time"/>
                 </f:facet>
                  <h:inputText size="4" maxlength="4" value="#{entry.startTime}">
                  </h:inputText>
                </h:column>
                <h:column>
                  <f:facet name="header">
                    <h:outputText value="End Time"/>
                 </f:facet>
                  <h:inputText size="4" maxlength="4" value="#{entry.endTime}">
                  </h:inputText>
                </h:column>
                <h:column>
                  <f:facet name="header">
                    <h:outputText value="Task Code"/>
                 </f:facet>
                  <h:inputText size="2" maxlength="2" value="#{entry.task.id}">
                  </h:inputText>
                </h:column>
                <h:column>
                  <f:facet name="header">
                    <h:outputText value=""/>
                 </f:facet>
                  <h:outputText value="#{entry.task.description}"/>
                </h:column>
                <h:column>
                  <f:facet name="header">
                    <h:outputText value="Study Number"/>
                 </f:facet>
                  <h:inputText size="6" maxlength="6" value="#{entry.study.number}">
    <%----%>
                    <f:convertNumber pattern="000000"/>
                  </h:inputText>
                </h:column>             
                <h:column>
                  <f:facet name="header">
                    <h:outputText value=""/>
                 </f:facet>
                  <h:outputText value="#{entry.study.description}"/>
                </h:column>
                <h:column>
                  <f:facet name="header">
                    <h:outputText value="Version Status"/>
                 </f:facet>
                  <h:inputText size="2" maxlength="2" value="#{entry.versionStatus.code}">
                  </h:inputText>
                </h:column>   
                <h:column>
                  <f:facet name="header">
                    <h:outputText value="Version"/>
                 </f:facet>
                  <h:outputText value="#{entry.versionStatus.version.name}"/>
                </h:column>
                <h:column>
                  <f:facet name="header">
                    <h:outputText value=""/>
                 </f:facet>
                  <h:outputText value="#{entry.versionStatus.description}"/>
                </h:column>
                <h:column>
                  <f:facet name="header">
                    <h:outputText value="Cases"/>
                 </f:facet>
                  <h:inputText size="2" maxlength="2" value="#{entry.cases}">
                  </h:inputText>
                </h:column>             
                </h:dataTable>
                <h:panelGrid
                       columns="2"               
                       columnClasses="button">               
                    <h:commandButton id="submit" action="success" value="Submit"/>               
                    <h:commandButton id="back" action="back" value="Back"/>
                </h:panelGrid>
                </s:form>
                <s:errors/>
                </center>           
                </s:html>
                </f:view>             
            </td>
        </tr>
        <tr>
            <!-- FOOTER -->
            <td colspan='2'>
                <%@ include file="../footer.jsp" %>
            </td>
        </tr>
    </table>
    </body>
    </html>

    I had this error as well. I needed to change my <f:view> tags to be <f:subview id="xxxx"> because my page is being embedded in a <f:view> page.
    Don't know if you're doing the same.
    Hope this helps!
    Bernard

  • How to call a stored procedure to search db then return results to jsp page

    Hi,
    Most of what i have said is in the title. Im trying to search a database using a stored procedure that will call the procedure using sql2000 then coming back with the results to the jsp page. all of this is done using JSP web pages. if JAVA example is availabel then let me know.
    I need some examples.. I cant seem to find any code that will help.
    Thanks

    Use CallableStatement. You can set parameters with setXXX and registerOutParameter methods. And to fetch results, you can use getXXX methods of it.

  • How to call a stored to search database then return results to jsp page

    Hi,
    Most of what i have said is in the title. Im trying to search a database using a stored procedure that will call the procedure using sql2000 then coming back with the results to the jsp page. all of this is done using JSP web pages. if JAVA example is availabel then let me know.
    I need some examples.. I cant seem to find any code that will help.
    Thanks

    Make use of Callablestatement. You can set parameters to it by registerOutParameters and setXXX methods. And use getXXX methods to get results of procedure.

Maybe you are looking for

  • Flex 2.0.1 broke LineSeries.form in AS?

    Hi guys, I think this is a bug, but maybe I'm doing something wrong... When programatically adding a new LineSeries to a chart via AS, the compiler fails to find the LineSeries object's "form" property. This worked fine in Flex 2.0.0. Here's a really

  • My photo books l was working on suddenly updated to another language instead of English

    In iphoto my books l was working on updated and changed to another language other than English, how do l get it back to English

  • Provide XML or json format API

    I love Curah!, it's simple and clean service. Wouldn't it be great if it serve curated contents with json or xml format? I want to display my contents via my Windows Store App.

  • Issue with importing & editing mini DVDs

    We used a Sony mini DVD camcorder 2000-2005.  I have about 25 discs that I converted into AVI format which obviously iMovie does not support.  I have used Toast Titanium as well as several other programs to convert files to m4v, mp4, mov, dv.  Some d

  • CPU for M57P

    I have a M57p Lenovo Think Centre 6395 and I wanted to update the CPU, a friend gavce me an E8500 Dual Core and I added it in. The machine goes through the Boot setup but stops and says error with CPU code but, if I hit the F2 button for resume, the