Updated Ticket Monster Tutorial! 2.whatever.

My co-worker Matt found this for us.
Hopefully this saves us a lot of trouble shooting.
I had to make a lot of judgement calls on compatibility.
I am actually surprised I made it all the way to chapter 9 with all the difficulties I had.


There are no JREs installed in the workspace that are strictly compatible with this environment.

<!– http://stackoverflow.com/questions/3539139
-to-use-java-1-5-instead-of-java-1-6-b –>
<!– There are no JREs installed in the
workspace that are strictly compatible with
this environment. –>

De-Abbreviate: JPA, CDI, EJB, JAX-RS, CRUD, JSF, GWT

JPA = Java Persistance Programming
CDI = Contexts and Dependency Injection (@annotations)
EJB = Enterprise Java Beans
Server side software component that
encapsulates the business logic of an application.
JAX-RS = Java API for RESTFul web services… (Where is the X?)
@Path, @GET, @PUT, @POST, @DELETE, @HEAD (HTTP request type)
@PathParam, @QueryParam, @MatrixParam… (Other binding)
CRUD   = HTTP REST for Database records. (Passive entities)
“Create, Read, Update, Delete”
JSF    = Java Server Faces. (Standard for building server-side user interfaces)
GWT    = “Google Web Toolkit?”
GWT is a development toolkit for building and optimizing
complex browser-based applications.
JACKSON JSON: Library for automated serialization and de-serialization of java

Maven Command Line org.joda.time.LocalTime

Maven COMMAND LINE Quick Reference:

Lets say your class is located in:
And that your HelloWorld.java package declaration was:
package hello;

Compile, package, and run, if you have NO library dependencies:
COMPILE: https://spring.io/guides/gs/maven/
RUN: https://www.youtube.com/watch?v=20U2aLtWYu8&list=PLN4rUakF78aB0dpR0_ngbldjzcC6qsXRt
mvn compile
mvn package
cd C:/PRJ_ROOT/classes/
java -cp . hello.HelloWorld
//NOTE: Directory is NOT C:/PRJ_ROOT/classes/hello because
//We need to have cd point to root of where package starts.

//IF YOU HAVE DEPENDENCIES in your project, running this way will NOT work
//Well, it could if you hand-paste the .jar files you need into the class folder.
But that defeats the point of maven being a build tool if you are going to do something manual like that.

The example at: https://spring.io/guides/gs/maven/
That uses: import org.joda.time.LocalTime;
Will not run using:
java -cp . hello.HelloWorld

Run maven build when you have library dependencies:
SOURCE: http://www.vineetmanohar.com/2009/11/3-ways-to-run-java-main-from-maven/
Step1: Move project root on command line:
I.g: cd C:/PRJ_ROOT

Step2: Choose how you would like to run:
Without arguments:
mvn exec:java -Dexec.mainClass=”hello.HelloWorld”

With arguments:
mvn exec:java -Dexec.mainClass=”hello.HelloWorld” -Dexec.args=”arg0 arg1 arg2″

With runtime dependencies in the CLASSPATH:
mvn exec:java -Dexec.mainClass=”hello.HelloWorld” -Dexec.classpathScope=runtime

Spring MVC Controllers are singletons

Spring MVC Controllers are singletons

This means, I can’t store session/state information in them…
How do I do that? I am about to give up and do a JAVASCRIPT front end
for now…

Confirming that spring MVC controllers are singletons:
What do you do when you have more than one user on them?

Server vs Servlet?


this is interesting:
In MVC, Jsp acts and a view and a servlet acts as a controller.
JSP can run JavaScript.
(So JSP + AJAX == YES??)

in short: servlets should be used if you have more java than HTML and JSP should be used if you have more HTML than java

A JSP technically gets converted to a servlet but it looks more like PHP files where you embed the java into HTML.

is very common to combine servlets and JSP so that the initial request gets sent to a servlet which does some java work and then forwards it to a JSP which actually makes the HTML output.

A Servlet is mainly used to extend the functionality of server while JSP serve as the view.

This also:

Question: Do servlets run on the same server?