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

Similar Messages

  • 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

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

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

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

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

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

  • 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

  • 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 &lt;set-property property="application" value="ToyStore"/&gt; 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.

  • BC4J + Struts: Design questions!

    OK, I'm wanting to use Struts with BC4J and have a design question for you BC4J users and gurus.
    Here's how I think things would work:
    1. User requests page
    2. Struts ActionServlet calls perform() on Struts ActionForm
    3. Struts ActionForm instantiates BC4J AppModule and calls business method
    4. BC4J AppModule instantiates necessary BC4J ViewObjects and performs business operations which return data
    5. Struts ActionForm receives value objects from BC4J AppModule
    6. Struts ActionForm populates Struts FormBean
    7. Struts ActionForm forwards to Struts JSP which displays Struts FormBean
    I prefixed the components with Struts/BC4J to keep things clear where things belong.
    Now, here are my questions:
    In step 3, what's the best method of doing this? Do I need to do JNDI lookups every time? What's the performance overhead of this? Anyone have any best-practice code that does this?
    Is this the accepted way of doing things? Is there a better way of designing this system?
    Thanks!

    In Step3 you should use the ApplicationModule pooling framework, especially if you are trying to work in stateful mode because the pooling automatically handle the AM activation/passivation.
    There are different way to go at it.
    If you are using the BC4J custom tag library and have an ApplicationModule tag in your jsp, the pooling is already initialize. By the time your action is trigger you just need to retrieve the am using the application id:
    in your jsp:
    <jbo:ApplicationModule id="myAM" ... />
    in your Action implementation:
    HttpContainer container = HttpContainer.getInstanceFromSession(request.getSession());
    SessionCookie cookie = container.getSessionCookie("myAM");
    ApplicationModule am = null;
    if (cookie != null)
    am cookie.useApplicationModule();
    This AM id can be passed as URL parameter...
    If you do have a JSP with an AM tag you need to create the pool with findSessionCookie call.
    For more info about AM pooling look at the end of this thread for Steve resources:
    http://forums.oracle.com/forums/message.jsp?id=912431&gid=513211
    This is what we are currently doing for to provide support for BC4J in Struts for our next release.
    Charles.

  • Struts tag for request.setAttribute() in a jsp page

    Hello All
    Does anyone know struts tag that can be used for request.setAttribute() in a jsp page?
    Thanx in advance.

    Well
    <bean:define id="foo" name="newsIdAttribute" scope="request" type="java.lang.String" />is equivalent to
    <%
    (java.lang.String) foo = (java.lang.String)request.getAttribute("newsIdAttribute");
    %for setting bean properties you might have to use
    <jsp:setProperty/> or <c:set/> tags in JSP / JSTL respectively.
    Hope this might answer your question :)
    REGARDS,
    RaHuL

  • 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

  • BC4J/Struts java.lang.ClassCastException in UpdateAction

    Dear reader,
    I am facing a problem that I can't address. I have an entity object named 'Employee' and on the password field, there is one validation rule (a method, which checks if the passwords length is between 6 and 12 characters). I have a view called 'EmployeeView' for this entity.
    I have a jsp page, where a form can be used to update an Employee's data (using an update-action servlet). This all works fine if there is no validation rule on one of the fields (as is on password), as soon as the user fills in let's say a too short password, in UpdateAction this line causes an ClassCastException.
    oracle.jbo.html.struts11.actions.UpdateAction.execute(UpdateAction.java:85)
    The source-line it goes wrong:
    ApplicationConfig appConfig = (ApplicationConfig) request.getAttribute(Action.APPLICATION_KEY);
    Apparently it is not set then... But it works fine if the password is filled in within the range of the rule.
    Does anyone have any idea why this is caused? Am I missing something vital? Or am I doing something wrong? Thanx a lot for your time.
    Regards,
    Martijn

    Take a look at the stack trace, it shows you exactly where the error is coming from:
    java.lang.ClassCastException: org.theclass.candidate.view.SearchForm
    org.theclass.candidate.view.CandidateListAction.execute(CandidateListAction.java:41)Line 41 in your CandidateListAction.
    Probably it is failing on a cast of your action form.
    Taking a closer look at your struts-config, you are "chaining" actions.
    Your AddCandidateAction uses the candidateForm, and forwards to CandidateListAction.do
    Your CandidateListAction uses the searchForm.
    That will be the cause of your class cast exception.
    <action path="/Add"
      name="candidateForm"
      type="org.theclass.candidate.view.AddCandidateAction"
      validate ="true"
      input="/jsp/addcandidate.jsp">
      <forward name="success" path="/CandidateList.do"/>
    </action>
    <action path="/CandidateList"
    type="org.theclass.candidate.view.CandidateListAction"
    name="searchForm"
    scope="request" >
    <forward name="failure" path="/jsp/list.jsp"/>
    <forward name="success" path="/jsp/candidatelist.jsp"/>
    </action>Check out: http://struts.apache.org/1.x/faqs/newbie.html#chaining
    Solutions?
    - don't chain actions ;-)
    - use the same action form for both actions (possible?)
    - make the actionForward a "redirect" one. That means a new request, and losing any request parameters/attributes but should prevent this class cast exception.
    Hope this helps,
    evnafets

  • Struts portlet and request.getQueryString()

    Hi all,
    I've run into what seems like a bug in using struts portlets.
    In my JSP page, I'm attempting to retrieve the query string (parameters) from the request URL, but apparently under the Portal framework, only the first parameter/value in the query string can be retrieved.
    Eg. URL:
    http://www.myportal.com/portal/page?_pageid=11,86282&_dad=portal&_schema=PORTAL&_piref33_92271_33_86282_86282.strutsAction=%2myAction.do?param1=abc&param2=cde&param3=fgh
    When invoking a request.getQueryString() either in my JSP or in the action servlet, only the first part is returned, which is param1=abc. The rest is dropped.
    I should mention that the actual use of these parameters are okay (such as request.getParameter("param2") will return "cde"). Just pulling them out with the getQueryString() method seems not too work.
    The only way to workaround it for me is to use the request.getParameterNames() and run through the enumeration and construct the query string manually. Of course this is ugly running under the Portal framework because I have to filter out all the Portal parameters that begin with the underscore character(eg. page, schema, etc).
    Has anyone else had this problem and worked around it?
    Thanks in advance

    Hi,
    This may help. Use the pdk-struts-html:link tag instead.
    Something like
    <jsp:useBean id="prevDetail" class="java.util.HashMap"/>
    <c:set target="${prevDetail}" property="event_PreviousSet" value="PreviousSet"/>
    <c:set target="${prevDetail}" property="sortref" value="${param.sortref}"/>
    <c:set target="${prevDetail}" property="sortacc" value="${param.sortacc}"/>
    <c:set target="${prevDetail}" property="filteron" value="${param.filteron}"/>
    <pdk-struts-html:link action="portal/something.do" name="prevDetail">
    Good luck, Hernando

Maybe you are looking for

  • How to update an Oracle table from SSIS

    Hi there I've been working in a SSIS project where I need to update a table in an Oracle database that is located in a remote server. Until now I have used the OLE DB COMMAND to do this in a sql server database. To access the data that belongs to the

  • Agent Assignment in PFTC vs SWDD

    Can someone explain the difference between maintaining the Agent assignment in PFTC (Additional Data -> Agent Assignment->Maintain->Crate Agent asignment) vs assignning Agents to the task in SWDD. My undertanding is that PFTC agent assignment is the

  • Dynamically deciding the target directory without ESR objects

    Hi Experts, I have come across File to File scenario(NFS) where I have to serve 2 purpose in one scenario using single receiver communication channel as the client have more than 40 plants. 1.     I need to copy the file from source directory to targ

  • Creative Muvo TX SE

    Is there any way to increase the volume more, past models i had went to 40 in volume, this only goes to 25. Also is it possible to browse through folders and tracks while listening to music?. thanks

  • Trying to burn data on to a CD-RW

    Dear All, I've found that my disk burn is unstable. When I back up to disk at the end of the day, often the drive will eject the disk a little way into the verification stage, saying that the "disk is unreliable". But if I restart the computer the sa