This will work, but I would recommend putting this logic in a bean and then
use the bean to access the data.  This would help encapsulate/separate the
CORBA access from the jsp.  The bean would then be reusable and you wouldn't
have to code so much logic in the jsp itself.

Patrick

----- Original Message -----
From: "Daryani Santosh" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 01, 2000 5:07 PM
Subject: Re: JSP - CORBA


> <%@page import="org.omg.CORBA.ORB"%>
> <%@page import="org.omg.CosNaming.NamingContext"%>
> <%@page import="org.omg.CosNaming.NamingContextHelper"%>
> <%@page import="org.omg.CosNaming.NameComponent"%>
> <%@page import="packagename.*"%>
> <%
> //create stubs of corba components and compile them into classes
> //packagename is package that contains your component
> %>
> <html>
> <body>
>  <%
>
>   java.util.Properties props = new java.util.Properties();
>
>   props.put("org.omg.CORBA.ORBClass","com.sybase.CORBA.ORB");
>   props.put("com.sybase.CORBA.NameServiceURL","iiop://santosh:9000");
>   ORB orb = ORB.init((String[]) null, props);
>
>   //com.sybase.CORBA.ORB can be replaced with any other package that
contains
> CORBA classes
>
>   int rows =0;
>   componentname corbaComponent=null;
>   //declare the component
>   String status="";
>
>   try {
>      NamingContext context = NamingContextHelper.narrow(
> orb.resolve_initial_references("NameService"));
>
>      NameComponent[] name = { new
NameComponent("packagename/componentname","")
> };
>
>      SessionManager.Factory factory =
> SessionManager.FactoryHelper.narrow(context.resolve(name));
>
>      corbaComponent =
>
aon_fp_n_passport_connectHelper.narrow(factory.create("userid","password"));
>      //userid and password of app server where component is loacted
>
>      }//end of try block
>
>       catch (org.omg.CORBA.ORBPackage.InvalidName aException) {}
>       catch (org.omg.CosNaming.NamingContextPackage.NotFound aException)
{}
>       catch (org.omg.CosNaming.NamingContextPackage.CannotProceed
aException)
> {  }
>       catch (org.omg.CosNaming.NamingContextPackage.InvalidName
aException) {}
>           try
>      {
>
>
>           corbaComponent.of_methodname(arguments);
>           out.print(value returned from method);
>
>                     <%
>      }
>       catch (Exception aException)  {}
>
>      %>
> </body>
> </html>
>
> hope that helps
> Santosh
>
>
>
>
>
>
> Chen Shirley <[EMAIL PROTECTED]> on 11/01/2000 04:04:41 PM
>
> Please respond to A mailing list about Java Server Pages specification and
>       reference <[EMAIL PROTECTED]>
>
> To:   [EMAIL PROTECTED]
> cc:    (bcc: Santosh Daryani/IT/Aon Consulting)
>
> Subject:  JSP - CORBA
>
>
>
> Hi everyone,
>
> I am working on retriving a string array from other
> application(which gets the data from the database) to
> one of my jsp page through corba service.  How do I
> write code to access CORBA objects from my jsp page?
> Anyone has samples about jsp page using corba service?
>
> Thanks a lot
>
> __________________________________________________
> Do You Yahoo!?
> From homework help to love advice, Yahoo! Experts has your answer.
> http://experts.yahoo.com/
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to