diff --git a/Create Database.sql.txt b/Create Database.sql.txt
index 8511609..448179d 100755
--- a/Create Database.sql.txt
+++ b/Create Database.sql.txt
@@ -1,30 +1,20 @@
-CREATE TABLE [event_person] (
- [event_id] [int] NOT NULL,
- [person_id] [int] NOT NULL,
- CONSTRAINT [PK_event_person] PRIMARY KEY CLUSTERED
- (
- [event_id] ASC,
- [person_id] ASC
- )
-)
+CREATE TABLE event_person (
+ event_id int NOT NULL,
+ person_id int NOT NULL,
+ PRIMARY KEY(event_id,person_id)
+);
-CREATE TABLE [events] (
- [id] [int] IDENTITY(1,1) NOT NULL,
- [dt] [datetime] NULL,
- [name] [nvarchar](50) NULL,
- CONSTRAINT [PK_events] PRIMARY KEY CLUSTERED
- (
- [id] ASC
- )
+CREATE TABLE events (
+ id int NOT NULL AUTO_INCREMENT,
+ dt datetime NULL,
+ name varchar(50) NULL,
+ PRIMARY KEY(id)
)
-CREATE TABLE [people] (
- [id] [int] IDENTITY(1,1) NOT NULL,
- [name] [varchar](50) NOT NULL,
- CONSTRAINT [PK_people] PRIMARY KEY CLUSTERED
- (
- [id] ASC
- )
+CREATE TABLE people (
+ id int NOT NULL AUTO_INCREMENT,
+ name varchar(50) NOT NULL,
+ PRIMARY KEY(id)
)
insert into events(dt,name)
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..f9f5324
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,114 @@
+
+
+ 4.0.0
+
+ za.net.chat.jt
+ JavaTutorial
+ 1.0-SNAPSHOT
+
+
+ org.apache.struts
+ struts2-core
+ 2.3.24
+
+
+ org.apache.struts
+ struts2-spring-plugin
+ 2.3.24
+
+
+ org.springframework
+ spring-beans
+
+
+
+
+ org.hibernate
+ hibernate-core
+ 4.3.10.Final
+
+
+ org.hibernate
+ hibernate-c3p0
+ 4.3.10.Final
+
+
+ opensymphony
+ sitemesh
+ 2.4.2
+
+
+ jstl
+ jstl
+ 1.2
+
+
+ log4j
+ log4j
+ 1.2.17
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.12
+
+
+ org.slf4j
+ slf4j-log4j12
+ 1.7.12
+
+
+ commons-logging
+ commons-logging
+ 1.2
+
+
+ org.springframework
+ spring-core
+ 4.1.7.RELEASE
+
+
+ org.springframework
+ spring-beans
+ 4.1.7.RELEASE
+
+
+ org.springframework
+ spring-tx
+ 4.1.7.RELEASE
+
+
+ org.springframework
+ spring-web
+ 4.1.7.RELEASE
+
+
+ org.springframework
+ spring-context
+ 4.1.7.RELEASE
+
+
+ org.apache.struts.xwork
+ xwork-core
+ 2.3.24
+
+
+ org.springframework
+ spring-orm
+ 4.1.7.RELEASE
+
+
+ mysql
+ mysql-connector-java
+ 5.1.36
+
+
+ net.sourceforge.jtds
+ jtds
+ 1.3.1
+
+
+
+
\ No newline at end of file
diff --git a/src/actions/base/BaseAction.java b/src/main/java/za/net/chat/jt/actions/base/BaseAction.java
old mode 100755
new mode 100644
similarity index 72%
rename from src/actions/base/BaseAction.java
rename to src/main/java/za/net/chat/jt/actions/base/BaseAction.java
index 58f0812..63f027e
--- a/src/actions/base/BaseAction.java
+++ b/src/main/java/za/net/chat/jt/actions/base/BaseAction.java
@@ -1,22 +1,24 @@
-package actions.base;
-
-import services.Services;
-import com.opensymphony.xwork2.ActionSupport;
-
-public class BaseAction extends ActionSupport {
- // So that spring can inject the business singleton
- protected Services services;
- public void setServices(Services value) {
- services=value;
- }
-
- // For redirect results
- protected String redirectUrl;
- public String getRedirectUrl() {
- return redirectUrl;
- }
- public String redirect(String to) {
- redirectUrl = to;
- return "redirect";
- }
-}
+package za.net.chat.jt.actions.base;
+
+import com.opensymphony.xwork2.ActionSupport;
+import za.net.chat.jt.actions.services.Services;
+
+
+public class BaseAction extends ActionSupport {
+ // So that spring can inject the business singleton
+ protected Services services;
+ public void setServices(Services value) {
+ System.out.println("Services set to :"+value);
+ services=value;
+ }
+
+ // For redirect results
+ protected String redirectUrl;
+ public String getRedirectUrl() {
+ return redirectUrl;
+ }
+ public String redirect(String to) {
+ redirectUrl = to;
+ return "redirect";
+ }
+}
diff --git a/src/data/Event.java b/src/main/java/za/net/chat/jt/actions/data/Event.java
old mode 100755
new mode 100644
similarity index 93%
rename from src/data/Event.java
rename to src/main/java/za/net/chat/jt/actions/data/Event.java
index 80f096e..373d796
--- a/src/data/Event.java
+++ b/src/main/java/za/net/chat/jt/actions/data/Event.java
@@ -1,27 +1,27 @@
-package data;
-
-import java.util.Set;
-import javax.persistence.*;
-
-@Entity
-@Table(name="events")
-public class Event {
- @Id @GeneratedValue
- Long id;
- public Long getId() {return id;}
- public void setId(Long id) {this.id = id;}
-
- String name;
- public String getName() {return name;}
- public void setName(String value) {name = value;}
-
- @ManyToMany
- @JoinTable(
- name="event_person",
- joinColumns=@JoinColumn(name="event_id"),
- inverseJoinColumns=@JoinColumn(name="person_id")
- )
- Set people;
- public void setPeople(Set people) {this.people = people;}
- public Set getPeople() {return people;}
-}
+package za.net.chat.jt.actions.data;
+
+import java.util.Set;
+import javax.persistence.*;
+
+@Entity
+@Table(name="events")
+public class Event {
+ @Id @GeneratedValue
+ Long id;
+ public Long getId() {return id;}
+ public void setId(Long id) {this.id = id;}
+
+ String name;
+ public String getName() {return name;}
+ public void setName(String value) {name = value;}
+
+ @ManyToMany
+ @JoinTable(
+ name="event_person",
+ joinColumns=@JoinColumn(name="event_id"),
+ inverseJoinColumns=@JoinColumn(name="person_id")
+ )
+ Set people;
+ public void setPeople(Set people) {this.people = people;}
+ public Set getPeople() {return people;}
+}
diff --git a/src/data/Person.java b/src/main/java/za/net/chat/jt/actions/data/Person.java
old mode 100755
new mode 100644
similarity index 93%
rename from src/data/Person.java
rename to src/main/java/za/net/chat/jt/actions/data/Person.java
index fc80d3a..731ae60
--- a/src/data/Person.java
+++ b/src/main/java/za/net/chat/jt/actions/data/Person.java
@@ -1,27 +1,27 @@
-package data;
-
-import java.util.Set;
-import javax.persistence.*;
-
-@Entity
-@Table(name="people")
-public class Person {
- @Id @GeneratedValue
- Long id;
- public Long getId() {return id;}
- public void setId(Long id) {this.id = id;}
-
- String name;
- public String getName() {return name;}
- public void setName(String name) {this.name = name;}
-
- @ManyToMany
- @JoinTable(
- name="event_person",
- joinColumns=@JoinColumn(name="person_id"),
- inverseJoinColumns=@JoinColumn(name="event_id")
- )
- Set events;
- public void setEvents(Set events) {this.events = events;}
- public Set getEvents() {return events;}
-}
+package za.net.chat.jt.actions.data;
+
+import java.util.Set;
+import javax.persistence.*;
+
+@Entity
+@Table(name="people")
+public class Person {
+ @Id @GeneratedValue
+ Long id;
+ public Long getId() {return id;}
+ public void setId(Long id) {this.id = id;}
+
+ String name;
+ public String getName() {return name;}
+ public void setName(String name) {this.name = name;}
+
+ @ManyToMany
+ @JoinTable(
+ name="event_person",
+ joinColumns=@JoinColumn(name="person_id"),
+ inverseJoinColumns=@JoinColumn(name="event_id")
+ )
+ Set events;
+ public void setEvents(Set events) {this.events = events;}
+ public Set getEvents() {return events;}
+}
diff --git a/src/actions/events/Attendance.java b/src/main/java/za/net/chat/jt/actions/events/Attendance.java
old mode 100755
new mode 100644
similarity index 85%
rename from src/actions/events/Attendance.java
rename to src/main/java/za/net/chat/jt/actions/events/Attendance.java
index e037c75..c12fa99
--- a/src/actions/events/Attendance.java
+++ b/src/main/java/za/net/chat/jt/actions/events/Attendance.java
@@ -1,35 +1,35 @@
-package actions.events;
-
-import data.*;
-import actions.base.BaseAction;
-import java.util.Set;
-import java.util.List;
-import java.util.ArrayList;
-
-
-public class Attendance extends BaseAction {
-
- public String execute() {
- return "success";
- }
-
- int id;
- public void setId(int value) {id = value;}
- public int getId() {return id; }
-
- Event getEvent() {return services.getEventById(id); }
-
- public String getEventName() { return getEvent().getName(); }
-
- public Set getAttendees() { return getEvent().getPeople(); }
-
- // Return a list of people not attending
- public List getNonAttendees() {
- List nonAttendees = new ArrayList();
- for(Person person : services.getPeople()) {
- if (!getAttendees().contains(person))
- nonAttendees.add(person);
- }
- return nonAttendees;
- }
-}
+package za.net.chat.jt.actions.events;
+
+import za.net.chat.jt.actions.data.*;
+import za.net.chat.jt.actions.base.BaseAction;
+import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
+
+
+public class Attendance extends BaseAction {
+
+ public String execute() {
+ return "success";
+ }
+
+ int id;
+ public void setId(int value) {id = value;}
+ public int getId() {return id; }
+
+ Event getEvent() {return services.getEventById(id); }
+
+ public String getEventName() { return getEvent().getName(); }
+
+ public Set getAttendees() { return getEvent().getPeople(); }
+
+ // Return a list of people not attending
+ public List getNonAttendees() {
+ List nonAttendees = new ArrayList();
+ for(Person person : services.getPeople()) {
+ if (!getAttendees().contains(person))
+ nonAttendees.add(person);
+ }
+ return nonAttendees;
+ }
+}
diff --git a/src/actions/events/AttendanceAdd.java b/src/main/java/za/net/chat/jt/actions/events/AttendanceAdd.java
old mode 100755
new mode 100644
similarity index 79%
rename from src/actions/events/AttendanceAdd.java
rename to src/main/java/za/net/chat/jt/actions/events/AttendanceAdd.java
index 17475a6..cff1448
--- a/src/actions/events/AttendanceAdd.java
+++ b/src/main/java/za/net/chat/jt/actions/events/AttendanceAdd.java
@@ -1,16 +1,16 @@
-package actions.events;
-
-import actions.base.BaseAction;
-
-public class AttendanceAdd extends BaseAction {
- public String execute() {
- services.addPersonToEvent(personId, eventId);
- return redirect(String.format("Attendance.action?id=%d", eventId));
- }
-
- int eventId;
- public void setEventId(int value) {eventId = value;}
-
- int personId;
- public void setPersonId(int value) {personId = value;}
-}
+package za.net.chat.jt.actions.events;
+
+import za.net.chat.jt.actions.base.BaseAction;
+
+public class AttendanceAdd extends BaseAction {
+ public String execute() {
+ services.addPersonToEvent(personId, eventId);
+ return redirect(String.format("Attendance.action?id=%d", eventId));
+ }
+
+ int eventId;
+ public void setEventId(int value) {eventId = value;}
+
+ int personId;
+ public void setPersonId(int value) {personId = value;}
+}
diff --git a/src/actions/events/AttendanceRemove.java b/src/main/java/za/net/chat/jt/actions/events/AttendanceRemove.java
old mode 100755
new mode 100644
similarity index 80%
rename from src/actions/events/AttendanceRemove.java
rename to src/main/java/za/net/chat/jt/actions/events/AttendanceRemove.java
index c1e62fa..2a9a588
--- a/src/actions/events/AttendanceRemove.java
+++ b/src/main/java/za/net/chat/jt/actions/events/AttendanceRemove.java
@@ -1,16 +1,16 @@
-package actions.events;
-
-import actions.base.BaseAction;
-
-public class AttendanceRemove extends BaseAction {
- public String execute() {
- services.removePersonFromEvent(personId, eventId);
- return redirect(String.format("Attendance.action?id=%d", eventId));
- }
-
- int eventId;
- public void setEventId(int value) {eventId = value;}
-
- int personId;
- public void setPersonId(int value) {personId = value;}
-}
+package za.net.chat.jt.actions.events;
+
+import za.net.chat.jt.actions.base.BaseAction;
+
+public class AttendanceRemove extends BaseAction {
+ public String execute() {
+ services.removePersonFromEvent(personId, eventId);
+ return redirect(String.format("Attendance.action?id=%d", eventId));
+ }
+
+ int eventId;
+ public void setEventId(int value) {eventId = value;}
+
+ int personId;
+ public void setPersonId(int value) {personId = value;}
+}
diff --git a/src/actions/events/Delete.java b/src/main/java/za/net/chat/jt/actions/events/Delete.java
old mode 100755
new mode 100644
similarity index 79%
rename from src/actions/events/Delete.java
rename to src/main/java/za/net/chat/jt/actions/events/Delete.java
index a6341a0..32d4741
--- a/src/actions/events/Delete.java
+++ b/src/main/java/za/net/chat/jt/actions/events/Delete.java
@@ -1,25 +1,25 @@
-package actions.events;
-
-import data.Event;
-import actions.base.BaseAction;
-
-public class Delete extends BaseAction {
-
- public String execute() {
- if (isPostBack) {
- services.deleteEventById(id);
- return redirect("Listing.action");
- }
- return "success";
- }
-
- int id;
- public void setId(int value) {id = value;}
- public int getId() {return id; }
-
- boolean isPostBack;
- public void setIsPostBack(boolean value) {isPostBack = value;}
-
- Event getEvent() {return services.getEventById(id); }
- public String getEventName() {return getEvent().getName();}
-}
+package za.net.chat.jt.actions.events;
+
+import za.net.chat.jt.actions.data.Event;
+import za.net.chat.jt.actions.base.BaseAction;
+
+public class Delete extends BaseAction {
+
+ public String execute() {
+ if (isPostBack) {
+ services.deleteEventById(id);
+ return redirect("Listing.action");
+ }
+ return "success";
+ }
+
+ int id;
+ public void setId(int value) {id = value;}
+ public int getId() {return id; }
+
+ boolean isPostBack;
+ public void setIsPostBack(boolean value) {isPostBack = value;}
+
+ Event getEvent() {return services.getEventById(id); }
+ public String getEventName() {return getEvent().getName();}
+}
diff --git a/src/actions/events/Listing.java b/src/main/java/za/net/chat/jt/actions/events/Listing.java
old mode 100755
new mode 100644
similarity index 64%
rename from src/actions/events/Listing.java
rename to src/main/java/za/net/chat/jt/actions/events/Listing.java
index e35fcc8..b984e3d
--- a/src/actions/events/Listing.java
+++ b/src/main/java/za/net/chat/jt/actions/events/Listing.java
@@ -1,16 +1,16 @@
-package actions.events;
-
-import actions.base.BaseAction;
-import data.*;
-import java.util.List;
-
-public class Listing extends BaseAction {
-
- public String execute() {
- events = services.getEvents();
- return "success";
- }
-
- List events;
- public List getEvents() { return events; }
-}
+package za.net.chat.jt.actions.events;
+
+import za.net.chat.jt.actions.base.BaseAction;
+import za.net.chat.jt.actions.data.*;
+import java.util.List;
+
+public class Listing extends BaseAction {
+
+ public String execute() {
+ events = services.getEvents();
+ return "success";
+ }
+
+ List events;
+ public List getEvents() { return events; }
+}
diff --git a/src/actions/events/New.java b/src/main/java/za/net/chat/jt/actions/events/New.java
old mode 100755
new mode 100644
similarity index 79%
rename from src/actions/events/New.java
rename to src/main/java/za/net/chat/jt/actions/events/New.java
index e603659..e959300
--- a/src/actions/events/New.java
+++ b/src/main/java/za/net/chat/jt/actions/events/New.java
@@ -1,19 +1,19 @@
-package actions.events;
-
-import actions.base.BaseAction;
-
-public class New extends BaseAction {
-
- public String execute() {
- if (name!=null && name.length()>0)
- {
- services.createEvent(name);
- return redirect("Listing.action");
- }
- return "success";
- }
-
- String name;
- public String getName() {return name;}
- public void setName(String value) {name = value;}
-}
+package za.net.chat.jt.actions.events;
+
+import za.net.chat.jt.actions.base.BaseAction;
+
+public class New extends BaseAction {
+
+ public String execute() {
+ if (name!=null && name.length()>0)
+ {
+ services.createEvent(name);
+ return redirect("Listing.action");
+ }
+ return "success";
+ }
+
+ String name;
+ public String getName() {return name;}
+ public void setName(String value) {name = value;}
+}
diff --git a/src/actions/people/Delete.java b/src/main/java/za/net/chat/jt/actions/people/Delete.java
old mode 100755
new mode 100644
similarity index 83%
rename from src/actions/people/Delete.java
rename to src/main/java/za/net/chat/jt/actions/people/Delete.java
index 0f55094..b47ac0d
--- a/src/actions/people/Delete.java
+++ b/src/main/java/za/net/chat/jt/actions/people/Delete.java
@@ -1,24 +1,24 @@
-package actions.people;
-
-import actions.base.BaseAction;
-
-public class Delete extends BaseAction {
-
- public String execute() {
- if (isPostBack)
- {
- services.deletePersonById(id);
- return redirect("Listing.action");
- }
- return "success";
- }
-
- int id;
- public void setId(int value) {id = value;}
- public int getId() {return id; }
-
- boolean isPostBack;
- public void setIsPostBack(boolean value) {isPostBack = value;}
-
- public String getName() { return services.getPersonById(id).getName(); }
-}
+package za.net.chat.jt.actions.people;
+
+import za.net.chat.jt.actions.base.BaseAction;
+
+public class Delete extends BaseAction {
+
+ public String execute() {
+ if (isPostBack)
+ {
+ services.deletePersonById(id);
+ return redirect("Listing.action");
+ }
+ return "success";
+ }
+
+ int id;
+ public void setId(int value) {id = value;}
+ public int getId() {return id; }
+
+ boolean isPostBack;
+ public void setIsPostBack(boolean value) {isPostBack = value;}
+
+ public String getName() { return services.getPersonById(id).getName(); }
+}
diff --git a/src/actions/people/Listing.java b/src/main/java/za/net/chat/jt/actions/people/Listing.java
old mode 100755
new mode 100644
similarity index 64%
rename from src/actions/people/Listing.java
rename to src/main/java/za/net/chat/jt/actions/people/Listing.java
index 922b8a2..e22237a
--- a/src/actions/people/Listing.java
+++ b/src/main/java/za/net/chat/jt/actions/people/Listing.java
@@ -1,16 +1,16 @@
-package actions.people;
-
-import actions.base.BaseAction;
-import data.*;
-import java.util.List;
-
-public class Listing extends BaseAction {
-
- public String execute() {
- people = services.getPeople();
- return "success";
- }
-
- List people;
- public List getPeople() { return people; }
-}
+package za.net.chat.jt.actions.people;
+
+import za.net.chat.jt.actions.base.BaseAction;
+import za.net.chat.jt.actions.data.*;
+import java.util.List;
+
+public class Listing extends BaseAction {
+
+ public String execute() {
+ people = services.getPeople();
+ return "success";
+ }
+
+ List people;
+ public List getPeople() { return people; }
+}
diff --git a/src/actions/people/New.java b/src/main/java/za/net/chat/jt/actions/people/New.java
old mode 100755
new mode 100644
similarity index 79%
rename from src/actions/people/New.java
rename to src/main/java/za/net/chat/jt/actions/people/New.java
index 91d3c8d..6fdef61
--- a/src/actions/people/New.java
+++ b/src/main/java/za/net/chat/jt/actions/people/New.java
@@ -1,19 +1,19 @@
-package actions.people;
-
-import actions.base.BaseAction;
-
-public class New extends BaseAction {
-
- public String execute() {
- if (name!=null && name.length()>0)
- {
- services.createPerson(name);
- return redirect("Listing.action");
- }
- return "success";
- }
-
- String name;
- public String getName() {return name;}
- public void setName(String value) {name = value;}
-}
+package za.net.chat.jt.actions.people;
+
+import za.net.chat.jt.actions.base.BaseAction;
+
+public class New extends BaseAction {
+
+ public String execute() {
+ if (name!=null && name.length()>0)
+ {
+ services.createPerson(name);
+ return redirect("Listing.action");
+ }
+ return "success";
+ }
+
+ String name;
+ public String getName() {return name;}
+ public void setName(String value) {name = value;}
+}
diff --git a/src/services/Services.java b/src/main/java/za/net/chat/jt/actions/services/Services.java
old mode 100755
new mode 100644
similarity index 88%
rename from src/services/Services.java
rename to src/main/java/za/net/chat/jt/actions/services/Services.java
index a61323a..a1300de
--- a/src/services/Services.java
+++ b/src/main/java/za/net/chat/jt/actions/services/Services.java
@@ -1,70 +1,71 @@
-package services;
-
-import org.springframework.transaction.annotation.Transactional;
-import org.hibernate.SessionFactory;
-import org.hibernate.Session;
-import data.*;
-import java.util.List;
-
-// This class is the business services tier in the application.
-// @Transactional is needed so that a Hibernate transaction is set up,
-// otherwise updates won't have an affect
-@Transactional
-public class Services {
- // So Spring can inject the session factory
- SessionFactory sessionFactory;
- public void setSessionFactory(SessionFactory value) {
- sessionFactory = value;
- }
-
- // Shortcut for sessionFactory.getCurrentSession()
- public Session sess() {
- return sessionFactory.getCurrentSession();
- }
-
- public Event getEventById(long id) {
- return (Event) sess().load(Event.class, id);
- }
-
- public Person getPersonById(long id) {
- return (Person) sess().load(Person.class, id);
- }
-
- public void deleteEventById(long id) {
- sess().delete(getEventById(id));
- }
-
- public void deletePersonById(long id) {
- sess().delete(getPersonById(id));
- }
-
- public void createEvent(String name) {
- Event theEvent = new Event();
- theEvent.setName(name);
- sess().save(theEvent);
- }
-
- public void createPerson(String name) {
- Person p = new Person();
- p.setName(name);
- sess().save(p);
- }
-
- @SuppressWarnings("unchecked")
- public List getEvents() {
- return sess().createQuery("from Event").list();
- }
-
- @SuppressWarnings("unchecked")
- public List getPeople() {
- return sess().createQuery("from Person").list();
- }
-
- public void removePersonFromEvent(int personId, int eventId) {
- getEventById(eventId).getPeople().remove(getPersonById(personId));
- }
-
- public void addPersonToEvent(int personId, int eventId) {
- getEventById(eventId).getPeople().add(getPersonById(personId));
- }
-}
+package za.net.chat.jt.actions.services;
+
+import org.springframework.transaction.annotation.Transactional;
+import org.hibernate.SessionFactory;
+import org.hibernate.Session;
+import za.net.chat.jt.actions.data.*;
+import java.util.List;
+
+// This class is the business za.net.chat.jt.actions.services tier in the application.
+// @Transactional is needed so that a Hibernate transaction is set up,
+// otherwise updates won't have an affect
+@Transactional
+public class Services {
+ // So Spring can inject the session factory
+ SessionFactory sessionFactory;
+ public void setSessionFactory(SessionFactory value) {
+ sessionFactory = value;
+ }
+
+ // Shortcut for sessionFactory.getCurrentSession()
+ public Session sess() {
+ return sessionFactory.getCurrentSession();
+ }
+
+ public Event getEventById(long id) {
+ return (Event) sess().load(Event.class, id);
+ }
+
+ public Person getPersonById(long id) {
+ return (Person) sess().load(Person.class, id);
+ }
+
+ public void deleteEventById(long id) {
+ sess().delete(getEventById(id));
+ }
+
+ public void deletePersonById(long id) {
+ sess().delete(getPersonById(id));
+ }
+
+ public void createEvent(String name) {
+ Event theEvent = new Event();
+ theEvent.setName(name);
+ sess().save(theEvent);
+ }
+
+ public void createPerson(String name) {
+ Person p = new Person();
+ p.setName(name);
+ sess().save(p);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getEvents() {
+ System.out.println("HERE:"+sess().toString());
+ return sess().createQuery("from Event").list();
+ }
+
+ @SuppressWarnings("unchecked")
+ public List getPeople() {
+ return sess().createQuery("from Person").list();
+ }
+
+ public void removePersonFromEvent(int personId, int eventId) {
+ getEventById(eventId).getPeople().remove(getPersonById(personId));
+ }
+
+ public void addPersonToEvent(int personId, int eventId) {
+ getEventById(eventId).getPeople().add(getPersonById(personId));
+ }
+}
diff --git a/src/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml
old mode 100755
new mode 100644
similarity index 53%
rename from src/hibernate.cfg.xml
rename to src/main/resources/hibernate.cfg.xml
index 277f945..cf78b8e
--- a/src/hibernate.cfg.xml
+++ b/src/main/resources/hibernate.cfg.xml
@@ -1,31 +1,33 @@
-
-
-
-
-
- net.sourceforge.jtds.jdbc.Driver
- jdbc:jtds:sqlserver://my-database-server/LearnJavaHibernate
- LearnJavaHibernate
- LearnJavaHibernate
- org.hibernate.dialect.SQLServerDialect
-
-
- org.hibernate.connection.C3P0ConnectionProvider
- 100
- 1
- 30
-
-
- true
-
-
-
-
-
+
+
+
+
+
+ com.mysql.jdbc.Driver
+ jdbc:mysql://localhost:3306/events
+ events
+ events
+ events
+ org.hibernate.dialect.MySQLDialect
+ true
+
+ org.hibernate.c3p0.internal.C3P0ConnectionProvider
+ 100
+ 1
+ 30
+
+
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/src/log4j.properties b/src/main/resources/log4j.properties
old mode 100755
new mode 100644
similarity index 75%
rename from src/log4j.properties
rename to src/main/resources/log4j.properties
index 49cf80a..32d9dbb
--- a/src/log4j.properties
+++ b/src/main/resources/log4j.properties
@@ -1,6 +1,7 @@
-# Output at info level, to the appender called 'A'. Debug has too much logging.
-log4j.rootLogger=info, A
-# Configure the appender called 'A'
-log4j.appender.A=org.apache.log4j.ConsoleAppender
-log4j.appender.A.layout=org.apache.log4j.PatternLayout
-log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+# Output at info level, to the appender called 'A'. Debug has too much logging.
+log4j.rootLogger=INFO, A
+# Configure the appender called 'A'
+log4j.appender.A=org.apache.log4j.ConsoleAppender
+log4j.appender.A.layout=org.apache.log4j.PatternLayout
+log4j.appender.A.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+log4j.org.springframework.orm.hibernate4.LocalSessionFactoryBean=DEBUG
\ No newline at end of file
diff --git a/src/struts.xml b/src/main/resources/struts.xml
old mode 100755
new mode 100644
similarity index 87%
rename from src/struts.xml
rename to src/main/resources/struts.xml
index c35db2a..6cdc9bc
--- a/src/struts.xml
+++ b/src/main/resources/struts.xml
@@ -1,29 +1,29 @@
-
-
-
-
-
-
-
-
- /views/events/{1}.jsp
- ${redirectUrl}
-
-
-
-
-
- /views/people/{1}.jsp
- ${redirectUrl}
-
-
-
-
-
- events/Listing.action
-
-
-
-
+
+
+
+
+
+
+
+
+ /views/events/{1}.jsp
+ ${redirectUrl}
+
+
+
+
+
+ /views/people/{1}.jsp
+ ${redirectUrl}
+
+
+
+
+
+ events/Listing.action
+
+
+
+
diff --git a/WebContent/WEB-INF/applicationContext.xml b/src/main/webapp/WEB-INF/applicationContext.xml
old mode 100755
new mode 100644
similarity index 51%
rename from WebContent/WEB-INF/applicationContext.xml
rename to src/main/webapp/WEB-INF/applicationContext.xml
index 5a73f9b..7f6fea6
--- a/WebContent/WEB-INF/applicationContext.xml
+++ b/src/main/webapp/WEB-INF/applicationContext.xml
@@ -1,34 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WebContent/WEB-INF/decorators.xml b/src/main/webapp/WEB-INF/decorators.xml
old mode 100755
new mode 100644
similarity index 96%
rename from WebContent/WEB-INF/decorators.xml
rename to src/main/webapp/WEB-INF/decorators.xml
index a5139fc..b78ce51
--- a/WebContent/WEB-INF/decorators.xml
+++ b/src/main/webapp/WEB-INF/decorators.xml
@@ -1,6 +1,6 @@
-
-
-
- /*
-
-
+
+
+
+ /*
+
+
diff --git a/WebContent/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml
old mode 100755
new mode 100644
similarity index 93%
rename from WebContent/WEB-INF/web.xml
rename to src/main/webapp/WEB-INF/web.xml
index f5d67ec..83372d7
--- a/WebContent/WEB-INF/web.xml
+++ b/src/main/webapp/WEB-INF/web.xml
@@ -1,40 +1,41 @@
-
-
- Events
-
-
-
- org.springframework.web.context.ContextLoaderListener
-
-
- openSessionInViewFilter
- org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
-
-
- openSessionInViewFilter
- /*
-
-
-
-
- sitemesh
- com.opensymphony.sitemesh.webapp.SiteMeshFilter
-
-
- sitemesh
- /*
-
-
-
-
- struts2
- org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
-
-
- struts2
- /*
-
-
-
+
+
+ Events
+
+
+
+ org.springframework.web.context.ContextLoaderListener
+
+
+
+ openSessionInViewFilter
+ org.springframework.orm.hibernate4.support.OpenSessionInViewFilter
+
+
+ openSessionInViewFilter
+ /*
+
+
+
+
+ sitemesh
+ com.opensymphony.sitemesh.webapp.SiteMeshFilter
+
+
+ sitemesh
+ /*
+
+
+
+
+ struts2
+ org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
+
+
+ struts2
+ /*
+
+
+
diff --git a/WebContent/assets/alpha-b.png b/src/main/webapp/assets/alpha-b.png
old mode 100755
new mode 100644
similarity index 100%
rename from WebContent/assets/alpha-b.png
rename to src/main/webapp/assets/alpha-b.png
diff --git a/WebContent/assets/alpha-w.png b/src/main/webapp/assets/alpha-w.png
old mode 100755
new mode 100644
similarity index 100%
rename from WebContent/assets/alpha-w.png
rename to src/main/webapp/assets/alpha-w.png
diff --git a/WebContent/assets/bg.jpg b/src/main/webapp/assets/bg.jpg
old mode 100755
new mode 100644
similarity index 100%
rename from WebContent/assets/bg.jpg
rename to src/main/webapp/assets/bg.jpg
diff --git a/WebContent/assets/styles.css b/src/main/webapp/assets/styles.css
old mode 100755
new mode 100644
similarity index 93%
rename from WebContent/assets/styles.css
rename to src/main/webapp/assets/styles.css
index 3a76529..1fedfe2
--- a/WebContent/assets/styles.css
+++ b/src/main/webapp/assets/styles.css
@@ -1,80 +1,80 @@
-html, body, p, h1, h2, h3 {
- margin:0;
- border:0;
- padding:0;
-}
-body {
- background:black url(bg.jpg) center top no-repeat;
- color:white;
- font-family:trebuchet ms;
- width:800px;
- margin:auto;
-}
-.header {
- height:100px;
- line-height:100px;
- padding-left:10px;
-}
-
-.tabs {
- height:30px;
- line-height:30px;
-}
-.tabs a {
- float:left;
- background: url(alpha-b.png);
- padding: 0 5px 0 5px;
- margin-right:10px;
- color: white;
-}
-.tabs a.s {
- background: url(alpha-w.png);
-}
-.tabs-under {
- color:black;
-}
-.tabs-under a {
- color:black;
- line-height:30px;
- padding-left:5px;
-}
-.tabs-under-bg {
- background: url(alpha-w.png);
- position:absolute;
- left:0;
- width:100%;
- height:30px;
- z-index:-1;
-}
-.tabs a, .tabs-under a {
- font-weight:bold;
- text-decoration:none;
-}
-.tabs a:hover, .tabs-under a:hover {
- text-decoration:underline;
-}
-.bodyhead {
- margin-top: 20px;
- height:40px;
- line-height:40px;
- background: url(alpha-b.png);
- padding-left:10px;
-}
-.body {
- background:white;
- color:black;
- padding:5px;
-}
-
-input {
- padding: 5px;
-}
-.body a {
- color:black;
-}
-.body a:hover {
- background:yellow;
-}
-form {
- display:inline;
+html, body, p, h1, h2, h3 {
+ margin:0;
+ border:0;
+ padding:0;
+}
+body {
+ background:black url(bg.jpg) center top no-repeat;
+ color:white;
+ font-family:trebuchet ms;
+ width:800px;
+ margin:auto;
+}
+.header {
+ height:100px;
+ line-height:100px;
+ padding-left:10px;
+}
+
+.tabs {
+ height:30px;
+ line-height:30px;
+}
+.tabs a {
+ float:left;
+ background: url(alpha-b.png);
+ padding: 0 5px 0 5px;
+ margin-right:10px;
+ color: white;
+}
+.tabs a.s {
+ background: url(alpha-w.png);
+}
+.tabs-under {
+ color:black;
+}
+.tabs-under a {
+ color:black;
+ line-height:30px;
+ padding-left:5px;
+}
+.tabs-under-bg {
+ background: url(alpha-w.png);
+ position:absolute;
+ left:0;
+ width:100%;
+ height:30px;
+ z-index:-1;
+}
+.tabs a, .tabs-under a {
+ font-weight:bold;
+ text-decoration:none;
+}
+.tabs a:hover, .tabs-under a:hover {
+ text-decoration:underline;
+}
+.bodyhead {
+ margin-top: 20px;
+ height:40px;
+ line-height:40px;
+ background: url(alpha-b.png);
+ padding-left:10px;
+}
+.body {
+ background:white;
+ color:black;
+ padding:5px;
+}
+
+input {
+ padding: 5px;
+}
+.body a {
+ color:black;
+}
+.body a:hover {
+ background:yellow;
+}
+form {
+ display:inline;
}
\ No newline at end of file
diff --git a/WebContent/sitemesh/main.jsp b/src/main/webapp/sitemesh/main.jsp
old mode 100755
new mode 100644
similarity index 97%
rename from WebContent/sitemesh/main.jsp
rename to src/main/webapp/sitemesh/main.jsp
index c6700c9..12dc702
--- a/WebContent/sitemesh/main.jsp
+++ b/src/main/webapp/sitemesh/main.jsp
@@ -1,50 +1,50 @@
-<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
-
-
-
-
-
-
-
-
-
-
-
-My Events -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+<%@ taglib uri="http://www.opensymphony.com/sitemesh/decorator" prefix="decorator" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+
+
+
+
+
+
+
+
+
+
+
+My Events -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebContent/views/events/Attendance.jsp b/src/main/webapp/views/events/Attendance.jsp
old mode 100755
new mode 100644
similarity index 96%
rename from WebContent/views/events/Attendance.jsp
rename to src/main/webapp/views/events/Attendance.jsp
index fe90eec..644231b
--- a/WebContent/views/events/Attendance.jsp
+++ b/src/main/webapp/views/events/Attendance.jsp
@@ -1,50 +1,50 @@
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-
-
-
-
-
-Current attendees
-
-
-
-
-
-
-
-
-
- There are no attendees
-
-
-Add attendees
-
-
-
-
-
-
-
-
-
- There is no one left to add
-
-
-Close
-
-
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+
+
+
+
+
+Current attendees
+
+
+
+
+
+
+
+
+
+ There are no attendees
+
+
+Add attendees
+
+
+
+
+
+
+
+
+
+ There is no one left to add
+
+
+Close
+
+
\ No newline at end of file
diff --git a/WebContent/views/events/Delete.jsp b/src/main/webapp/views/events/Delete.jsp
old mode 100755
new mode 100644
similarity index 96%
rename from WebContent/views/events/Delete.jsp
rename to src/main/webapp/views/events/Delete.jsp
index 0c11b2e..b682273
--- a/WebContent/views/events/Delete.jsp
+++ b/src/main/webapp/views/events/Delete.jsp
@@ -1,24 +1,24 @@
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-
-Delete an event
-
-
-
-
- Are you sure you wish to delete this event?
-
-
-
-
-
-
-Cancel
-
-
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+
+Delete an event
+
+
+
+
+ Are you sure you wish to delete this event?
+
+
+
+
+
+
+Cancel
+
+
\ No newline at end of file
diff --git a/WebContent/views/events/Listing.jsp b/src/main/webapp/views/events/Listing.jsp
old mode 100755
new mode 100644
similarity index 97%
rename from WebContent/views/events/Listing.jsp
rename to src/main/webapp/views/events/Listing.jsp
index 09cf6b6..3a6259d
--- a/WebContent/views/events/Listing.jsp
+++ b/src/main/webapp/views/events/Listing.jsp
@@ -1,26 +1,26 @@
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-All events
-
-
-
-
-
-
-
-
-
-
-
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+All events
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebContent/views/events/New.jsp b/src/main/webapp/views/events/New.jsp
old mode 100755
new mode 100644
similarity index 96%
rename from WebContent/views/events/New.jsp
rename to src/main/webapp/views/events/New.jsp
index 3f6184c..8f082e8
--- a/WebContent/views/events/New.jsp
+++ b/src/main/webapp/views/events/New.jsp
@@ -1,19 +1,19 @@
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-
-Create a new Event
-
-
-
-
-
-
-
-
-
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+
+Create a new Event
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebContent/views/people/Delete.jsp b/src/main/webapp/views/people/Delete.jsp
old mode 100755
new mode 100644
similarity index 96%
rename from WebContent/views/people/Delete.jsp
rename to src/main/webapp/views/people/Delete.jsp
index 61d0555..1a3805d
--- a/WebContent/views/people/Delete.jsp
+++ b/src/main/webapp/views/people/Delete.jsp
@@ -1,24 +1,24 @@
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-
-Delete a person
-
-
-
-
- Are you sure you wish to delete this person?
-
-
-
-
-
-
-Cancel
-
-
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+
+Delete a person
+
+
+
+
+ Are you sure you wish to delete this person?
+
+
+
+
+
+
+Cancel
+
+
\ No newline at end of file
diff --git a/WebContent/views/people/Listing.jsp b/src/main/webapp/views/people/Listing.jsp
old mode 100755
new mode 100644
similarity index 96%
rename from WebContent/views/people/Listing.jsp
rename to src/main/webapp/views/people/Listing.jsp
index 7fb810c..33901e5
--- a/WebContent/views/people/Listing.jsp
+++ b/src/main/webapp/views/people/Listing.jsp
@@ -1,23 +1,23 @@
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-
-All people
-
-
-
-
-
-
-
-
-
-
-
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+
+All people
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WebContent/views/people/New.jsp b/src/main/webapp/views/people/New.jsp
old mode 100755
new mode 100644
similarity index 96%
rename from WebContent/views/people/New.jsp
rename to src/main/webapp/views/people/New.jsp
index eb2811f..292f652
--- a/WebContent/views/people/New.jsp
+++ b/src/main/webapp/views/people/New.jsp
@@ -1,18 +1,18 @@
-<%@ taglib prefix="s" uri="/struts-tags" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-New Person
-
-
-
-
-
-
-
-
-
-
+<%@ taglib prefix="s" uri="/struts-tags" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+New Person
+
+
+
+
+
+
+
+
+
+