EJB, Servlet, JSP help

I have built a small application which creates/maintains company divisions following the MVC design pattern.
I now want to move the methods which create,update, add objects out of the controller possibly into the Model servlet. This I hope would allow other parts of the application (not yet built) to manipulate division objects and not have to do this through the Contrroller which is used to call the JSP and present data.
I am wondering whether I should do this, or whether i should just move straight to Entity Java Beans, which I believe handle all interfaces with the database.
If you reckon this is the correct way forward can you tell me where I can see a good example i.e. has EJB which handle all dtabase communication and can talk to the controller servlet and the jsp.

Hi,
We cover these issues in our book Core J2EE Patterns and also include some basic refactorings for J2EE, including moving from a non-EJB to EJB environment in phases.
Good luck,
Dan
I have built a small application which
creates/maintains company divisions following the MVC
design pattern.
I now want to move the methods which create,update,
add objects out of the controller possibly into the
Model servlet. This I hope would allow other parts of
the application (not yet built) to manipulate division
objects and not have to do this through the
Contrroller which is used to call the JSP and present
data.
I am wondering whether I should do this, or whether i
should just move straight to Entity Java Beans, which
I believe handle all interfaces with the database.
If you reckon this is the correct way forward can you
tell me where I can see a good example i.e. has EJB
which handle all dtabase communication and can talk to
the controller servlet and the jsp.

Similar Messages

  • Ejb + servlet + jsp

    Hallo everybody,
    i try to develop an application with servlet jsp and ejbs but i don't have enough information about this thema.
    for example i want to make a simple login szenario :
    user type the name and passwd and the system contact with the db and show a wellcome page if the login is succesfull and an error page if the login is unsuccessfull.
    which component does was??
    the first page can be a html form and post the name and passwd to a servlet.
    in this case servlet can make a connection with the DB and can forward the user to next page or error page. BUT where should i use EJB? can i realize the db connection with ejb ? if yes how can interact the servlet with the ejb and how can i store the information (for example address of user) which i have taken from the DB?
    thanks a lot

    Thanks for the antwort
    this means that the servlet connected to DB and execute the sql to authenticate user??
    and the second part is my bigger problem :)
    what does it mean "it will pass the control
    to the enterprise java bean which will be housing the business logic for your application."
    what does a java bean really do? how can i find information about them?
    and is ther an example in which i can see how servlets, jsps and beans interact??
    thanks

  • EJB Doubts/Questions - HELP

    Hi All,
    I am new to EJB technology and i am learning EJB without training canter. I am just going through Java EE tutorials available on www.oracle.com .
    My knowledge of EJB Session bean say:
    1.     Stateful Session Bean     : Maintains the client state.
    2.     Stateless Session Bean     : Does not maintain the client state.
    Now I am developing Shopping Cart Example using EJB, Servlet, JSP and HTML pages.
    My Project contains following pages:
    1.     login.html
    2.     AuthenticateServlet.java
    3.     User.jsp
    4.     PurchaseServlet
    5.     PurchaseSuccessful.jsp
    6.     AuthenticateBean – Stateful Session Bean
    7.     AutheticateBeanRemote – Remote Interface of Authenticate Bean
    8.     PurchaseBean – StatefulSession Bean
    9.     PurchaseBeanRemote -- Remote Interface of PurchaseBean
    Session Bean with its remote interface is maintained in the ejb package.
    Login.html contains;
    1.     textbox named “txtUser”
    2.     Password textbox named “txtPass”
    3.     Submit Button
    On submitting the credentials, it will check for the authentication in the AuthenticateServlet.
    AuthenticateBean contains
    public boolean authenticate(String user, String pwd)
         if(anylogic)
    return true;
         else
              return false;
    The above method is exposed in AuthenticateBeanRemote Interface.
    2. AuthenticateServlet contains
    I have done lookup of AuthenticateBeanRemote and have created abr. Below some important code of AuthenticateServlet;
    String user = request.getParamter("txtUser") ;
    String pwd = request.getParamter("txtPassr") ;
    boolean flag = abr.authenticate(user,pwd);
    if(flag)
         // then it will direct the control to User Page
    else
    out.println("Failure");
    User.jsp page will show me the UserID and some task that the authenticated user can do.
    My question: is while redirecting the page to User.jsp from AuthenticateServlet, do I need to do URLRewritting to maintain the session or do I need to create separate HTTPSession Object or does the Stateful session bean will take care of session management on its own. i.e. no need to do anything, just transfer or redirect to User.jsp page .
    User.jsp has purchase catalog of which the user will select products and click on purchase. On clicking purchase, it will take us to PurchaseServlet.
    My question Now in the PurchaseServlet if I have written the code to access the methods in PurchaseBean, Whether it will be a guarantee that the authernticated and currently logged in user is accessing the methods so that only that person’s purchased items are visible and no mishap will occur regarding the user integrity.
    PurchaseBean only contains the method to add the amount.
    My Question: if at the same time 2-3 users are logging in the application, then whether by using the statefulsession bean, user integrity is maintained. OR do I need to use some other approach.
    Please help me... I know these questions are silly but that’s the way the technology can be learned.

    user8687589 wrote:
    Please help me... I know these questions are silly but that’s the way the technology can be learned.You are SO wrong. You learn it by:
    a) reading and studying
    b) really understanding not only the technology but also the theory behind the technology
    c) learning how it works, why it works, when it works and when you should or shouldn't use it
    A common denominator here is that you apply thought, reason and intelligence to get not only the basics but the big picture. Don't learn how to use it: UNDERSTAND it. That does not include just demanding all the answers in a forum and expect to have the answers spoon-fed to you. First read and study, then we'll talk.

  • Desperate, help please Servlet.service() for servlet jsp threw exception

    Hi,
    I have completed 99.99% of project development, when I am about to deploy JSC throws "Servlet.service() for servlet jsp threw exception javax.faces.el.EvaluationException: java.lang.NullPointerException" I can't understand why.
    My application was working absolutely fine, I can't understand why its throwing exception now.
    I tried debuging, but i can't understand where exactly its throwing exception and whats the error.
    I would really appreciate your help, I have spent almost a day trying to figure out but din't get anywhere.
    here is my server.log
    Starting Sun Java System Application Server Platform Edition 8.0.0_01 (build b08-fcs) ...
    [#|2005-08-23T11:44:39.221+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=10;|CORE5076: Using [Java HotSpot(TM) Client VM, Version 1.4.2_06] from [Sun Microsystems Inc.]|#]
    [#|2005-08-23T11:44:42.025+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=10;|ADM0020:Following is the information about the JMX MBeanServer used:|#]
    [#|2005-08-23T11:44:42.327+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=10;|ADM0001:MBeanServer initialized successfully|#]
    [#|2005-08-23T11:44:44.572+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|Creating virtual server server|#]
    [#|2005-08-23T11:44:44.598+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=10;|S1AS AVK Instrumentation disabled|#]
    [#|2005-08-23T11:44:44.616+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.security|_ThreadID=10;|SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper.|#]
    [#|2005-08-23T11:44:51.061+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.transaction|_ThreadID=10;|JTS5014: Recoverable JTS instance, serverId = [100]|#]
    [#|2005-08-23T11:44:53.917+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=10;|Satisfying Optional Packages dependencies...|#]
    [#|2005-08-23T11:44:54.400+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=10;|RAR7008 : Initialized monitoring registry and listeners|#]
    [#|2005-08-23T11:44:56.346+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=10;|CORE5100:Loading system apps|#]
    [#|2005-08-23T11:44:58.494+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.ejb|_ThreadID=10;|EJB5109:EJB Timer Service started successfully for datasource [jdbc/__TimerPool]|#]
    [#|2005-08-23T11:44:58.494+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.classloading|_ThreadID=10;|LDR5010: All ejb(s) of [__ejb_container_timer_app] loaded successfully!|#]
    [#|2005-08-23T11:44:59.954+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.classloading|_ThreadID=10;|LDR5010: All ejb(s) of [MEjbApp] loaded successfully!|#]
    [#|2005-08-23T11:45:01.401+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.classloading|_ThreadID=10;|LDR5010: All ejb(s) of [ConverterApp] loaded successfully!|#]
    [#|2005-08-23T11:45:01.407+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0100: Loading web module [ConverterApp:war-ic.war] in virtual server [server] at [converter]|#]
    [#|2005-08-23T11:45:02.500+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.classloading|_ThreadID=10;|LDR5010: All ejb(s) of [travelApp] loaded successfully!|#]
    [#|2005-08-23T11:45:02.792+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core.classloading|_ThreadID=10;|LDR5010: All ejb(s) of [HelloWorldApp] loaded successfully!|#]
    [#|2005-08-23T11:45:02.798+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0302: Starting Tomcat.|#]
    [#|2005-08-23T11:45:03.281+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0100: Loading web module [adminapp] in virtual server [server] at [web1]|#]
    [#|2005-08-23T11:45:03.335+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0100: Loading web module [admingui] in virtual server [server] at [asadmin]|#]
    [#|2005-08-23T11:45:03.338+0100|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0500: default-locale attribute of locale-charset-info element has been deprecated and is being ignored. Use default-charset attribute of parameter-encoding element instead|#]
    [#|2005-08-23T11:45:03.351+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0100: Loading web module [com_sun_web_ui] in virtual server [server] at [com_sun_web_ui]|#]
    [#|2005-08-23T11:45:03.371+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0100: Loading web module [jTravellerService] in virtual server [server] at [jTravellerService]|#]
    [#|2005-08-23T11:45:03.399+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=10;|WEB0100: Loading web module [hello-jaxrpc] in virtual server [server] at [hello-jaxrpc]|#]
    [#|2005-08-23T11:45:03.427+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.catalina.startup.Embedded|_ThreadID=10;|Starting tomcat server|#]
    [#|2005-08-23T11:45:03.428+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.catalina.startup.Embedded|_ThreadID=10;|Catalina naming disabled|#]
    [#|2005-08-23T11:45:03.637+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.catalina.core.StandardEngine|_ThreadID=10;|Starting Servlet Engine: Sun-Java-System/Application-Server-PE-8.0|#]
    [#|2005-08-23T11:45:13.214+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.resource.webservices.rpc.server.http|_ThreadID=10;|JAXRPC.JAXRPCSERVLET.12: JAX-RPC context listener initializing|#]
    [#|2005-08-23T11:45:14.087+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.resource.webservices.rpc.server.http|_ThreadID=10;|JAXRPC.JAXRPCSERVLET.14: JAX-RPC servlet initializing|#]
    [#|2005-08-23T11:45:14.268+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.catalina.startup.ContextConfig|_ThreadID=10;|Missing application web.xml, using defaults only StandardEngine[server].StandardHost[server].StandardContext[]|#]
    [#|2005-08-23T11:45:18.600+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.resource.webservices.rpc.server.http|_ThreadID=10;|JAXRPC.JAXRPCSERVLET.12: JAX-RPC context listener initializing|#]
    [#|2005-08-23T11:45:18.657+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.resource.webservices.rpc.server.http|_ThreadID=10;|JAXRPC.JAXRPCSERVLET.14: JAX-RPC servlet initializing|#]
    [#|2005-08-23T11:45:20.710+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.coyote.http11.Http11Protocol|_ThreadID=10;|Initializing Coyote HTTP/1.1 on port 18080|#]
    [#|2005-08-23T11:45:20.790+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.coyote.http11.Http11Protocol|_ThreadID=10;|Starting Coyote HTTP/1.1 on port 18080|#]
    [#|2005-08-23T11:45:21.125+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.coyote.http11.Http11Protocol|_ThreadID=10;|Initializing Coyote HTTP/1.1 on port 11043|#]
    [#|2005-08-23T11:45:21.144+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.coyote.http11.Http11Protocol|_ThreadID=10;|Starting Coyote HTTP/1.1 on port 11043|#]
    [#|2005-08-23T11:45:21.503+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.coyote.http11.Http11Protocol|_ThreadID=10;|Initializing Coyote HTTP/1.1 on port 14848|#]
    [#|2005-08-23T11:45:21.537+0100|INFO|sun-appserver-pe8.0.0_01|org.apache.coyote.http11.Http11Protocol|_ThreadID=10;|Starting Coyote HTTP/1.1 on port 14848|#]
    [#|2005-08-23T11:45:21.989+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.resource.jms|_ThreadID=10;|JMS5023: JMS service successfully started. Instance Name = imqbroker, Home = [/opt/Creator/SunAppServer8/imq/bin].|#]
    [#|2005-08-23T11:45:22.003+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=10;|[AutoDeploy] Enabling AutoDeployment service at :1124793922003|#]
    [#|2005-08-23T11:45:22.009+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=10;|CORE5053: Application onReady complete.|#]
    [#|2005-08-23T11:45:22.012+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=10;|Application server startup complete.|#]
    [#|2005-08-23T11:45:27.303+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=11;|ADM1041:Sent the event to instance:[ResourceDeployEvent -- deploy jcp/RaveGenerated_1124793926_NFDBPool]|#]
    [#|2005-08-23T11:45:28.918+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=11;|CORE5004: Resource Deployed: [jcp:RaveGenerated_1124793926_NFDBPool].|#]
    [#|2005-08-23T11:45:29.169+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=11;|ADM1041:Sent the event to instance:[ResourceDeployEvent -- deploy jdbc/jdbc/NFDB]|#]
    [#|2005-08-23T11:45:29.365+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.core|_ThreadID=11;|CORE5004: Resource Deployed: [jdbc:jdbc/NFDB].|#]
    [#|2005-08-23T11:45:31.996+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.deployment|_ThreadID=11;|DPL5109: EJBC - START of EJBC for [_linnfdb]|#]
    [#|2005-08-23T11:45:31.999+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.deployment|_ThreadID=11;|Processing beans ...|#]
    [#|2005-08-23T11:45:32.032+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.deployment|_ThreadID=11;|DPL5110: EJBC - END of EJBC for [_linnfdb]|#]
    [#|2005-08-23T11:45:32.915+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.deployment|_ThreadID=11;|Total Deployment Time: 2082 msec, Total EJB Compiler Module Time: 37 msec, Portion spent EJB Compiling: 1%
    Breakdown of EJBC Module Time: Total Time for EJBC: 37 msec, CMP Generation: 0 msec (0%), Java Compilation: 0 msec (0%), RMI Compilation: 0 msec (0%), JAX-RPC Generation: 19 msec (51%),
    |#]
    [#|2005-08-23T11:45:32.928+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.deployment|_ThreadID=11;|deployed with moduleid = _linnfdb|#]
    [#|2005-08-23T11:45:32.990+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=11;|ADM1041:Sent the event to instance:[ModuleDeployEvent -- deploy web/_linnfdb]|#]
    [#|2005-08-23T11:45:33.275+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=11;|ADM1041:Sent the event to instance:[ModuleDeployEvent -- enable web/_linnfdb]|#]
    [#|2005-08-23T11:45:33.352+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=11;|WEB0100: Loading web module [_linnfdb] in virtual server [server] at [linnfdb]|#]
    [#|2005-08-23T11:45:34.837+0100|WARNING|sun-appserver-pe8.0.0_01|org.apache.commons.beanutils.MethodUtils|_ThreadID=11;|Cannot use JVM pre-1.4 access bug workaround die to restrictive security manager.|#]
    [#|2005-08-23T11:45:35.346+0100|WARNING|sun-appserver-pe8.0.0_01|org.apache.commons.digester.Digester|_ThreadID=11;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigDecimal)|#]
    [#|2005-08-23T11:45:35.364+0100|WARNING|sun-appserver-pe8.0.0_01|org.apache.commons.digester.Digester|_ThreadID=11;|[ConverterRule]{faces-config/converter} Merge(null,java.math.BigInteger)|#]
    [#|2005-08-23T11:45:37.265+0100|INFO|sun-appserver-pe8.0.0_01|com.sun.faces.config.ConfigureListener|_ThreadID=11;|Application object verification completed successfully|#]
    [#|2005-08-23T11:45:37.396+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.tools.admin|_ThreadID=11;|ADM1042:Status of dynamic reconfiguration event processing:[success]|#]
    [#|2005-08-23T11:46:28.167+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.stream.out|_ThreadID=12;|login successfull145|#]
    [#|2005-08-23T11:46:28.961+0100|INFO|sun-appserver-pe8.0.0_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    assigned to user query|#]
    [#|2005-08-23T11:46:34.715+0100|SEVERE|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=12;|ApplicationDispatcher[/linnfdb] Servlet.service() for servlet jsp threw exception
    javax.faces.el.EvaluationException: java.lang.NullPointerException      
    at
    com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206)
         at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
         at javax.faces.component.UISelectItems.getValue(UISelectItems.java:110)
         at com.sun.faces.util.Util.getSelectItems(Util.java:602)
         at com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:488)
         at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:465)
         at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:430)
         at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:720)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:443)
         at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:130)
         at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:701)
         at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:435)
         at com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:113)
         at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:683)
         at javax.faces.component.UIData.encodeBegin(UIData.java:681)
         at javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:591)
         at javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:543)
         at com.sun.faces.taglib.html_basic.DataTableTag.doEndTag(DataTableTag.java:491)
         at org.apache.jsp.NationalFaultsDataBase_jsp._jspx_meth_h_dataTable_0(NationalFaultsDataBase_jsp.java:581)
         at org.apache.jsp.NationalFaultsDataBase_jsp._jspx_meth_h_form_0(NationalFaultsDataBase_jsp.java:331)
         at org.apache.jsp.NationalFaultsDataBase_jsp._jspx_meth_f_view_0(NationalFaultsDataBase_jsp.java:291)
         at org.apache.jsp.NationalFaultsDataBase_jsp._jspService(NationalFaultsDataBase_jsp.java:182)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         at sun.reflect.GeneratedMethodAccessor84.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
         at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:718)
         at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:478)
         at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:413)
         at org.apache.catalina.core.ApplicationDispatcher.access$000(ApplicationDispatcher.java:77)
         at org.apache.catalina.core.ApplicationDispatcher$PrivilegedForward.run(ApplicationDispatcher.java:92)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:319)
         at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
         at com.sun.jsfcl.app.ViewHandlerImpl.renderView(ViewHandlerImpl.java:181)
         at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:221)
         at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
         at linnfdb.data.SecurityCheckFilter.doFilter(SecurityCheckFilter.java:102)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:218)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:188)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:168)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:133)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:539)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:114)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:936)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:165)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:683)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:604)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:542)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
         at java.lang.Thread.run(Thread.java:534)
    Caused by: java.lang.NullPointerException
         at com.sun.jsfcl.data.ResultSetPropertyResolver$ColumnData.getSelectItems(ResultSetPropertyResolver.java:303)
         at com.sun.jsfcl.data.ResultSetPropertyResolver.getValue(ResultSetPropertyResolver.java:61)
         at com.sun.faces.el.impl.ArraySuffix.evaluate(ArraySuffix.java:167)
         at com.sun.faces.el.impl.ComplexValue.evaluate(ComplexValue.java:151)
         at com.sun.faces.el.impl.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:243)
         at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:173)
         ... 115 more
    |#]
    any help will be greatly appreciated. Pleaseeeeeeeeeeeeee can some get back to me.
    Cheers
    kumar

    hi,
    I just found that this exception is thrown from function
    public UIViewRoot createView(FacesContext context, String viewId) {
    UIViewRoot viewRoot = handler.createView(context, viewId);
    context.getExternalContext().getRequestMap().put(CREATED_VIEW, viewId);
    setupPageBean(context, viewRoot);
    return viewRoot;
    in viewHandlerImpl.java.
    Has anyone got ideas about this???
    Any help will be greatly appreciated.
    cheers
    kush

  • Want to run servlets, jsp and ejb

    Hi there, I have just installed Oracle9iAS on my PC and want to check how to use OAS with servlets, JSPs and ejbs, so can any one tell me where can I find some worked examples and step by step deployment process, any help would be appreciated, regards, Shabbier

    If you have installed Oracle9iAS, you should be able to get to the welcome page at
    http://<machine_name>:7778/
    You can see J2EE demos off that page.
    Also, you can find info about oracle9iAS and documentation
    at http://otn.oracle.com/products/ias/content.html
    OC4J info can be found at
    http://otn.oracle.com/tech/java/oc4j
    -Prasad

  • Synchronized problem in JSP/Servlet, please help me.

    Hi, all
    I have many processes in one JSP page or Servlet program of my project.
    When many people visit at one time, then the project throws some SQL/DB Errors.
    I have updated it and test it many times, I think, that is a synchronized problem.
    At last I used ��synchronized (this){my JSP/Servlt SQL/DB processes}�� to synchronize
    The process. Then the errors removed.
    And now I think that too danger to use the ��synchronized (this){}�� to synchronized.
    If use it then some other problem may be growling on. Such as when one people need to use
    This service others must to wait, the process may be too slow! And when an exception throws
    from the SQL/DB or some other place, what I do? Need any advice from you.
    Sincerely
    Urey
    *** my JSP/Servlt Server is tomcat ***

    As Chuck points out, there isn't a new instance of the Servlet/JSP for each request - they are probably all calling the same instance so any state will be shared. If your Connection is stored as a member variable then you'll have problems with it already being in use if two people hit the page at the same time.
    Limited resources such as database connections should ideally be pooled anyway to ensure that you're not opening them all the time and that you can control how many are open across the entire application. Then you'd simply need to get a fresh connection out of the pool at the top of the page and make sure you put it back when you're done.
    Incidentally, although it might work, synchronizing the database access in the JSP would be a bad idea since you'd just create a queue of requests waiting to use the one Connection whereas you really need a number of Connections to deal with everyone simultaneously.
    If you need some example code for a simple JSP using a database connection pool (DataSource) just say.
    Hope this helps.

  • JNDI tree access for code outside servlets and EJBs and JSPs

    Can code outside EJBs, Servlets and JSPs have access to the JNDI tree?
    For example, in a web application, web.xml has a env-entry declaration which I want to access from a POJO which is called by a JSP in the web app. Is this permissible?

    Can code outside EJBs, Servlets and JSPs have access
    to the JNDI tree?
    For example, in a web application, web.xml has a
    env-entry declaration which I want to access from a
    POJO which is called by a JSP in the web app. Is
    this permissible?Yes. Read the JNDI tutorial.

  • Good books for learning Java(Servlets,JSP,EJB,etc.,),Javascript.

    Hi Experts,
    Can you suggest me some good books on java , javascript.The books should include the internals of Servlets,JSP,EJB.
    Thanks
    vishal

    http://forum.java.sun.com/thread.jspa?forumID=54&threadID=756427&start=7
    http://forum.java.sun.com/thread.jspa?forumID=54&threadID=751055
    http://forum.java.sun.com/thread.jspa?forumID=54&threadID=743429
    http://forum.java.sun.com/thread.jspa?forumID=54&threadID=742997&start=11
    http://forum.java.sun.com/thread.jspa?forumID=54&threadID=750775&start=24
    Just a simple search for this forum....
    It took me 10 seconds tofind these..
    JJ

  • Where should the support classes of servlets, JSPs and EJBs be placed

              Hi
              Could you please tell me where the support classes (simple
              java classes) used by servlets, JSPs and EJBs should be placed.
              I find that my application does not work if I place all the
              support classes of a servlet under $MYSERVER/clientclasses. I need to place some in $MYSERVER/clientclasses and some in
              $MYSERVER/servletclasses. But I figured this out my trial and error and I could not find any logical explanation why some of them should go into $MYSERVER/clientclasses and others into
              $MYSERVER/servletclasses.
              Thanks
              Regards
              Pratima
              

    you can put 'em in weblogic classpath
              Kumar
              Pratima Nambiar wrote:
              > Hi
              > Could you please tell me where the support classes (simple
              > java classes) used by servlets, JSPs and EJBs should be placed.
              > I find that my application does not work if I place all the
              > support classes of a servlet under $MYSERVER/clientclasses. I need to place some in $MYSERVER/clientclasses and some in
              > $MYSERVER/servletclasses. But I figured this out my trial and error and I could not find any logical explanation why some of them should go into $MYSERVER/clientclasses and others into
              > $MYSERVER/servletclasses.
              >
              > Thanks
              > Regards
              > Pratima
              

  • Pls. help me out..Accessing ejb through jsp

    hi all,
    I am running my ejb on the j2sdkee.1.2.1 and jdk1.3 on Windows 2000. I am facing a problem while accessing the ejb from the jsp page. Its running fine when accessing through a client application. The following is the error when I try to access it using:
    http://localhost:8000/first/FirstEJB.jsp
    Error: 500
    Internal Servlet Error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
         at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:287)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
         at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:247)
         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:352)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
         at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:626)
         at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:534)
         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)
         at org.apache.tomcat.core.Context.handleRequest(Context.java:644)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:440)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
         at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:310)
         at java.lang.Thread.run(Thread.java:484)
    Root cause:
    java.lang.NullPointerException
         at java.io.File.(File.java:181)
         at org.apache.jasper.compiler.JspCompiler.computeClassFileData(JspCompiler.java:285)
         at org.apache.jasper.compiler.JspCompiler.getClassName(JspCompiler.java:103)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:105)
         at org.apache.jasper.runtime.JspLoader$2.run(JspLoader.java:273)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:270)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
         at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:247)
         at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:352)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
         at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java:626)
         at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java:534)
         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:378)
         at org.apache.tomcat.core.Context.handleRequest(Context.java:644)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:440)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
         at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:310)
         at java.lang.Thread.run(Thread.java:484)
    The name of the jsp file is FirstEJB.jsp
    The name of the ear file is FirstEJB - Stateless Session Bean
    The name of the WAR File is FirstWAR
    I have created a Web Component named first
    Can anyone tell me how to access the ejb using jsp?
    Thanks,
    ajit

    Hello all,
    Sorry for the trouble. I got the mistake..I had not given the context in the deploytool..
    Thanks,
    ajit

  • I need a clarification : Can I use EJBs instead of helper classes for better performance and less network traffic?

    My application was designed based on MVC Architecture. But I made some changes to HMV base on my requirements. Servlet invoke helper classes, helper class uses EJBs to communicate with the database. Jsps also uses EJBs to backtrack the results.
    I have two EJBs(Stateless), one Servlet, nearly 70 helperclasses, and nearly 800 jsps. Servlet acts as Controler and all database transactions done through EJBs only. Helper classes are having business logic. Based on the request relevant helper classed is invoked by the Servlet, and all database transactions are done through EJBs. Session scope is 'Page' only.
    Now I am planning to use EJBs(for business logic) instead on Helper Classes. But before going to do that I need some clarification regarding Network traffic and for better usage of Container resources.
    Please suggest me which method (is Helper classes or Using EJBs) is perferable
    1) to get better performance and.
    2) for less network traffic
    3) for better container resource utilization
    I thought if I use EJBs, then the network traffic will increase. Because every time it make a remote call to EJBs.
    Please give detailed explanation.
    thank you,
    sudheer

    <i>Please suggest me which method (is Helper classes or Using EJBs) is perferable :
    1) to get better performance</i>
    EJB's have quite a lot of overhead associated with them to support transactions and remoteability. A non-EJB helper class will almost always outperform an EJB. Often considerably. If you plan on making your 70 helper classes EJB's you should expect to see a dramatic decrease in maximum throughput.
    <i>2) for less network traffic</i>
    There should be no difference. Both architectures will probably make the exact same JDBC calls from the RDBMS's perspective. And since the EJB's and JSP's are co-located there won't be any other additional overhead there either. (You are co-locating your JSP's and EJB's, aren't you?)
    <i>3) for better container resource utilization</i>
    Again, the EJB version will consume a lot more container resources.

  • How can I call remote ejb through jsp?(null)

     

    Trying the code:
              <%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
              <%
              int h=8;
              int w=8;
              Hashtable p = new Hashtable ();
              p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
              p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
              Context ctx= new InitialContext(p);
              Object homeref = ctx.lookup("si3.test");
              addHome home = (addHome) PortableRemoteObject.narrow(homeref, addHome.class);
              add the_ejb = home.create();
              out.println(the_ejb.add(h,w));
              out.println("adf");
              the_ejb.remove();
              %>
              yzj wrote:
              > I have two server running weblogic5.1.
              > If the jsp and ejb locate the same server running weblogic 5.1 ,works well .But one deploys the ejb (jndi name si3.test),the other runs the jsp.I use jsp call the remote ejb ,catch exception :
              >
              > GMT+08:00 2000:<E> <ServletContext-General> Root
              > > cause of ServletException
              > > javax.naming.NameNotFoundException: 'si3.test'; remaining name 'si3.test'
              > > at
              > > weblogic.jndi.toolkit.BasicWLContext.resolveName(BasicWLContext.java,
              > > Compiled Code)
              > > at
              > > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:133)
              > > at
              > > weblogic.jndi.toolkit.BasicWLContext.lookup(BasicWLContext.java:574)
              > > at javax.naming.InitialContext.lookup(InitialContext.java:349)
              > > at jsp_servlet.client._jspService(client.java:90)
              > > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              > > at
              > > weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
              > > :124)
              > > at
              > > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > > l.java:744)
              > > at
              > > weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
              > > l.java:692)
              > > at
              > > weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
              > > Manager.java:
              > > 251)
              > > at
              > > weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:363)
              > > at
              > > weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:263)
              > > at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
              > > Code)
              >
              > Why? Can you help me? Thanks.
              > The jsp's source(Client.jsp ):
              > <%@ page import="si3.*,javax.ejb.*,javax.naming.*,java.util.*,java.rmi.RemoteException" %>
              > <%
              > int h=8;
              > int w=8;
              > Hashtable p = new Hashtable ();
              > p.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
              > p.put(Context.PROVIDER_URL,"t3://192.168.0.203:7001");
              > Context ctx= new InitialContext(p);
              > addHome home = (addHome) ctx.lookup("si3.test");
              > add the_ejb = home.create();
              > out.println(the_ejb.add(h,w));
              > out.println("adf");
              > the_ejb.remove();
              > %>
              >
              >
              [att1.html]
              

  • Concurreny in Servlets/JSP

    Hi I have a JSP which presents data to a user in the form of a list. Basic CRUD operations can be performed on this data. At the moment I have a JSP, which talks to a servlet, this servlet then uses another class to actually perform the operations. This 'helper' class has several static methods defined in it.
    JSP --> Servlet --> helper Class
    I am wondering what happens if there are multiple users using the jsp and performing different operations. How is this handled in the servlet and the helper class, can multiple users use the servlet at the same time?
    If there is some documentation that is available that I could read that would be great!
    Here are parts of my servlet and helper class (The suffix bean is slightly misleading, it is just an ordinary java class)
    // Servlet code
         public void processContactRequests(HttpServletRequest request)
              // Create the model
              String operation = request.getParameter("operation");
              ContactModel contact = new ContactModel();          
              contact.setFirstName(request.getParameter("firstName"));
              contact.setLastName(request.getParameter("lastName"));
              contact.setPhoneNumber(request.getParameter("phoneNumber"));
              contact.setDetails(request.getParameter("details"));
              contact.setGender(request.getParameter("gender"));
              contact.setDateOfBirth(StringUtil.getDate(request.getParameter("dateOfBirth"), StringUtil.DATE_FORMAT_SHORT));
              contact.setMaritalStatus(request.getParameter("maritalStatus"));
              contact.setAddress1(request.getParameter("address1"));
              contact.setAddress2(request.getParameter("address2"));
              contact.setAddress3(request.getParameter("address3"));
              contact.setAddress4(request.getParameter("address4"));
              contact.setUserDefinable1(request.getParameter("userDefinable1"));
              contact.setUserDefinable2(request.getParameter("userDefinable1"));
              contact.setUserId(request.getParameter("userId"));
              contact.setPrimaryKey(Integer.parseInt(request.getParameter("primaryKey")));
              if(!StringUtil.isEmpty(operation) && operation.equals("update")) {
                   System.out.println("\n\n\nUpdating...");
                   ContactBean.updateModel(contact);     
              else if(!StringUtil.isEmpty(operation) && operation.equals("insert")) {
                   System.out.println("\n\n\nAdding....");                    
                   ContactBean.addModel(contact);     
              else if(!StringUtil.isEmpty(operation) && operation.equals("delete")) {
                   System.out.println("\n\n\nRemoving....");
                   ContactBean.removeModel(contact);     
    // Static method in my helper class
    public static void updateModel(ContactModel contact) {
    System.out.println("Inside Update Contact Method...");
    Connection conn = null;
    PreparedStatement statement = null;
    ResultSet rs = null;
         try {
    // get a connection to the database
    conn = Database.getConnection();
         String sql = "UPDATE contacts SET first_name = ?, " +
                   "last_name = ?, phone = ?, details = ?, user_id = ?, " +
                   "date_of_birth = ?, gender = ?, martial_status = ?, address_1 = ?, " +
                   "address_2 = ?, address_3 = ?, address_4 = ?, user_definable_1 = ?, " +
                   "user_definable_2 = ? " +
                   "WHERE contact_primary_key = ? " +
                        "AND user_id = ?";      
    statement = conn.prepareStatement(sql);
    statement.setString(1, contact.getFirstName());
    statement.setString(2, contact.getLastName() );
    statement.setString(3, contact.getPhoneNumber());
    statement.setString(4, contact.getDetails());
    statement.setString(5, contact.getUserId());
    statement.setTimestamp(6, contact.getDateOfBirth());
    statement.setString(7, contact.getGender() );
    statement.setString(8, contact.getMaritalStatus() );
    statement.setString(9, contact.getAddress1() );
    statement.setString(10, contact.getAddress2() );
    statement.setString(11, contact.getAddress3() );
    statement.setString(12, contact.getAddress4() );
    statement.setString(13, contact.getUserDefinable1());
    statement.setString(14, contact.getUserDefinable2());      
    statement.setInt(15, contact.getPrimaryKey());      
    statement.setString(16, contact.getUserId());      
         int iSuccess = statement.executeUpdate();
    if (iSuccess == 0)
    //throw a EJB exception here
         System.out.println("Error getting database data: ");
    } catch (SQLException e){
         e.printStackTrace();
         System.out.println("Error in Update Contact Method: " + e);
    } finally
    Database.close(conn, statement);

    concurrency in java has produced research papers. i
    took a course on this; but am still not really
    comfortable doing concurrency code in java; because
    the design of JVM does not directly imply that if you
    use synchronized() method, your methods will be really
    synchronized.I'm quite sure that this not is correct.
    <snip>
    your example scenarios can be: for example, do 2 or
    more threads need to come and meet at this atomic
    action? do they need to exchange message when they are
    inside the synchronized area? and do they need to
    leave a synchronized area at the same time? Another
    scenario is simple multiplereaders_singlewriter
    problem.I'm not sure how these comments make sense. Exchange messages? The threads can't both be inside the synchronized area at the same time anyway. It's the definition of synchronized in Java that precludes this possibility. If you want to get off into discussions of synchronization and atomic code and low level implementation details, that's one thing, but it's not really relavent to the OP's question. The answer to which is what I already said above.
    Implementations can include semaphores and monitors.
    These are some books:
    G.R. Andrews, Concurrent Programming: Principles and
    Practice, Benjamin/Cummings, 1991.
    R.A. Olsson and A.W. Keen, The JR Programming
    Language: Concurrent Programming in an Extended Java,
    (draft).
    I am not sure if I just gave you an over-dozage. But,
    this is a very interesting topic. :)Yes, it is... But not here.

  • Javax.servlet.jsp.jstl.sql.Result and arraylist

    Hi,
    I try to explain my problem, I have posted in another section of forum, but perhaps this is a better place:
    I'm trying to use MVC model, so I call an EJB from a servlet which returns me a javax.servlet.jsp.jstl.sql.Result object (this derive from a resultset of a query) and then I make this available to a jsp page.
    I've choosen to return an javax.servlet.jsp.jstl.sql.Result object because I'd like to use this syntax:
    <c:forEach var="profiloString" items="${listaProfili}" >
              ${profiloString.anything}
    </c:forEach>Now I need to put my listaProfili object in session and permit users of my application to add and delete items from it. Finally I will update my database with the new data from listaProfili object.
    If listaProfili is an arraylist I can easily add or delete item from it, but if it is a javax.servlet.jsp.jstl.sql.Result I don't know how I can do this.
    If I return an arraylist object instead of an javax.servlet.jsp.jstl.sql.Result object, I can't use "<c:forEach ..." syntax.
    Can anyone help me?
    Thanks.

    So why didn't you think that the JSP forum here wasn't a good place to ask JSP questions like this one?
    You can use <c:for-each> with a List. That's how it's designed. I don't understand why you say you can't. Perhaps you were confused by the SQL tags in JSTL. But anyway, you should just return a List from your EJB and forget about using obscure internal JSP classes.

  • Dont have "javax.servlet.jsp.JspException errors" in my logs (WebLogic 9.2)

    Hi,
              I have 2 servers.
              One with WebLogic6.1 & one with WebLogic9.2
              With WL6.1, i have errors like :
              <i>
              <2 août 2006 13:00:20 IRST> <Error> <HTTP> <[WebAppServletContext(10414345,imargo,/imargo)] Root cause of ServletException
              javax.servlet.jsp.JspException: Missing message for key MG01.loc.index
              at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:297)
              at jsp_servlet._jsp.__im_in_tec_MGN01_MGN001._jspService(__im_in_tec_MGN01_MGN001.java:1711)
              </i>
              With WL9.2, i don't have those errors in my logs...
              I have no errors o_o
              Help me plz
              Many thanks

    I never used DynaActionForm, what I have noticed here is, don't you need to declare the form bean? I may be wrong.
    <form-beans>
    <form-bean name="newProdForm" type="com.package.form.NewProdForm"></form-bean>
    </form-beans>

Maybe you are looking for