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.
http://docs.jboss.org/jbossdeveloper/2.1/ticket-monster-2.1.0.Final.pdf

Advertisements

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

<!– http://stackoverflow.com/questions/3539139
/what-causes-a-new-maven-project-in-eclipse
-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. –>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>

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
objects.

Maven Command Line org.joda.time.LocalTime

Maven COMMAND LINE Quick Reference:


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


Compile, package, and run, if you have NO library dependencies:
SOURCES:
COMPILE: https://spring.io/guides/gs/maven/
RUN: https://www.youtube.com/watch?v=20U2aLtWYu8&list=PLN4rUakF78aB0dpR0_ngbldjzcC6qsXRt
cd C:/PRJ_ROOT
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
http://stackoverflow.com/questions/11508405/are-spring-mvc-controllers-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?
http://stackoverflow.com/questions/15836136/more-than-one-user-in-the-same-controller-spring-mvc

Server vs Servlet?

http://stackoverflow.com/questions/5039354/difference-between-an-application-server-and-a-servlet-container

this is interesting:
http://stackoverflow.com/questions/4965914/java-jsp-vs-servlet
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:
http://www.differencebetween.net/technology/difference-between-jsp-and-servlet/

Question: Do servlets run on the same server?