• Post Reply Bookmark Topic Watch Topic
  • New Topic

Javascript tables creation

 
satheesh krishnaswamy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everbody,
I have a doubt.I need to create tables at runtime based on invocation of some methods in EJB.There are 4 methods in ejb and I have two text box in my jsp page.If i enter value in one text box and click find it should invoke one method of EJB and populate the value in TABLE in JSP page.Then Again if I enter value in another value and invoke my EJB method(custom Finder method),It should populate the value in the same table and in the same HTML/JSP pages.
How to achieve this.I am using Collection in ejb as :
public Collection findAll(String supplier,int ponumber,int positionnumber)
{}
in EJB.
How to retrieve value from that collection in JSP.

Also Can anyone suggest some sites as to learn how to invoke EJB methods from JSP.since my client side is JSP and my server side application (i.e middle tier) is EJB.
Thanks in advance.Please post ur reply as soon as possible since the matter is very urgent.
Please
[ May 24, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the EJB/J2EE Forum.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi satheesh

Well, I guess if you are in hurry it would not be a good suggestion but I prefer not to access EJBs from JSPs. Instead follow long path of communication via Servlets+DTOs(ValueObjects) matching MVC 2 model.

Here prepare DTO for each UI component you need to display. e.g. A Customer Profile (mostly you would have entity bean corresponding to that in backend) and then make request to Session bean from a servlet. Servlet will recieve the DTO and JSP will then just display it.

In your current design you would have to treat JSPs as physically separate client and then do JNDI lookup with complete conext paramters of URL and Provider and using Bean's JNDI name you can lookup the entity/session bean objects..

Regards
Maulin
 
satheesh krishnaswamy
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well I did like that only by giving :
---------------------------------------------------------
String supplier=request.getParameter("SUPPLIERID");
session.putValue("SUPPLIERID",supplier);
String tpono=request.getParameter("p");
session.putValue("p",tpono);
String tcustid=request.getParameter("c");
session.putValue("c",tcustid);
System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url","localhost:1099");
Properties myProp = System.getProperties();
Context initial=new InitialContext(myProp);
Object objref=ctx.lookup("java:comp/env/jdbc/POSB");
POSBHome home=(POSBHome)javax.rmi.PortableRemoteObject.narrow(objref,POSBHome.class);
POSB myposb= POSBHome.create();
Collection c=(Collection)myposb.findbySupplier(supplier);
Iterator it=c.iterator();
java.util.Iterator i=myposb.findbySupplier(supplier);
java.util.Iterator i1=myposb.findBypono(tpono,supplier);
java.util.Iterator i2=myposb.findByCustID(tcustid,supplier);
-----------------------------------------------------------------
Then only I am strucking up with as how to proceed because since three iterators will fetch values from EJB COLLECTIONS DEFINED FROM SESSION BEANS,
I dont know know how to populate it in the same table.
Sorry for such ugly design,but this is the one recommended by ours.
Waiting for ur reply
Thanks in advance
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!