jump to navigation

Data mapper January 22, 2008

Posted by Coolguy in Java, Java Frameworks.
Tags:
add a comment

Data mapper moves the data between objects and database keeping them independent of each other.

With Data Mapper the in-memory objects needn’t know even that there’s a database present; they need no SQL interface code, and certainly no knowledge of the database schema

Advertisements

Active record January 22, 2008

Posted by Coolguy in Java, Java Frameworks.
Tags:
add a comment

An object that wraps a row in a database table or view, encapsulates the database access, and adds domain logic on that data.

Simple MVC Example August 22, 2005

Posted by Coolguy in Java Frameworks.
add a comment

Simple MVC Example

HTML Form:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>Insert title here</title>
</head>
<form method=”POST” action=”/BeerApp/SelectBeer.do”>
<body><strong>Selection Page<br></strong><br>
Select Characteristics
<select name=”colour”>
<option> Pale
<option> Brown
<option> Light
<option> Amber
</select>
<input type=”submit”>
</form>
</body>
</html>

Web.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app id=”WebApp_ID”>
<display-name>
BeerApp</display-name>
<servlet>
<description></description>
<display-name>BeerSelect</display-name>
<servlet-name>BeerSelect</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>BeerSelect</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

Servlet
package com.example.web;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.example.model.BeerExpert;

public class BeerSelect extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
public BeerSelect() {
super();
}


protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}


protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(“text/html”);
PrintWriter out= response.getWriter();
out.println(“Advice”);
String selection=request.getParameter(“colour”);
out.println(“Colour you chose was: ” + selection);

BeerExpert be = new BeerExpert();
List c= be.getBrands(selection);

request.setAttribute(“styles”,c);
RequestDispatcher view= request.getRequestDispatcher(“result.jsp”);
view.forward(request,response);


}
}

Model

package com.example.model;
import java.util.ArrayList;
import java.util.List;

public class BeerExpert
{

public List getBrands(String colour)
{
List brands = new ArrayList();
if (colour.equals(“light”))
{
brands.add(“Fosters”);
brands.add(“bud”);
}
else
{
brands.add(“Jack”);
brands.add(“jill”);
}
return brands;

}
}

JSP
<%@ page language=”java” contentType=”text/html; charset=ISO-8859-1″ pageEncoding=”ISO-8859-1″%>
<%@ page import=”java.util.*” %>

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=ISO-8859-1″>
<title>Insert title here</title>
</head>
<body>
<%
List styles = (List)request.getAttribute(“styles”);
Iterator it = styles.iterator();
while(it.hasNext())
out.println(“try ” + it.next());
%>

</body>
</html>

test July 22, 2005

Posted by Coolguy in Java Frameworks.
add a comment

TheServerSide.com – Test Framework Comparison July 19, 2005

Posted by Coolguy in Java Frameworks.
Tags:
add a comment

TheServerSide.com – Test Framework Comparison

TheServerSide.com – Tuning Your Stress Test Harness June 23, 2005

Posted by Coolguy in Java Frameworks.
Tags:
add a comment

TheServerSide.com – Tuning Your Stress Test Harness

Manageability – Open Source Automated Test Tools Written in Java May 6, 2005

Posted by Coolguy in Java Frameworks.
Tags:
add a comment

Manageability – Open Source Automated Test Tools Written in Java

TheServerSide.com – Test-Driven Development Series Part I – Overview May 6, 2005

Posted by Coolguy in Java Frameworks.
Tags:
add a comment

TheServerSide.com – Test-Driven Development Series Part I – Overview

scheduler written in Java November 25, 2004

Posted by Coolguy in Java Frameworks.
add a comment

jcrontab

quartz

A few products I used … November 12, 2004

Posted by Coolguy in Java Frameworks.
add a comment

ServletExec: For those who cant stand tomcat…

SecurID: Two factor authentication solution from RSA.

NetApp netcache: Good for caching….

Cisco PIX: Firewall…

Radware support FAQ