= Tomcat =
Apache Tomcat is an open source software implementation of the Java Servlet and JavaServer Pages technologies.
== Installation on Slackware ==
* cd ~/Downloads
* wget http://mirrors.fe.up.pt/pub/apache/tomcat/tomcat-7/v7.0.53/bin/apache-tomcat-7.0.53.tar.gz
* su
* cp apache-tomcat-7.0.53.tar.gz /opt
* cd /opt
* tar xvzf apache-tomcat-7.0.53.tar.gz
* chown vitor * -R
* chgrp users * -R
* exit
== Start Tomcat ==
/opt/apache-tomcat-7.0.53/bin/
./startup.sh
http://localhost:8080/
== Add admin user ==
* cd /opt/apache-tomcat-7.0.53/conf
Edit tomcat-users.xml
{{{
SMTP_PASSWORD
java.lang.String
abc123ftw
}}}
Get values in code
{{{#!highlight java
// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
// Look up our data source
String s = (String)envCtx.lookup("SMTP_PASSWORD");
}}}