BC4J Struts Integration

Hi, I am trying to develop a sample application based on BC4J and Struts. I used the native integration between these two framework (as it is explained in the "Building a Web Store with Struts & BC4J Frameworks") but I have a problem:
I need to access more than one applicationModule within a page. The problem is the native integration uses only one ApplicationModule per page (the one that is specified in the <set-property property="application" value="ToyStore"/> in the action tag for each action.
Is there an easy way to access more then one applicationModule from one StrutsAction and JSP page?
Thanks in advance

part 2 of posting:
<action path="/navigateEmpView1" parameter="jboEvent" type="oracle.jbo.html.struts11.actions.NavigationAction">
<set-property property="viewobject" value="EmpView1"/>
<set-property property="application" value="Mypackage1Module"/>
<set-property property="releasemode" value="Stateful"/>
</action>
Since NavigationAction is a Struts DispatchAction (instead of calling the execute method on the action, the method name to execute is passed using a request parameter), you will need to specify the event name on the request with the URL:
/nextEmpView1.do?jboEvent=next
To understand how this work, you need to look at how the BC4JContext is initialized:
The following code is extracted from BC4JrequestProcessor:
BC4JContext context = (BC4JContext)request.getAttribute(BC4JContext.ContextAttrName);
// Instantiate the context and save it on the request
if (context == null)
context = new BC4JContext();
request.setAttribute(BC4JContext.ContextAttrName, context);
if (initPageFromPath(bc4jMapping, request, response))
// First initialize context with the existing mapping values
bc4jMapping.initializeContext(request, response, context);
// Then use request para[i]Long postings are being truncated to ~1 kB at this time.

Similar Messages

  • BC4J/Struts Integration classes

    Does anyone know of any documentation on the BC4J classes that are used in Jdeveloper for struts integration?
    I have access to the source that came packaged in jdeveloper but I still have questions about the classes BC4JActionMapping,BC4JRequestProcessor,BC4JActionForm,BC4JUtils,BC4JContext, and HTTPContainer.
    One of my initial questions is whether I should specify the view object name I'm using in an action in my struts-config.xml file as I do with the application module? Also, when I do this how do I programmatically access it.
    I'm also interested in how the BC4J Client Data Model ".cpx" is used and if this needs to be packaged when deploying a bc4j/struts web application.
    The postings at Re: re:Using Struts without Datatags <jbo:xxx> by Steven Muench were terrific. A great start for understanding the integration of the two technologies. I would just like more detail on how/why bc4j leverages struts extension points.
    Thanks in advance!

    part 2 of posting:
    <action path="/navigateEmpView1" parameter="jboEvent" type="oracle.jbo.html.struts11.actions.NavigationAction">
    <set-property property="viewobject" value="EmpView1"/>
    <set-property property="application" value="Mypackage1Module"/>
    <set-property property="releasemode" value="Stateful"/>
    </action>
    Since NavigationAction is a Struts DispatchAction (instead of calling the execute method on the action, the method name to execute is passed using a request parameter), you will need to specify the event name on the request with the URL:
    /nextEmpView1.do?jboEvent=next
    To understand how this work, you need to look at how the BC4JContext is initialized:
    The following code is extracted from BC4JrequestProcessor:
    BC4JContext context = (BC4JContext)request.getAttribute(BC4JContext.ContextAttrName);
    // Instantiate the context and save it on the request
    if (context == null)
    context = new BC4JContext();
    request.setAttribute(BC4JContext.ContextAttrName, context);
    if (initPageFromPath(bc4jMapping, request, response))
    // First initialize context with the existing mapping values
    bc4jMapping.initializeContext(request, response, context);
    // Then use request para[i]Long postings are being truncated to ~1 kB at this time.

  • Display the id of new Record in the browse page of BC4J Struts App

    I am working on an application using BC4J Struts with backbone on Oracle 8i.I am using DBSequence Type for my Employee ID.Since I am using this Id as search criteria for employee, I want to show Employee Id after insertion of new Employee.How can I display this ID to the user after insertion of new employee...

    Hi and welcome,
    please find a technical forum that matches to your question. Certification is the wrong forum.
    Mod: I'm locking this OT thread.

  • Polling in BC4J Struts

    Hi folks,
    How would I achieve a polling functionality? One of our applications is setup with the 10gR2 version which comes with BC4J and Struts(Struts was a personal choice). I understand we have an af:poll tag with jsf which helps us to achieve the polling functionality. My query is how would I go about doing the same thing through Struts and BC4j. We don't have JSF, so its kind of tricky.
    My actual requirement is as follows:-
    I basically need to call an oracle report from java. I do this by having a custom implementation of the rwservlet. The oracle report generates a PDF file locally. Which I then need to store on my Database as a BLOB.
    I know how to call the report.
    I know where the pdf is located.
    I know how to store and retrieve the pdf from the DB through Struts.
    My only issues is in instructing my application from the report side to pick up the pdf file when the report is complete. I was thinking in these lines:-
    Rather than passing the instruction from the report side,in my struts action class i would set up some polling mechanism(which i don't know how to) that would tell me to look for the report in 2 minutes(which is how long the report takes to be generated), then pick it up and store it onto the DB.
    Since i "lose control" of the handle after redirecting to a different servlet for the report call, I don't see another alternative other than polling.
    Is there an alternative approach i can adopt to achieve the above functionality?
    If not, is it possible to poll through BC4J/Struts (as against ADF/JSF)?
    If not, please help :) .
    Cheers,
    K

    There is another danger related to this security hole:
    Struts suggests to locate JSPs below the WEB-INF directory to protect them from direct access. A JSP located here cannot be accessed directly but only using the appropriate action.
    One common approach implement security in a struts framework is to perform the required checks in actions. A user not logged in might for example been forwarded to the login screen instead of the requested page.
    If an Application relies on this fact and assumes that it is not possible to call a JSP located in WEB-INF without using the appropriate actions, this bug here opens another hole:
    The "currentPath" Parameter allows a user to call any JSP on your Web-Server! Simply modify the URL to look like this:
    navigate.do?amId=...&jboViewObject=...&currentPath=WEB-INF\path\to\any\page.jsp
    and you are in!
    Frank Brandstetter

  • Link for BC4J Struts-JSP and Tiles

    Hi,
    I have a JSP-Struts application. By the default generation, JDeveloper build a main.html Page. This page have many Frames and one Frame is "navFrame". On this frame I have a link for a JSP Page : Browse. The call is OK. No Problems.
    No I have another Page with Tiles :
    <template:insert page="IMDLayout.jsp" flush="true">
    <template:put name="title" value="Invoices Interface" />
    <template:put name="header" value="/tiles/common/header.jsp" />
    <template:put name="footer" value="/tiles/common/footer.jsp" />
    <template:put name="menu" value="/tiles/common/menu.jsp" />
    <template:put name="body" value="VInvoiceUsersView1_Browse.do" />
    </template:insert>
    The "body" Tiles call the same JSP Page as the link on the "navFrame", but now I have the following error :
    [ServletException in:VInvoiceUsersView1_Browse.do] Response has already been committed'
    Why ?
    Please help me, I need a solution. Does somebody use BC4J/Struts/Tiles ? Any Experience ? Problem ?
    Thanks
    Yves

    Repost

  • WebToGo BC4J + Struts + UIX application

    Is there any possibility to write a complete BC4J + Struts + UIX web application to run in the Oracle Lite platform??
    The documentation says about implementing a Servlet, but is it possible to install the .jar files of the struts & uix frameworks and register the *.do & *.uix extensions? What is the specification of the HttpServlet to be implemented?
    What about performance? Could this combination run in a WinXP PIV offline Laptop with reasonable performance?
    Where can I find this kind of information??
    Thanks
    Eduardo

    UIX is not supported in 5.0.2.x release. The next release (10g) will have complete UIX support. Beta release of 10g is already out in case you are interested in trying UIX with it.
    For BC4J refer to 'Chapter 6 BC4J Tutorial' of 'Oracle9i Lite Developer’s Guide'
    Limited support for Struts is there in 5.0.2.10.0 release. If you have the handler for .do extension files then you can use following:
    You can add mime handler to Mobile Server for .do extension by using a ini file. Copy following lines in a file called addmime.ini
    [DATABASE]
    TYPE=ORACLE
    [MIMETYPES]
    NAME = do
    VALUE=text/html
    PLUGIN=<handler class name>
    and run this ini file as following
    wsh -c addmime.ini mobileadmin/[email protected]

  • BC4J/Struts NavigationAction Functionality Request

    Jdev team,
    Has there been any thought on on extending the functionality in the NavigationAction class (and related BC4J/struts classes) to support navigating through 2 viewobjects set up in a master/detail relationship.
    The current implementation only supports mapping one view object in the struts action mapping which then limits the NavigationAction class to support navigating on only one viewobject.
    We have worked out a way to extend the BC4JActionMapping/BC4JContext to give us this functionality but we needed to overwrite some of the BC4JRequestProcessor/NavigationAction code to support this functionality.
    I think this type of functionality could be useful for other BC4J/Struts developers. BTW ... I understand that there are jbo tags that support this type of functionality but we have decided to use only JSTL/Struts tags.
    Thank you!
    -Mark

    Could you send us the errors that you are getting?
    Thanks,
    Jeanne

  • Bc4j, struts and query form (where)

    I have a query form on 1 table created by the wizards (bc4j - struts).
    For ex. in the name field I can insert 'Dimi' and the query form will find my record.
    But when somebody inserts 'dimi' (not initcap), he doesn't find my record.
    How can I adapt the default where clause in the query like eg. WHERE UPPER(FIRSTNAME)=document.form.field.toUpperCase(); ??
    In the next release this should be more simple!

    You can call setUpperColumns(true) on any instance of your view criteria row that you want to apply this UPPER() function to.
    Do you have a functional index at the database level on the UPPER(FIRSTNAME) function?
    If not, the query will do a full table scan with the UPPER(FIRSTNAME) in there.

  • Suggested Migration Path (BC4J/Struts - ?)

    We built a BC4J/Struts apps a couple years back closely modeled after the BC4J ToyStore. It has been quite successful for us. However, I'm feeling like its technology stack is a bit dated, and would like some suggestions on bringing it more current.
    BC4J (ADF) has been pretty solid for us, so I'm thinking of sticking with that instead of considering something else (Toplink, Hibernate, JPA, ...).
    It would be cool to hear from others who were/are in a similar situation, and what they decided to do (tips, tricks, lessons learning from the trenches, ...). Thank you.
    - Matt

    I've worked in situations like this.
    Personally, I think that if ADF BC/BC4J is working for you, there's no need whatsoever to migrate away from it. I imagine some might disagree with me on this, though.
    The logical successor to Struts is JSF--since you're working in ADF, you'd probably want to use the ADF Faces components. Here, so far as I can tell, is the deal:
    1) The UIX -> Faces migration utility is pretty smooth, unless you made heavy use of .uit templates. There's no equivalent in Faces, so you'll have to drop what was previously template code into place on your individual faces pages.
    2) Moving from Struts to Faces...well, it depends on how heavily you used Struts, beyond the declarative bit. The declarative part is pretty easy to duplicate, but migrating controller code you've written in Struts over to Faces is manual, and in my experience not always 100% smooth. There isn't, for example, a clear action/page separation, so you'll need to find something to do with code you had written in Struts Actions and DataActions.
    Desppite these hurdles, I'd still recommend making the switch--the ADF Faces components are in many ways a big improvement over UIX components.

  • Extend the BC4J JUnit Integration Extension

    I am working on extending the BC4J JUnit Integration
    I want to Add base classes for View and AppModule tests by default and have some more basic test cases.
    Also to add jtestcase libraries in order to use jests xml.
    Is it posible to have the source code of BC4J JUnit Integration so i dont start from ground zero?
    Thanks

    My point is:
    The JDeveloper Extensions from partners are open source.
    JDeveloper provide IDE to create extensions.
    It also provide sample extensions.
    It would be helpfull if it was open source so ppl can contribute to it.
    The BC4J JUnit Integration Extension is not so sophisticated. it can be reproduced easy.
    But as it is you need first to create your base test classes and then to run the extension and then to add some more code.
    i.e. it does provide jtestcase xml but not the libraries for jtestcase
    My intention is to contribute.
    I guess i have to create my own extension.

  • Bc4j/struts/validator integration

    Hi,
    I try to integrate the Validator framework (which is included in the standard struts-blank war file) with a standard "struts-based JSP for Business Component", adding the plugin in the struts-config.xml, and the validation.xml/validator-rules.xml in the web application.
    I catch the follow:
    [INFO] ValidatorPlugIn - -Loading validation rules file from '/WEB-INF/validation.xml'
    java.net.ConnectException: Connection refused: connect
         void java.net.PlainSocketImpl.socketConnect(java.net.InetAddress, int)
    boolean oracle.xml.parser.v2.NonValidatingParser.pushExternalDTD(java.lang.String, java.lang.String)NonValidatingParser.java:521
    void oracle.xml.parser.v2.NonValidatingParser.parseDoctypeDecl()NonValidatingParser.java:448
    Thanks in advance,
    Marco

    exuse me, test

  • Need help with BC4J/Struts application using a Stored Procedure

    Hi,
    I am doing a proof of concept for a new project using JDeveloper, Struts and BC4J. We want to reuse our Business logic that is currently residing in Oracle Stored Procedures. I previously created a BC4J Entity Object based on a stored procedure Using Oracle Stored Procedures but this stored procedure is a bit different in that it returns a ref cursor as one of the paramters. http://radio.weblogs.com/0118231/stories/2003/03/03/gettingAViewObjectsResultRowsFromARefCursor.html
    I tried the above method, but I am having some trouble with it. I keep getting the error ORA-01008: not all variables are bound when I test it using the AppModule tester.
    Here is the store procedure definition:
    CREATE OR REPLACE PACKAGE pprs_test_wrappers IS
    TYPE sn_srch_results IS REF CURSOR;
    PROCEDURE sn_srch_main_test
    (serial_num_in IN OUT VARCHAR2
    ,serial_coll_cd_in IN OUT NUMBER
    ,max_rows_allowed IN OUT NUMBER
    ,total_rows_selected IN OUT NUMBER
    ,message_cd_out IN OUT VARCHAR2
    ,query_results          OUT sn_srch_results
    END pprs_test_wrappers;
    And here is my code:
    package pprs;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    // --- File generated by Oracle Business Components for Java.
    public class LienCheckImpl extends ViewObjectImpl
    * This is the PLSQL block that we will execute to retrieve the REF CURSOR
    private static final String SQL =
    "begin ? := pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
    public LienCheckImpl() {}
    * Overridden framework method.
    * Executed when the framework needs to issue the database query for
    * the query collection based on this view object. One view object
    * can produce many related result sets, each potentially the result
    * of different bind variable values. If the rowset in query is involved
    * in a framework-coordinated master/detail viewlink, then the params array
    * will contain one or more framework-supplied bind parameters. If there
    * are any user-supplied bind parameter values, they will PRECEED the
    * framework-supplied bind variable values in the params array, and the
    * number of user parameters will be indicated by the value of the
    * numUserParams argument.
    protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
    * If there are where-clause params (for example due to a view link)
    * they will be in the 'params' array.
    * We assume that if some parameter is present, that it is a Deptno
    * value to pass as an argument to the stored procedure.
    * NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
    * ---- but this parameter value should be oracle.jbo.domain.Number type.
    String serialNumIn = null;
    BigDecimal serialCollCdIn = null;
    BigDecimal maxRowsAllowed = null;
    BigDecimal totalRowsSelected = null;
    String messageCdOut = null;
    if (params != null) {
    serialNumIn = (String)params[0];
    serialCollCdIn = (BigDecimal)params[1];
    maxRowsAllowed = (BigDecimal)params[2];
    totalRowsSelected = (BigDecimal)params[3];
    messageCdOut = (String)params[4];
    storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
    serialCollCdIn,
    maxRowsAllowed,
    totalRowsSelected,
    messageCdOut));
    super.executeQueryForCollection(qc, params, numUserParams);
    * Overridden framework method.
    * Wipe out all traces of a built-in query for this VO
    protected void create() {
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    * Overridden framework method.
    * The role of this method is to "fetch", populate, and return a single row
    * from the datasource by calling createNewRowForCollection() and populating
    * its attributes using populateAttributeForRow().
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
    * We ignore the JDBC ResultSet passed by the framework (null anyway) and
    * use the resultset that we've stored in the query-collection-private
    * user data storage
    rs = getResultSet(qc);
    * Create a new row to populate
    ViewRowImpl r = createNewRowForCollection(qc);
    try {
    * Populate new row by attribute slot number for current row in Result Set
    populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
    populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
    populateAttributeForRow(r,2, rs.getString(3));
    populateAttributeForRow(r,3, rs.getString(4));
    populateAttributeForRow(r,4, rs.getString(5));
    catch (SQLException s) {
    throw new JboException(s);
    return r;
    * Overridden framework method.
    * Return true if the datasource has at least one more record to fetch.
    protected boolean hasNextForCollection(Object qc) {
    ResultSet rs = getResultSet(qc);
    boolean nextOne = false;
    try {
    nextOne = rs.next();
    * When were at the end of the result set, mark the query collection
    * as "FetchComplete".
    if (!nextOne) {
    setFetchCompleteForCollection(qc, true);
    * Close the result set, we're done with it
    rs.close();
    catch (SQLException s) {
    throw new JboException(s);
    return nextOne;
    * Overridden framework method.
    * The framework gives us a chance to clean up any resources related
    * to the datasource when a query collection is done being used.
    protected void releaseUserDataForCollection(Object qc, Object rs) {
    * Ignore the ResultSet passed in since we've created our own.
    * Fetch the ResultSet from the User-Data context instead
    ResultSet userDataRS = getResultSet(qc);
    if (userDataRS != null) {
    try {
    userDataRS.close();
    catch (SQLException s) {
    /* Ignore */
    super.releaseUserDataForCollection(qc, rs);
    * Return a JDBC ResultSet representing the REF CURSOR return
    * value from our stored package function.
    private ResultSet retrieveRefCursor(Object qc,
    String serialNum,
    BigDecimal serialColCd,
    BigDecimal maxRows,
    BigDecimal totalRows,
    String messageCd ) {
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Register the first bind parameter as our return value of type CURSOR
    st.registerOutParameter(1,OracleTypes.CURSOR);
    * Set the value of the 2nd bind variable to pass id as argument
    if (serialNum == null) st.setNull(2,Types.CHAR);
    else st.setString(2,serialNum);
    if (serialColCd == null) st.setNull(3,Types.NUMERIC);
    else st.setBigDecimal(3,serialColCd);
    if (maxRows == null) st.setNull(4,Types.NUMERIC);
    else st.setBigDecimal(4,maxRows);
    if (totalRows == null) st.setNull(5,Types.NUMERIC);
    else st.setBigDecimal(5,totalRows);
    if (messageCd == null) st.setNull(6,Types.CHAR);
    else st.setString(6,messageCd);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
    * Make this result set use the fetch size from our View Object settings
    rs.setFetchSize(getFetchSize());
    return rs ;
    catch (SQLException s) {
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Store a new result set in the query-collection-private user-data context
    private void storeNewResultSet(Object qc, ResultSet rs) {
    ResultSet existingRs = getResultSet(qc);
    // If this query collection is getting reused, close out any previous rowset
    if (existingRs != null) {
    try {existingRs.close();} catch (SQLException s) {}
    setUserDataForCollection(qc,rs);
    hasNextForCollection(qc); // Prime the pump with the first row.
    * Retrieve the result set wrapper from the query-collection user-data
    private ResultSet getResultSet(Object qc) {
    return (ResultSet)getUserDataForCollection(qc);
    * Return either null or a new oracle.jbo.domain.Number
    private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
    try {
    return b != null ? new oracle.jbo.domain.Number(b) : null;
    catch (SQLException s) { }
    return null;
    I created the view object in expert mode so there is no entity object. Can someone help? I don't have much time left to finish this.
    Also, could I have done this from the Entity object instead of the view object by registering the ref cursor OUT parameter in handleStoredProcInsert()?
    Thanks
    Natalie

    I was able to get the input parameter by putting the following in my struts actions class
    vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
    The full code is:
    package mypackage2;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import oracle.jbo.html.BC4JContext;
    import oracle.jbo.ViewObject;
    import oracle.jbo.html.struts11.BC4JUtils;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class LienCheckView1QueryAction extends Action
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
    BC4JContext context = BC4JContext.getContext(request);
    // Retrieve the view object instance to work with by name
    ViewObject vo = context.getApplicationModule().findViewObject("LienCheckView1");
    vo.setRangeSize(3);
    vo.setIterMode(ViewObject.ITER_MODE_LAST_PAGE_PARTIAL);
    // Do any additional VO setup here (e.g. setting bind parameter values)
    vo.setWhereClauseParam(0,request.getParameter("row0_SerialNum"));
    // default value for serialCollCd 1 is for Motor Vehicles
    vo.setWhereClauseParam(1,new oracle.jbo.domain.Number(1));
    // Default value for maxRows_allowed
    vo.setWhereClauseParam(2,new oracle.jbo.domain.Number(20));
    return BC4JUtils.getForwardFromContext(context, mapping);
    This doesn't always work properly though. The first time I press the query button, the SerialNum parameter is still null, however if I re-execute the query by pressing the query button again. It will work, and return the rows. I always have to query twice. Also the SerialNum attribute is set to a String in my view object, it is a varchar column in the database, but some serial number I enter give a "Error Message: oracle.jbo.domain.Number ". This happens even though the underlying BC4J is returning values for the query. I also get a "500 Internal Server Error java.lang.ClassCastException: java.lang.String on my View object's code at line 65 which is
    if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
    This is an input paramter to the oracle stored procedure that defaults to a Number value of 1.
    Any idea what the problem is? Here is the full code for my view object:
    package mypackage1;
    import java.math.BigDecimal;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Timestamp;
    import java.sql.Types;
    import oracle.jbo.JboException;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.DBTransaction;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.jbo.server.ViewRowImpl;
    import oracle.jbo.server.ViewRowSetImpl;
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    // --- File generated by Oracle Business Components for Java.
    public class LienCheckViewImpl extends ViewObjectImpl
    * This is the PLSQL block that we will execute to retrieve the REF CURSOR
    private static final String SQL =
    "begin pprs_test_wrappers.sn_srch_main_test(?, ?, ?, ?, ?, ?);end;";
    private BigDecimal totalRows = null;
    private String messageCd = null;
    private BigDecimal serialColCd = null;
    private BigDecimal maxRows = null;
    public LienCheckViewImpl() {}
    * Overridden framework method.
    * Executed when the framework needs to issue the database query for
    * the query collection based on this view object. One view object
    * can produce many related result sets, each potentially the result
    * of different bind variable values. If the rowset in query is involved
    * in a framework-coordinated master/detail viewlink, then the params array
    * will contain one or more framework-supplied bind parameters. If there
    * are any user-supplied bind parameter values, they will *PRECEED* the
    * framework-supplied bind variable values in the params array, and the
    * number of user parameters will be indicated by the value of the
    * numUserParams argument.
    protected void executeQueryForCollection(Object qc,Object[] params,int numUserParams) {
    * If there are where-clause params (for example due to a view link)
    * they will be in the 'params' array.
    * We assume that if some parameter is present, that it is a Deptno
    * value to pass as an argument to the stored procedure.
    * NOTE: Due to Bug#2828248 I have to cast to BigDecimal for now,
    * ---- but this parameter value should be oracle.jbo.domain.Number type.
    String serialNumIn = null;
    BigDecimal serialCollCdIn = null;
    BigDecimal maxRowsAllowed = null;
    BigDecimal totalRowsSelected = null;
    String messageCdOut = null;
    if (params != null) {
    if (params.length>0) serialNumIn = (String)params[0];
    if (params.length>1) serialCollCdIn = (BigDecimal)params[1];
    if (params.length>2) maxRowsAllowed = (BigDecimal)params[2];
    storeNewResultSet(qc,retrieveRefCursor(qc,serialNumIn,
    serialCollCdIn,
    maxRowsAllowed));
    super.executeQueryForCollection(qc, params, numUserParams);
    * Overridden framework method.
    * Wipe out all traces of a built-in query for this VO
    protected void create() {
    getViewDef().setQuery(null);
    getViewDef().setSelectClause(null);
    setQuery(null);
    * Overridden framework method.
    * The role of this method is to "fetch", populate, and return a single row
    * from the datasource by calling createNewRowForCollection() and populating
    * its attributes using populateAttributeForRow().
    protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs) {
    * We ignore the JDBC ResultSet passed by the framework (null anyway) and
    * use the resultset that we've stored in the query-collection-private
    * user data storage
    rs = getResultSet(qc);
    * Create a new row to populate
    ViewRowImpl r = createNewRowForCollection(qc);
    try {
    * Populate new row by attribute slot number for current row in Result Set
    //AddedByRegisNum
    populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
    System.out.println("AddedByRegisNum :" + rs.getBigDecimal(1));
    // OrigRegisNum
    populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
    System.out.println("OrigRegisNum :" + rs.getBigDecimal(2));
    // SerialNum
    populateAttributeForRow(r,2, rs.getString(3));
    System.out.println("SerialNum :" + rs.getString(3));
    // SerialNumDesc
    populateAttributeForRow(r,3, rs.getString(4));
    System.out.println("SerialNumDesc :" + rs.getString(4));
    // FlagExactMatch
    populateAttributeForRow(r,4, rs.getString(5));
    System.out.println("FlagExactMatch :" + rs.getString(5));
    // MessageCd
    populateAttributeForRow(r,5, messageCd);
    // TotalRows
    populateAttributeForRow(r,6, totalRows);
    catch (SQLException s) {
    throw new JboException(s);
    return r;
    * Overridden framework method.
    * Return true if the datasource has at least one more record to fetch.
    protected boolean hasNextForCollection(Object qc) {
    ResultSet rs = getResultSet(qc);
    boolean nextOne = false;
    try {
    nextOne = rs.next();
    * When were at the end of the result set, mark the query collection
    * as "FetchComplete".
    if (!nextOne) {
    setFetchCompleteForCollection(qc, true);
    * Close the result set, we're done with it
    rs.close();
    catch (SQLException s) {
    throw new JboException(s);
    return nextOne;
    * Overridden framework method.
    * The framework gives us a chance to clean up any resources related
    * to the datasource when a query collection is done being used.
    protected void releaseUserDataForCollection(Object qc, Object rs) {
    * Ignore the ResultSet passed in since we've created our own.
    * Fetch the ResultSet from the User-Data context instead
    ResultSet userDataRS = getResultSet(qc);
    if (userDataRS != null) {
    try {
    userDataRS.close();
    catch (SQLException s) {
    /* Ignore */
    super.releaseUserDataForCollection(qc, rs);
    * Overridden framework method
    * Return the number of rows that would be returned by executing
    * the query implied by the datasource. This gives the developer a
    * chance to perform a fast count of the rows that would be retrieved
    * if all rows were fetched from the database. In the default implementation
    * the framework will perform a SELECT COUNT(*) FROM (...) wrapper query
    * to let the database return the count. This count might only be an estimate
    * depending on how resource-intensive it would be to actually count the rows.
    public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
    Object[] params = viewRowSet.getParameters(true);
    String serialNumIn = (String)params[0];
    BigDecimal serialCollCdIn = (BigDecimal)params[1];
    BigDecimal maxRowsAllowed = (BigDecimal)params[2];
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Register the fourth bind parameter as our return value of type NUMERIC
    st.registerOutParameter(4,Types.NUMERIC);
    * Set the value of the 3 bind variables to pass as arguments
    if (serialNumIn == null) st.setNull(1, Types.CHAR);
    else st.setString(1,serialNumIn);
    if (serialCollCdIn == null) st.setNull(2,Types.NUMERIC);
    else st.setBigDecimal(2,serialCollCdIn);
    if (maxRowsAllowed == null) st.setNull(3, Types.NUMERIC);
    else st.setBigDecimal(3, maxRowsAllowed);
    st.execute();
    System.out.println("returning value of :" + st.getLong(4));
    return st.getLong(4);
    catch (SQLException s) {
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Return a JDBC ResultSet representing the REF CURSOR return
    * value from our stored package function.
    private ResultSet retrieveRefCursor(Object qc,
    String serialNum,
    BigDecimal serialColCd,
    BigDecimal maxRows) {
    CallableStatement st = null;
    try {
    st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
    * Set the value of the bind variables
    System.out.println("SerialNumIn :" + serialNum);
    if (serialNum == null) st.setNull(1,Types.CHAR);
    else st.setString(1,serialNum);
    if (serialColCd == null) st.setNull(2,Types.NUMERIC);
    else st.setBigDecimal(2,serialColCd);
    if (maxRows == null) st.setNull(3,Types.NUMERIC);
    else st.setBigDecimal(3,maxRows);
    st.registerOutParameter(1, Types.CHAR); // serialNum
    st.registerOutParameter(2, Types.NUMERIC); // serialColCd
    st.registerOutParameter(3, Types.NUMERIC); // maxRows
    st.registerOutParameter(4, Types.NUMERIC); // totalRows
    st.registerOutParameter(5, Types.CHAR); // messageCd
    * Register the 6th bind parameter as our return value of type CURSOR
    st.registerOutParameter(6,OracleTypes.CURSOR);
    st.execute();
    ResultSet rs = ((OracleCallableStatement)st).getCursor(6);
    serialColCd = st.getBigDecimal(2);
    System.out.println("SerialColCd= " + serialColCd);
    maxRows = st.getBigDecimal(3);
    System.out.println("maxRows= " + maxRows);
    totalRows = st.getBigDecimal(4);
    System.out.println("totalRows= " + totalRows);
    messageCd = st.getString(5);
    System.out.println("messageCd= " + messageCd);
    * Make this result set use the fetch size from our View Object settings
    rs.setFetchSize(getFetchSize());
    return rs ;
    catch (SQLException s) {
    throw new JboException(s);
    finally {try {st.close();} catch (SQLException s) {}}
    * Store a new result set in the query-collection-private user-data context
    private void storeNewResultSet(Object qc, ResultSet rs) {
    ResultSet existingRs = getResultSet(qc);
    // If this query collection is getting reused, close out any previous rowset
    if (existingRs != null) {
    try {existingRs.close();} catch (SQLException s) {}
    setUserDataForCollection(qc,rs);
    hasNextForCollection(qc); // Prime the pump with the first row.
    * Retrieve the result set wrapper from the query-collection user-data
    private ResultSet getResultSet(Object qc) {
    return (ResultSet)getUserDataForCollection(qc);
    * Return either null or a new oracle.jbo.domain.Number
    private static oracle.jbo.domain.Number nullOrNewNumber(BigDecimal b) {
    try {
    return b != null ? new oracle.jbo.domain.Number(b) : null;
    catch (SQLException s) { }
    return null;
    Natalie

  • JSF And Struts Integration

    Can any body give some info on integration of JSF to existing struts application

    I describe the main differences between JSF and Struts in this sample Chapter from my JSF book:
    http://www.oreilly.com/catalog/jsvrfaces/chapter/ch01.pdf
    Hope that helps.

  • JSF Struts Integration Action lost on submit

    Hi All
    I've been tearing my hair out with this one for half a day. I am producing a web app using struts and jsf in conjunction. I have succesfully used the integration library on several pages, so I know the framework is in place. However for the following page I can produce valuechange events and process them on a javascript submit, and perform a quick return render, but when I press the submit button, the action is not forwarded through to struts action.
    The jsp page :
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
    <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
    <%@ taglib prefix="s" uri="http://struts.apache.org/tags-faces" %>
    <f:view>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <s:html>
    <head>
    <s:base/>
    <title>selectplot.jsp</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    </head>
    <body>
    <s:form action="/redirectSelectSite">
    <table border="0">
    <tr>
    <td>Site Code</td>
    <td><h:selectOneMenu id="siteSelect" value="#{SelectPlotForm.sitecode}" valueChangeListener="#{SelectPlotForm.processSiteChange}" onchange="this.form.submit();">
    <f:selectItems id="siteSelectItem" value="#{SelectPlotForm.sites}" />
    </h:selectOneMenu>
    </td>
    </tr>
    <tr>
    <td>Plot Number</td>
    <td><h:selectOneMenu id="plotSelect" value="#{SelectPlotForm.plotno}" >
    <f:selectItems id="plotSelectItem" value="#{SelectPlotForm.plots}" />
    </h:selectOneMenu>
    </td>
    </tr>
    <tr>
    <td colspan="2" align="center"><h:commandButton id="submit" type="SUBMIT" value="Continue"/></td>
    </tr>
    </table>
    <s:errors/>
    </s:form>
    </body>
    </s:html>
    </f:view>Backing Bean:
    public class SelectPlotForm extends ActionForm {
    // Omitted unwanted detail.
    * @param event
    * @throws AbortProcessingException
    public void processSiteChange(ValueChangeEvent event)
    throws AbortProcessingException {
    if (null != event.getNewValue()) {
    sitecode = ((String)event.getNewValue());
    // Get the list of plots for the new sitecode.
    this.setPlots(ChoicesInterface.getPlotsList(sitecode));
    // Do a quick render response
    FacesContext.getCurrentInstance().renderResponse();
    }struts-config.xml extract
    <action attribute="SelectPlotForm" name="SelectPlotForm" path="/redirectSelectSite" scope="session"
    type="com.millwood.struts.action.RedirectSelectPlot"
    validate="false" input="/selectPlot.faces" >
    <forward name="success" path="/printchoices.faces" />
    </action>and finally the struts action file :
    package com.millwood.struts.action;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.config.ForwardConfig;
    import com.millwood.Choices.Web.SelectPlotForm;
    * Redirects the user of the selectPlot page to the appropriate action.
    * @author James Salt
    * @since 0.1
    public class RedirectSelectPlot extends Action {
    public ActionForward execute(
    ActionMapping mapping,
    ActionForm form,
    HttpServletRequest request,
    HttpServletResponse response) {
    SelectPlotForm scf = (SelectPlotForm) form;
    // Construct the foward entity on the fly.
    ForwardConfig fc = new ForwardConfig();
    fc.setName("result");
    fc.setPath(scf.getActionurl()+ ".do?plotno=" + scf.getPlotno() + "&sitecode="+ scf.getSitecode());
    mapping.addForwardConfig(fc);
    return (mapping.findForward("result"));
    }Sorry about the massive posting but I thought it better to provide all the information relevant as currently I am at a bit of a loss.
    I have placed debug points at all the accessible parts of code, but non are triggered, so it must be being bounced in the ActionListener either in Struts or Faces before it tries to get the action.
    Any help would be really, really appreciated.
    Yours thankfully,
    james salt

    Change you action from:
    <s:form action="/redirectSelectSite">
    To:
    <s:form action="/redirectSelectSite.do">
    So that your request gets processed by the Srtuts Controller. Assuming you have *.do mapped to your struts controller in web.xml.

  • Q? on best practices/techniques using BC4J/Struts

    I have a jsp page that shows a bunch of detail records. Next to each detail record is an EDIT link.
    When the user clicks on the edit link I would like to populate a form on the same jsp page with existing values from that detail record so that the user can update the values.
    I am using struts/bc4j.
    What would be the best way to accomplish this?
    I was thinking if somehow I could get all the values of the clicked row in my controller and assign them to a form, then struts would take care of populating them again on the JSP.
    otherwise i guess the other way is to use bc4j data tags.
    Thanks in advance...

    Thanks for the pointer but it seems to be asking the same questions I am.  The only PDF that I could get was the one from quest.  Yours from LuLu I kept getting DB errors on the LuLu site. 
    Also, 3rd party options are currently out of the question.   I have done reorgs on R3 systems but since they don't have partitions and sub partitions and such there didn't seem to be as much to worry about. 
    I don't even want to mess with any BW R3 internal tables and that is why I would like to go from ODSD->Temp->ODSD.  I can get the downtime to do it too.
    Thanks for your help though the issue still sin't solved. And I'd like to see your book sometime.
    Vince

Maybe you are looking for

  • Itunes and windows ( 8 ) are not recognizing my iphone 4s ios 7

    i'm connecting my iphone to my computer windows 8 and it doesn't recognize it, it says it's a usb error, and also the battery charger dosn't work anymore please help me

  • Access jsp pages in WEB-INF directory

    Hi, I've a problem with my jsp web project; practically I've created a web project that uses jsp pages and servlet. I never use links to jsp pages, directly in my web pages, but I call always first servlet; the servlet call jsp pages. My project is c

  • Windows PC (XP) and Mac OS X Server 10.6 print service

    Can someone tell me if it is possible for a Windows PC running XP to make use of the Mac OS X Server 10.6 print service? Following the manual does not help. After enabling SMB I don't manage to connect to one of the shared printers. How could I make

  • Cleanup of language files broke office - will system re-install restore?

    I used a third party app (CleanMyMac) to remove language files and universal binaries. Now microsoft office won't run. Even the installer won't run. Copying the application from a backup didn't help. (Though that did resolve the same problem for adob

  • Can't suspend using hal as normal user

    Hello, I'm currently experiencing problems suspending using hal as a normal user. I followed the normal instructions for hal and pm-utils, but when I try to use dbus-send --system --print-reply --dest=org.freedesktop.Hal \ /org/freedesktop/Hal/device