Announcement Announcement Module
Collapse
No announcement yet.
Is There A Spring 3.1 Tutorial For Raw Beginners? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is There A Spring 3.1 Tutorial For Raw Beginners?

    Hi all;

    I've read a large portion of Spring In Action, the latest edition. A truly excellent book, but it lacked a tutorial which I felt I needed to begin assimilating what I read. I decided to take a break and began working my through springsource.org's Spring tutorial Developing a Spring Framework MVC application step-by-step. I have to say it has been magnificent and what I read in Spring In Action helped me to understand 97% of the text.

    I've made it up to the point in the tutorial just before database persistence.

    I feel like I need to take a break and practice implementing some webflows to baton down what I've read.

    My issue is that the tutorial covers Spring 2.5 and it seems like Spring 3.1 is radically different ( at the the organization of the distribution files seems that way ).

    I was wondering if anyone can point me to a Spring 3.1 tutorial for people completely new to Spring?

    I've been doing Java web programming for a long time. I started off making sites with servlets only, then with JSPs plugging in custom classes ( no jstl yet ). I eventually moved on to a long term job that used its own in-house, very idiosyncratic homemade framework. They were technologically conservative, I stayed there for a long time and now I left.

    I am completely new to database persistence technologies and Spring. That is good news as Im having fun catching up. Such a huge improvement over the way things used to be done.

    Anyway, since I am starting off from scratch I would like to invest my time in the latest Spring. If you can point to a tutorial suitable for someone from my background I would be grateful.

  • #2
    you can try Spring petclinic application its well documented.

    Comment


    • #3
      Thanks!

      Hopefully the tutorial and the books out there will update soon. Going to 3.1 isn't a big deal for someone used to it, but as someone starting out cold something up to date would be cool. This should do with some extra elbow grease to pull things apart.

      Thanks much

      Comment


      • #4
        I'm trying to follow a tutorial using Tomcat 7 as my server.. here's the configuration:

        web.xml

        <?xml version="1.0" encoding="ISO-8859-1"?>
        <web-app xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
        http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">

        <display-name>R2DcvSpring</display-name>
        <description>Spring MVC Demo</description>


        <servlet>
        <servlet-name>R2spring</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
        <servlet-name>R2spring</servlet-name>
        <url-pattern>*.html</url-pattern>
        </servlet-mapping>

        </web-app>


        R2spring-servlet.xml
        <?xml version="1.0" encoding="UTF-8"?>
        <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schem...-beans-3.0.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd">


        <mvc:annotation-driven/>

        <bean name="dfltWebAppController"
        class="com.r2d2.web.app.controller.DfltWebAppContr oller"/>

        <bean id="viewResolver"
        class="org.springframework.web.servlet.view.Intern alResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlVi ew"/>
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".jsp"/>
        </bean>

        </beans>



        and I have one controller:

        package com.r2d2.web.app.controller;

        import java.util.HashMap;
        import java.util.Map;

        import org.springframework.stereotype.Controller;
        import org.springframework.web.bind.annotation.RequestMap ping;
        import org.springframework.web.bind.annotation.RequestMet hod;
        import org.springframework.web.servlet.ModelAndView;

        @Controller
        public class DfltWebAppController
        {

        @RequestMapping(value = "/helloWorld.html", method = RequestMethod.GET)
        public ModelAndView hello()
        {
        Map<String, Object> model = new HashMap<String, Object>();
        model.put("message", "Hello, Spring-MVC World");

        return new ModelAndView("index", model);
        }


        }

        The exploded web files in my tomcat is (see image)
        Attachment

        webapps/r2spring/WEB-INF
        --- web.xml
        --- R2srping-servlet.xml
        --- classes
        --- lib
        --- views
        ---- index.jsp
        Attached Files

        Comment


        • #5
          The sample I provided is working with a small change from above infor I provided. I need to consider the uppercase as this is one of the small things that is difficult to debug which I ended banging my head to figure this one out.

          in web.xml
          <servlet>
          <servlet-name>r2spring</servlet-name>
          <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
          <load-on-startup>1</load-on-startup>
          </servlet>

          <servlet-mapping>
          <servlet-name>r2spring</servlet-name>
          <url-pattern>*.html</url-pattern>
          </servlet-mapping>

          also change the R2srping-servlet.xml to R2spring-servlet.xml.. sorry for the typo.

          Comment


          • #6
            I thought I would post these links for other people in my situation. They are tutorials for modern versions of Spring:


            http://www.mkyong.com/spring3/spring...world-example/

            http://www.giantflyingsaucer.com/blog/?p=2395

            HTH

            Comment


            • #7
              And some materials that describe what "container like Tomcat" is?

              Like for someone who do not wrote a single line of Java EE or EJB or other java "enterprise" stuff?

              I know that this is basics of basics but on the other hand, for just starting, I would like to avoid diving into Tomcat documentation (or Maven docs.. (or ... )). So any tutorial that describe what those things are (it can be outdated when it comes to Spring).
              So I can grasp how Spring relate to them.

              Comment


              • #8
                Hi przemo_li;

                I feel your pain. I have been programming in Java a long time and have a lot of experience with JSPs. Yet, my last job was very long term and they were very technologically conservative. So, I have been playing catchup and like you, I have had trouble finding educational resources that don't unconsciously presuppose some prerequisites. I would have no idea of where even to point someone in your position.

                Tomcat is made my the Apache software foundation and they are famous for documentation laden with abstract sounding terms and few, if any examples.

                Maybe the best route for you to go is to work through a good book on JSPs first, they will mention Tomcat at some point. After that Spring might make a little more sense.

                FWIW, "container" is one of those abstract, counterintuitive terms.

                A "container" is software that takes JSPs, Servlets, Javacode.....crunches it all up and sends the results to a web server, which then sends it to the user. A "container" is the software that processes the "Java" ( JSPs, Servelts) for a web server.

                Tomcat is a "container", so is JBoss, Jetty, WebLogic ( I think that may also be a webserver ).

                You can learn a lot by context, but after a while if you don't stop to define words for yourself it will snowball on you and you will feel lost. Google has improved a LOT since I first started programming. Often, typing a literal question in will yield results.

                For the next "container" you run across, try dropping "What is a Servlet Container" into Google.

                You will not get to your ultimate goal, but the documentation you find will feel a whole lot less intimidating once you make those abstract terms a little bit more down to Earth.

                My apologies if I am insulting your intelligence or level of knowledge. It is very hard on the internet to know what someone's background is.

                Good Luck.

                Comment


                • #9
                  You can also go to the latest STS (2.9.1) and follow well written sample totorials which gives step by step explanation as well of what is to be done to be up and running using spring.

                  Comment


                  • #10
                    I would second that recommendation.

                    Nobody will come out and say it and it is not 100.01% true, but if you are going to develop with Spring using Maven and Eclipse ( The Spring Tool Suite (STS) is a modified version of Eclipse ) is *almost* necessary.

                    I've been using Visual Slickedit since 1999 and have a TON of other new things to learn so I have been leaving that to last on my list and I have been paying a price in frustration and slowdowns.

                    I took the past few days out to learn enough Maven to solve dependency issues which made my Spring development come to a halt. I am so glad I did. I've also been working my way through the STS Help files to slowly learn it.

                    Again, I highly recommend doing it.

                    Doing Spring without Eclipse And Maven is like going skiing without a coat.

                    Comment


                    • #11
                      STS is small help :|

                      Eg. I would like to see some doc that walk through every tech needed to construct web app.
                      Like mvc engine, template system, persistence syntax, etc.

                      Other wise I simply do not even know the NAME of tech I want to explore

                      Like String generated with JPA and Spring Roo. Will it be mapped to char or to text in DB? And under what conditions?
                      And wts should I input in Google to find answer

                      PS Anything equal to Grails documentation ?
                      (Or at least to GROM-documentation-like walk-through about JPA-Hibernate)
                      Last edited by przemo_li; Apr 4th, 2012, 02:09 AM.

                      Comment


                      • #12
                        Spring Tutorials / help for beginners

                        Hi,

                        You might find some useful tutorials here http://www.springsourcery.org.

                        Regards

                        Dan

                        Comment


                        • #13
                          That looks useful, thanks.

                          Comment


                          • #14
                            Almost all of the examples on Spring by Example have been updated to Spring 3.1.

                            Comment


                            • #15
                              thank u all,i found helpful for this situation too...
                              http://www.njoftime.lajm-shqip.com
                              http://www.lajm-shqip.com/

                              Comment

                              Working...
                              X