Java EE (J2EE) Tutorial for beginners Part7

Java

Video is ready, Click Here to View ×


Java EE (J2EE) Tutorial for beginners Part7: Spring Framework + Spring Webflow + Spring Security + JPA (Hibernate) + JSF 2.0 (PrimeFaces) + Apache Maven 2 + Apache Tomcat + Subclipse + Oracle RDBMS + Eclipse IDE

28 thoughts on “Java EE (J2EE) Tutorial for beginners Part7

  1. Are you sure this is the right way to do it? I don't like the way you managed to see the index.jsp using a condition on the variables, I'm sure there is a better way to do that.

  2. I've changed some lines, because the check of null values doesn't work on my Server:

    String name = request.getParameter("name");

    if ((name==null) || (name.isEmpty())){
    getServletContext().getRequestDispatcher("/index.jsp").forward(request, response);
    return;
    }

  3. i didn't get it to work in the conditional statement : 
    if(request.getParameter("firstname"==null || request.getParameter("lastname")==null)

    then i changed null with "" and it works ^^
    so thanks man

  4. Years of JavaScript hardcoding forces me to share this advice width you:
    in OOP, if you want to check if a String is !=null, just do:

      if( string.length()>0 )   // do something.
      else   // gfy.

    So, in our case, this tip would translate to:

      if( request.getParameter("firstname").length()<1  || request.getParameter("lastname").length()<1  ) {
       // gfy.
    } else {
       // do the output
    }

  5. Hi Arthur,

    Great videos and you are an excellent tutor. I really enjoy your videos. In part 4 video, you have selected the tomcat runtime environment from c:Program Files. However, the downloaded tomcat was extracted in C:J2EETutorial folder. Is this a mistake or am I missing something?

  6. if we want to forward servlet to index.jsp at first we must use:

    if(request.getParameter("first­name")==null || request.getParameter("lastname­")==null)

    because at very first beginning firstname and lastname are null. after forwarding if we submit when the fields are blank. now firstname and lastname are not null they are just empty strings. like this -> ""

    the most correct way is first null check for first run of application and then equals("") check for blank submits.

  7. Hello Art, great stuff so far. Quick easy question in your example here why are we moving stuff in the request from getParameter to setAttribute in the servlet? In the output.jsp you can just grab from getParameter directly (both are in request after all) and access within scriplets. It would make more sense if we were grabbing from request and setting in session object. Thanks Man

  8. Arthur, did You do mistake at 04:01 ? You used condition if(request.getParameter("firstname")==null || request.getParameter("lastname")==null)

    shouldn't it be:

    if(request.getParameter("firstname").equals("") || request.getParameter("lastname").equals(""))

    When I use second condition it works well but when i use Yours it doesn't work correctly.

  9. We will define OracleDataSource bean with URL, user and password properties…, and pass dataSource reference to Spring's entity manager factory bean so that JPA and hibernate takes care of data source pooling. That will be in one of the next videos.
    If i'll have enough time I will show how to use JNDI resources for that purpose. Let's say if there will be enough interest from public, I'll try to find some time.
    But if you are talking about Servlets&JSP case – that won't be covered in that tut.

Leave a Reply

Your email address will not be published. Required fields are marked *