BC4J enbling the controller layer in Jdev 10g
416905Mar 15 2004 — edited Mar 15 2004Hello,
I've created a BC4J/struts application using JDeveloper 10g. I've decided to use Struts Action's instead of DataActions, (similar to developing in JDeveloper 9.0.3) but I can't seem to bind my Controller layer to my Model layer.
In 9.0.3 we created a .cpx file. Unfortunately 10g doesn't allow us to create one. Is there anyway to do this mannually or with a wizard? What I had to do is create it manually in notepad (actually I copied the one in the ToyStore).
Here is what I've done so far:
I've manually added these lines to my web.xml inside the <servlet-class> tag:
<init-param>
<param-name>BC4JDefinition</param-name>
<param-value>ViewController</param-value>
</init-param>
<init-param>
<param-name>mapping</param-name>
<param-value>oracle.jbo.html.struts11.BC4JActionMapping</param-value>
</init-param>
I've added this to my struts-config:
<controller processorClass="oracle.jbo.html.struts11.BC4JRequestProcessor" debug="3" locale="true" contentType="text/html;charset=windows-1252"/>
I've also created this ViewController.cpx file in notepad and copied it into my ViewController/src and ViewController/classes folders:
<?xml version="1.0" encoding='windows-1252'?>
<!DOCTYPE JboProject SYSTEM "jbo_03_01.dtd">
<!--BC4J Client Data Model-->
<JboProject
Name="ViewController"
Package="" >
<Session
Name="MyAppModule"
Package="model.services"
Configuration="MyAppModuleLocal" >
</Session>
</JboProject>
When I try to run my Action it can't seem to find my view even though I've added the proper code in my struts-config:
stuts-config:
<action path="/stepOneA" name="StepOneForm" input="/WEB-INF/jsp/auto/step_one.jsp" scope="request" type="view.strutsactions.StepOneAction" validate="true">
<set-property property="viewobject" value="PersPolicyView"/>
<set-property property="application" value="MyAppModule"/>
<set-property property="releasemode" value="Stateless"/>
<forward path="/WEB-INF/jsp/auto/step_two.jsp" name="success"/>
<forward path="/WEB-INF/jsp/auto/step_one.jsp" name="failure"/>
</action>
Here is my StepOneAction (execute method):
BC4JContext context = BC4JContext.getContext(request);
MyAppModuleImpl appModule = (KanetixUSAppModuleImpl)context.getApplicationModule();
Transaction transaction = appModule.getTransaction();
PersPolicyViewImpl persPolicy = (PersPolicyViewImpl)context.getViewObject();
Unfortunately my persPolicy view object is null.
Any ideas?
Please help.
Matt