Strategy for integrating JSF/JSP with EJB?

Both JSF/JSP and EJB seem to be developing independently of each other. What is a good strategy for integrating them? I'm not sure how access my entity/session beans from my web pages.

Follow the MVC architecture. Don't access EJB's from JSF/JSP pages. Here are some basic rules to follow.
1) never put java code in JSP's. JSP's are for viewing data only. They should never contain business logic nor be tied to the business tier.
2) JSP's should always send HTTP requests to servlets. Use the servlets to control the flow of the application and make decisions on which JSP should be returned to the client. Make calls to the EJB's from the servlet to perform business logic.

Similar Messages

  • JSF combined with EJB, how??

    Hi @ll,
    I have been trying for some days to combine my JSF pages with EJB Session Beans, but I haven't really found a working way to do it.
    First, I had my session bean directly as the backing bean for the JSF page, but I read somewhere that this isn't "allowed", so I created a helper bean as managed bean. This is now the backing bean for the jsf page and has as attribute the session bean.
    My helper bean:
    public class ManagedHelperBean {
    @EJB private JDDACReaderBeanRemote reader;
    public JDDACReaderBeanRemote getReader() {
         return reader;
    public void setReader(JDDACReaderBeanRemote reader) {
         this.reader = reader;
    }Part of my faces-config.xml
    <managed-bean>
    <managed-bean-name>helper</managed-bean-name>
    <managed-bean-class>com.company.ManagedHelperBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>Part of my jsp page:
    <h:outputText value="#{helper}"/>
    <h:outputText value="#{helper.reader}"/>Now, the first output in the jsp page works, the second one doesn't. Why can't the property reader be accessed?? What is the correct way to combine JSF with EJB?
    Kind regards,
    Wiebke

    Hello,
    I faced the same problem, but on a Weblogic 10 server.
    The problem with Weblogic 10 is, even if it's "supposed" to be a EE5 compliant server, it is not.
    As described here http://e-docs.bea.com/wls/docs100/webapp/annotateservlet.html , there is no Dependency Injection in JSF managed beans:
    The web container will not process annotations on classes like Java Beans and other helper classes.
    But, WL 10 offers DI on Servlets, Filters and Listeners.
    Here is how I solved it (probably not the best way, but it works for me):
    - created a filter with a list of EJB injected (as it works). For every filtered request, set a list of known (enum) as request attributes mapped each to a EJB service:
    public class EJBInjectFilter implements Filter {
    @EJB
    private MyEJBService ejbRef;
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException,
                   ServletException {
    log.debug("Setting EJB ref into request as attribute ");
              req.setAttribute(ServiceEnum.MY_EJB_SERVICE.toString(), ejbRef);
              chain.doFilter(req, resp);     
    - for every managed bean who needs a service you can do something like:
    (MyEJBService) ((HttpServletRequest) FacesContext.getCurrentInstance().
                   getExternalContext().getRequest()).getAttribute(ServiceEnum.MY_EJB_SERVICE.toString())
    to get a reference to service.
    I agree it is a totally not elegant solution. But why does WL 10 say it's a full JEE5 compliant server, and though does not provide DI for managed beans?
    A drawbacks I could think of is performance slow-down (for every request, apply filter, set list of attributes + references into request) - probably it does take some time.
    Let me know your thoughts.
    Edited by: cosminj on Nov 20, 2007 8:16 AM

  • Best practice for integrating oracle atg with external web service

    Hi All
    What is the best practice for integrating oracle atg with external web service? Is it using integration repository or calling the web service directly from the java class using a WS client?
    With Thanks & Regards
    Abhishek

    Using Integration Repository might cause performance overhead based on the operation you are doing, I have never used Integration Repository for 3rd Party integration therefore I am not able to make any comment on this.
    Calling directly as a Java Client is an easy approach and you can use ATG component framework to support that by making the endpoint, security credentials etc as configurable properties.
    Cheers
    R
    Edited by: Rajeev_R on Apr 29, 2013 3:49 AM

  • Online materials for learning Javascript, JSP and EJB

    I am a core java programmer, not aware of J2EE stuffs. Please let me know the best online resources for learning Javascript, JSP and EJB
    Thanks,
    Gautam

    http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts3.html
    http://otn.oracle.com/sample_code/tech/java/codesnippet/j2ee/ejbbestpractices/ejb-best.html#pattern
    http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSPIntro.html
    http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html
    http://home.cogeco.ca/~ve3ll/jstutor5.htm
    http://www.pageresource.com/jscript/j_a_02.htm
    I think will do

  • EAR Structure for JSF project with EJBs

    Hi All,
    I have a JSF project which makes use of EJBs through EJB injection. The project basically consists of 3 components, which are independently archived (as JARs/WARs) and then added to an EAR. The components interact as follow:
    EJB JAR: contains the EJB code.
    Library JAR: contains the bean injection and common methods.
    JSF WAR: contains the JSF pages as well as a request (page) bean which inherits from a class in the library JAR (one containing a bean injection).
    The way I understand it, everything should work fine if I archive those components independently and then add them to an EAR (with the JSF WAR and EJB implementation JAR in the root, and the EJB interface JAR and the Library JAR in a /lib folder). If I do this, however, the bean injection fails and the bean proxy class is just null.
    I managed to get around this by adding the Library JAR to the JSF WAR's lib directory, in which case the bean injection works fine, but if I do it this way it means I'll have to add the Library JAR to all WAR components I have, which seems like needless duplication. Am I doing something wrong when creating the EAR or is this just the way it is? To make myself a bit more clear I include the EAR structures below:
    Not Working
    |_ EJB-impl.jar
    |_ JSF.war
    |_ lib
          |_ EJB-intf.jar
          |_ Library.jar
    Working
    |_ EJB-impl.jar
    |_ JSF.war
          |_ lib
                 |_ Library.jar
    |_ lib
          |_ EJB-intf.jarThank you,
    Ristretto

    Hi All,
    I have a JSF project which makes use of EJBs through EJB injection. The project basically consists of 3 components, which are independently archived (as JARs/WARs) and then added to an EAR. The components interact as follow:
    EJB JAR: contains the EJB code.
    Library JAR: contains the bean injection and common methods.
    JSF WAR: contains the JSF pages as well as a request (page) bean which inherits from a class in the library JAR (one containing a bean injection).
    The way I understand it, everything should work fine if I archive those components independently and then add them to an EAR (with the JSF WAR and EJB implementation JAR in the root, and the EJB interface JAR and the Library JAR in a /lib folder). If I do this, however, the bean injection fails and the bean proxy class is just null.
    I managed to get around this by adding the Library JAR to the JSF WAR's lib directory, in which case the bean injection works fine, but if I do it this way it means I'll have to add the Library JAR to all WAR components I have, which seems like needless duplication. Am I doing something wrong when creating the EAR or is this just the way it is? To make myself a bit more clear I include the EAR structures below:
    Not Working
    |_ EJB-impl.jar
    |_ JSF.war
    |_ lib
          |_ EJB-intf.jar
          |_ Library.jar
    Working
    |_ EJB-impl.jar
    |_ JSF.war
          |_ lib
                 |_ Library.jar
    |_ lib
          |_ EJB-intf.jarThank you,
    Ristretto

  • Is it possible to use JSP with EJB

    A pretty dumb question.
    JSP + Servlet + DB can be used together to write a j2EE application, such as some shopping system.
    But what's the usage for EJB? Does it still need JSP to do the output to client?

    To use a JSP with an EJB:
    Create a taglib for the EJB and access the EJB in the JSP with the taglib.
    WebLogic provides the EJB to JSP integration tool.
    http://e-docs.bea.com/wls/docs61/jsp/ejb2jsp.html

  • Step by Step procedure for Integration of B0 with BI 7.0, Portal

    Hi,
    My key concerns include integration with SAP Portal, which I did not find in instalaltion guide.
    Please advice on step by by Procedure for BO with BI 7.0 starting with the right version of BO to be installed.
    1. Which version compatible with BI 7.0 SP 12, LATER TO BE UPGRADED TO sp 16
    2. Source of data will be BI and reports will be using BO.
    3. What are components to be installed
    4. Prerequisites for Integration with BI AND SAP Portal.
    5.Steps for Integration with BI 7.0
    6. Steps for Integration with SAP Portal- Where to get the sample iviews. What to do for connction between Portal and BO - this i didnt find in installation guide
    Thanks,
    Harish

    HI,
    here the items:
    SAP Side:
    - all machines have to be in the same domain
    - BI has to trust the portal
    - BI has to accept SSO tickets
    - EP has to generate SSO tickets
    BusinessObjects:
    - SAP Authentication has to be configured
    - BI system should be configured has default system in the options of the SAP authentication
    - authentication.default parameter in the web.xml for InfoView has to be set to secSAPR3
    - BusinessObjects has to be in the same domain
    EP side:
    - in the system landscape configure the Crystal Enterprise Server Properties for your BI system
    - import the portal iview template that is part of the SAP Integration Kit
    - create a new iView
    Ingo

  • Steps for Integration of WebEx with Portal

    Hi
    I have requirement of integrating the WebEx with portal.
    I am completely new to this.
    Can any body tell me step by step implementation of this process . Does any document available to do this.
    What are the prequisites required to integrate.
    our portal version is 7.0
    Does webEx need to be installed?
    what is the procedure.
    Regards
    Vijay

    Hi Vijay,
    please take a look at [Activating Synchronous Collaboration Service Types|http://help.sap.com/saphelp_nw70/helpdata/en/de/bd2cf14c05d54cb766ce15a30d8063/frameset.htm], [Service Providers|http://help.sap.com/saphelp_nw70/helpdata/en/2f/4c209ef6504147aa8df54298a5cd8c/frameset.htm] and [Using WebEx Meeting|http://help.sap.com/saphelp_nw70/helpdata/en/62/58e310295d4b048a6b350de7a97749/frameset.htm].
    Regards,
    Holger.

  • Best Strategy for Integrating Crystal/Business Objects with OpenACS Environment

    Post Author: devashanti
    CA Forum: Deployment
    I'm working for a client that uses AOL server and OpenACS for their web services/applications. I need suggestions on the best strategy to integrate a reporting solution using Business Objects XI. Ideally I'd like to send an API call from our web application's GUI to the Crystal API with report parameter values to pass into specific reports called via the API - I can get it down to one integer value being passed - or if this is not possible a way to seamlessly, from the end user perspective, move into a reporting module. We are using an Oracle backend database. I'm experienced with creating stored procedures and packages for reporting purposes.
    Although I have many years of experience integrating the Crystal active X controls into n-tier client server applications, the past few years I have had little opportunity to work with Business Objects and the newer versions of Crystal or web based solutions with Crystal Reports. I signed up to try out crystalreports.com, but I doubt my client will find this solution acceptable for security reasons as the reports are for an online invoicing system we are developing. However we can set up a reports server in-house if necessary, so it gives me some testing ground.
    Can anyone provide suggestions for a doable strategy?

    Please post this query to the Business Objects Enterprise Administration forum:
    BI Platform
    That forum is monitored by qualified technicians and you will get a faster response there. Also, all BOE queries remain in one place and thus can be easily searched in one place.
    Thank you for your understanding,
    Ludek

  • Best technology for web service - jsp vs ejb

    Currently we have our project fully done in jsp and servlets.
    Now we have decided to bring out a new version of the product.
    We are in thought of ejb and struts replacing jsp.
    But we need to know the advantages and disadvantages between jsp,servlets and ejb,struts for our task..
    Can anyone help in this to make our thoughts to work..
    Thanks in advance ..
    Bye
    Pradhip

    don't waste time in asking others
    i think it is better to use jsp and servlets
    if you don't know struts it is very difficult to study and impliment know
    you start learn struts know i hope u can impliment next time
    start with small example
    reffer jakartha struts and struts in action books to guide

  • Best Approach for integrating SAP CRM with Outage Management System

    Hi All,
    We are moving towards deploying Outage Management System (Oracle Utilities NMS) to help localize the fault, achieve Outage Management and a transparent network with a near-real time stats. We already have SAP ECC 6.0, ISU, SAP PI 7.0 and SAP CRM 7.0. One of the challenges we are facing is to decide how should we go about the integration of SAP CRM with Oracle's Outage Management System.
    Here is a sample business scenario,
    CSR receives a call from a consumer and inquires about planned outages for a particular area.
    This information is contained in the Outage Management System (OMS). OMS is SOA based and is hosted on Oracle Service Bus.
    I want to know that is there any ES Bundles available for CRM-OMS integration? Should we go about Service Based Integration? What are the alternatives to Service based integration? Can it be done using BAPIs?
    We receive around 1000 consumer complains and against every complain a ticket is generated in CRM. Now If CRM is integrated with OMS using SAP PI, the volume of the data being exchanged via PI is very much high and exceeds our licensed volume for SAP PI. So I do need to know the best practices for either approach that you may recommend.
    Regards,
    Adil Khalil

    does anyone have an idea about this one, I've asked this question in a few places and no one really seems clear about it.
    Also, I've read here and there that SAP Business One is not a real SAP product. It was bought by SAP and is sold by them but has little do to with SAP's technology (R/3, SAP ERP, Netweaver, SAP CRM, ...), and that therefore they don't support it that much ? Is any of this right ?
    I'm just trying to get my vision of the SAP universe clear.
    Angela

  • Are there any recent tutorials or information for integrating Adobe Flex with Ruby on Rails 4?

    I've combed and searched extensively and most of the documentation is anywhere from 4 to 7 years old.  A lot of it focuses on outdated gems or libraries.  I've even seen Rails 2.0 as a focus for a lot of this information.
    I would just like to know if anyone has any valid resources for the latest Adobe Flex integrating with a Rails 4.x application.  And, if so, where is this hidden information listed or located?
    Thanks.

    I've combed and searched extensively and most of the documentation is anywhere from 4 to 7 years old.  A lot of it focuses on outdated gems or libraries.  I've even seen Rails 2.0 as a focus for a lot of this information.
    I would just like to know if anyone has any valid resources for the latest Adobe Flex integrating with a Rails 4.x application.  And, if so, where is this hidden information listed or located?
    Thanks.

  • JSP with EJB

    Hi
              How can one specify EJB jar files as command line options for compiling
              and executing JSP files.
              One approach is to specify in the compileCommand paramter. But this will
              be applicable to all the JSPs. Is there any way to restrict the option
              to certain JSPs and not all.
              RK
              

    Maybe I'm daft, maybe it is the time? :)
              I don't follow you. Please give an example of why this is necessary and
              what you would think you would need configure?
              Cheers
              Mark G>
              RK wrote:
              > Hi
              >
              > How can one specify EJB jar files as command line options for compiling
              > and executing JSP files.
              >
              > One approach is to specify in the compileCommand paramter. But this will
              > be applicable to all the JSPs. Is there any way to restrict the option
              > to certain JSPs and not all.
              >
              > RK
              =====================================================
              Reply to the newsgroup. Don't reply to this mail
              alias. This is used only for answering posts on
              WebLogic Newsgroups.
              =====================================================
              

  • Load Tests for (Desgin issue, Servlets with EJBs in real life?)

    I have a very light java program that makes an HTTP connection to a servlet
    on the WLS,
    it uses the GET method for that, and reads the response from the server, it
    logs the time that passes from just before opening the HTTP connection and
    right after finishing reading the response. Below is the code snippet for
    that:
    url = new URL(sURL);
    start = getCurrentTime();
    URLConnection conn = url.openConnection();
    conn.connect();
    readResponse(conn.getInputStream());
    end = getCurrentTime();
    There is a second piece that controls the HTTP connections, it is a separate
    java program that creates
    the HTTP connection process as many times as desired in a loop and waits for
    a specific period of time between every fork of the process (values I used
    are 0ms, 3 ms, 30ms etc), you can think of this as arrival rate for the
    requests to the server. Below is the code snippet that does this :
    for(int i=0; i<nNumOfHits; i++) {
    Runtime.getRuntime().exec(HTTP_conn_command);
    Thread.sleep(nInterval);
    I used WLS 5.1, on a pentium III 866 Mhz., Windows 2000 Pro, with 512 Mb
    Ram,
    tests are done locally, (WLS and the client programs run on the same
    machine),
    after each test I refresh the server to be accurate.
    With the Servlet + Java approach what the servlet does is to instantiate a
    Java Object and
    call an Init method on the object passing the HttpServletRequest to it, and
    call the
    corresponding setters, that's it. There are 7 paramaters which are all
    strings, so 7 setters are called.
    The Servlet + EJB approach does the same thing, but encapsulates the above
    implementation in a single business method of a stateless session bean. Home
    interface is created in Init() method of the servlet,
    so it is used over and over again.
    Any comments on this, greatly appreciated,
    thanks,
    ali.

    I have a very light java program that makes an HTTP connection to a servlet
    on the WLS,
    it uses the GET method for that, and reads the response from the server, it
    logs the time that passes from just before opening the HTTP connection and
    right after finishing reading the response. Below is the code snippet for
    that:
    url = new URL(sURL);
    start = getCurrentTime();
    URLConnection conn = url.openConnection();
    conn.connect();
    readResponse(conn.getInputStream());
    end = getCurrentTime();
    There is a second piece that controls the HTTP connections, it is a separate
    java program that creates
    the HTTP connection process as many times as desired in a loop and waits for
    a specific period of time between every fork of the process (values I used
    are 0ms, 3 ms, 30ms etc), you can think of this as arrival rate for the
    requests to the server. Below is the code snippet that does this :
    for(int i=0; i<nNumOfHits; i++) {
    Runtime.getRuntime().exec(HTTP_conn_command);
    Thread.sleep(nInterval);
    I used WLS 5.1, on a pentium III 866 Mhz., Windows 2000 Pro, with 512 Mb
    Ram,
    tests are done locally, (WLS and the client programs run on the same
    machine),
    after each test I refresh the server to be accurate.
    With the Servlet + Java approach what the servlet does is to instantiate a
    Java Object and
    call an Init method on the object passing the HttpServletRequest to it, and
    call the
    corresponding setters, that's it. There are 7 paramaters which are all
    strings, so 7 setters are called.
    The Servlet + EJB approach does the same thing, but encapsulates the above
    implementation in a single business method of a stateless session bean. Home
    interface is created in Init() method of the servlet,
    so it is used over and over again.
    Any comments on this, greatly appreciated,
    thanks,
    ali.

  • Free ebooks for netbean 6.0 with EJB

    Hi,
    I am a trainee although with a good background in java.
    I'm urgently in need of a free ebook for EJB 3.0 with the latest version of Netbean. Pls, help me with one if you have. my email is [email protected]
    Again, is container managed bean good for a big project?
    Thanks.
    Emeka

    Reply same as http://forums.sun.com/thread.jspa?threadID=5322030&tstart=0

Maybe you are looking for

  • Need Help with fixing our Address book in Lync 2013 (cert issue?)

    Updated our external (digicert) certificate last month. Tried doing it with the Certificate wizard but it failed and disconnected all our users from Lync. Had to restore the snapshot to get it to work. Did some googling and found that I could just up

  • Change the colour of a cell text depending on the value Web Reports (NW04s)

    Hi all, does anyone know how to change the color of the text of a cell depending on its value on Web Reports? For example red text for values smaller than zero and blue for values bigger than zero? I know you can create exceptions, but that changes t

  • BT Infinity - Master and Extension Sockets

    Hi all, Last night I got talked into signing up for BT inifnity + TV which they are due to install within the next few weeks however, i didnt realise that they have to connect the hub to the master socket which is currently located in my kitchen! My

  • Steps to be done by developer in server movement physically

    Hi All, We are moving BW server from one place to another place physically. The basis team is taking care of all movements. As BW developer what are the steps I needs to be done? Like should we delete all delta queue & data mart status? I need some c

  • Conflict Quictime Player with RME-Hammerfall Soundcard

    I have a RME-Hammerfall Soundcard PCI. When I use the Windows Media Player everything is OK,unfortunately with the Quictime Player I have audio distorsion. Could you help me please with this problem ? thank you very much in advance for your answer an