Spent some time on this, here is the solution.
<% java.util.Properties props = new java.util.Properties(); props.put( "org.omg.CORBA.ORBClass", "com.sybase.CORBA.ORB" ); org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(( String ) null, props ); FranksPlayGround.n_tt n_tt = FranksPlayGround.n_ttHelper.narrow( orb.string_to_object("FranksPlayGround/n_tt")); short a = 1; short b = 4; short c = 3; short sum = n_tt.add(a, b, c); out.println(sum); %>
This is so called API coding style. Creating PB component is easy, the important part is to ‘generate stub’ at server side. (Those Helper, Holder and Operations classes in folder “EAServer\java\classes” which n_tt inherited from )
The reason I back to this is we have a project needs to get a string type of return value from EAServer. Here is what we did:
- Create a dst contains a dummy datawindow. (dst is from EAF)
- In createcontent event we call a method from component.
- Save this return value into dst’s message, then pass it back to JSP.
- JSP has to do some fancy parsing to get this value out.
Seems a lot of work, but we don’t need to do ‘generate stub’ because EAF install wizard already did this for dst. We kind of like using an empty dst passing value down to JSP.
I can refactor this a little bit by creating a seperate service object (not component) to wrap the component call.