This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Spring and the fly likes How to implement a shopping cart using Spring? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to implement a shopping cart using Spring?" Watch "How to implement a shopping cart using Spring?" New topic
Author

How to implement a shopping cart using Spring?

hernan rodriguez
Greenhorn

Joined: Mar 13, 2011
Posts: 14
hi, i'm a newbie at this, so forgive my ignorance. I want to implement a shopping cart using spring... do i need to use javascript for this purpose? why can't i just get the data from the database and put them into a simple form? I looked for some examples of this, but they were made with js, cookies handling...

Another question, is there any kind of help to make web application? Or have i to do it form scratch? I mean, some kind of GUI... I am using html,css,js,spring,hibernate.

last question, what would be the first step to build my application? Thinking about the tables in db and their relationships or creating first the presentation layer?

BTW, can i use spring 2 and hibernate 3? could this cause me any problem?

thanks,

regards
Josh Long
author
Greenhorn

Joined: Apr 04, 2011
Posts: 24

There are *many* ways to skin this particular cat. Naturally, Spring provides everything you'll need to build it any number of ways. It's easiest to break down the requirements in isolation and pick a strategy from there.

Most likely, you'll need to store data in a database. You'll need to manipulate the state of the database from Java. If you're deploying to the web, then you'll also need to build a client or web application.

To store data in a database, you can use Spring's numerous options for data persistence. Spring provides super clean, easy to use options for data persistence with any number of technologies, be it straight JDBC, Hibernate 2 and 3, JPA, iBatis, etc. For more on building a domain driven database application, see http://blog.springsource.com/2011/01/07/green-beans-getting-started-with-spring-in-your-service-tier/.

The next step is building your web application. For that, you can use Spring MVC to build a web application with HTML. You could also use Flex and the Spring BlazeDS support to build a Flex-based application that works with Adobe AIR. You might use Spring Android to build a shopping cart that works on Android devices, etc. So, clearly, you've got lots of choices and there's no clear way to tell you whether you'd need JavaScript or not without details.

If you're new to Spring, there are a lot of options. To make it dead simple to get a good result, quickly, you might look at Spring Roo. Spring Roo provides a domain driven development model. You learn how to build a Spring Roo application and it'll build the database code, Java services and web application for you, which you can then fine tune once it's all working. I'm not sure what information you'd like to brush up, but you might start at http://blog.springsource.com/category/green-beans/, where we have numerous blog posts on numerous topics, all geared towards beginners.

Thanks, Josh Long
Spring Developer Advocate, SpringSource, a division of VMware
http://blog.springsource.org - http://www.joshlong.com
hernan rodriguez
Greenhorn

Joined: Mar 13, 2011
Posts: 14
Josh Long wrote:There are *many* ways to skin this particular cat. Naturally, Spring provides everything you'll need to build it any number of ways. It's easiest to break down the requirements in isolation and pick a strategy from there.

Most likely, you'll need to store data in a database. You'll need to manipulate the state of the database from Java. If you're deploying to the web, then you'll also need to build a client or web application.

To store data in a database, you can use Spring's numerous options for data persistence. Spring provides super clean, easy to use options for data persistence with any number of technologies, be it straight JDBC, Hibernate 2 and 3, JPA, iBatis, etc. For more on building a domain driven database application, see http://blog.springsource.com/2011/01/07/green-beans-getting-started-with-spring-in-your-service-tier/.

The next step is building your web application. For that, you can use Spring MVC to build a web application with HTML. You could also use Flex and the Spring BlazeDS support to build a Flex-based application that works with Adobe AIR. You might use Spring Android to build a shopping cart that works on Android devices, etc. So, clearly, you've got lots of choices and there's no clear way to tell you whether you'd need JavaScript or not without details.

If you're new to Spring, there are a lot of options. To make it dead simple to get a good result, quickly, you might look at Spring Roo. Spring Roo provides a domain driven development model. You learn how to build a Spring Roo application and it'll build the database code, Java services and web application for you, which you can then fine tune once it's all working. I'm not sure what information you'd like to brush up, but you might start at http://blog.springsource.com/category/green-beans/, where we have numerous blog posts on numerous topics, all geared towards beginners.


Thanks,
there is something still not clear to me, can I use Spring 2 and Hibernate 3 together? could be some kind of incompatibility? or must i use either spring2&hibernate2 or spring3&hibernate3?

regards
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to implement a shopping cart using Spring?