Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Having prooblem with accessing EJB from JSP

Posted on 2007-04-10
5
181 Views
Last Modified: 2013-11-24
Hi Guys

I have a JSP in which i need to get data From an Access Bean. Now in the access bean I call the finder method findByStoreId(storeId). This method gives me the whole ejb and then I need to call the getCRId() method to get only the id's and store it in a hashtable

i started with something like this, would anyody please help me how I can complete the code and if there is a way to get the id using usebean in JSTL. I would really appreciate any kind of help

Thanks

---------------------------------------------------------------------
SRSCashRegisterAccessBean crBean = new SRSCashRegisterAccessBean();
                  
                  Enumeration en = crBean.findByStoreId(new Long(storeId.substring(3,storeId.length()-8)));
                  while (en.hasMoreElements()) {
                        crBean = (SRSCashRegisterAccessBean) en.nextElement();      
//Todo
call the getCrId() method and store data in a hashtable
//end Todo
}
0
Comment
Question by:huzefaq
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Manish
ID: 18887613
Do you want all above code in jstl?
or if in jsp you have SRSCashRegisterAccessBean bean ?

0
 
LVL 10

Expert Comment

by:mbvvsatish
ID: 18887937
using finder methods will be heavy for such senario's.
you can write a Home Business method to fetch all the Crid's as a collection object.

write a business method in home interface and in the bean class use ejbselect methods to query the database for all the crid's and return them as a collection object.


0
 

Author Comment

by:huzefaq
ID: 18891365
yes can I change the whole code of accessing a finder method to JSTL.

Also mbvvsatish would u know of any tutorial or exaple which I can use to implement this. I know about entitiy EJB's but haven't worked on it much

Thanks guys


0
 
LVL 10

Accepted Solution

by:
mbvvsatish earned 250 total points
ID: 18895869
0
 
LVL 11

Assisted Solution

by:Manish
Manish earned 250 total points
ID: 18895969
I dont think you can create class in jstl.
SRSCashRegisterAccessBean crBean = new SRSCashRegisterAccessBean();
                  Enumeration en = crBean.findByStoreId(new Long(storeId.substring(3,storeId.length()-8)));

Above portion is difficult to convert in jstl.
It is not possible to pass parameter in method in jstl.
When you get list that  is possible to iterate using forEach tag of jstl
check this
http://java.about.com/od/beginningjava/l/aa_jstl_intro.htm
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven java path setting 5 63
mapShare challenge 13 125
How to increase Spring boot/Tomcat max file upload size 2 146
Eclipse for Java EE development 2 28
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question