Commit bdca11bd authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading
+4 −0
Changes for 1605_Code/1605_01_code_final/README.txt: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
This directory contains examples mentioned in recipes. Each directory is named with the recipe<chapter><recipe> convention.

Each recipe is structure like a standard maven2 project and was created using Wicket's quickstart maven2 archetype. Please see here: http://wicket.apache.org/quickstart.html for details.
+133 −0
Changes for 1605_Code/1605_01_code_final/recipe0101/pom.xml: 133 added lines, 0 removed lines.
Original line number Diff line number Diff line
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>cookbook</groupId>
	<artifactId>recipe0101</artifactId>
	<packaging>war</packaging>
	<version>1.0-SNAPSHOT</version>
	<!-- TODO project name  -->
	<name>quickstart</name>
	<description></description>
	<!--
		TODO <organization> <name>company name</name> <url>company url</url>
		</organization>
	-->
	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>
	<dependencies>
		<!--  WICKET DEPENDENCIES -->
		<dependency>
			<groupId>org.apache.wicket</groupId>
			<artifactId>wicket</artifactId>
			<version>${wicket.version}</version>
		</dependency>
		<!--
			OPTIONAL <dependency> <groupId>org.apache.wicket</groupId>
			<artifactId>wicket-extensions</artifactId>
			<version>${wicket.version}</version> </dependency>
		-->

		<!-- LOGGING DEPENDENCIES - LOG4J -->
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
			<version>1.4.2</version>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.14</version>
		</dependency>

		<!--  JUNIT DEPENDENCY FOR TESTING -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.2</version>
			<scope>test</scope>
		</dependency>

		<!--  JETTY DEPENDENCIES FOR TESTING  -->
		<dependency>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>jetty</artifactId>
			<version>${jetty.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>jetty-util</artifactId>
			<version>${jetty.version}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.mortbay.jetty</groupId>
			<artifactId>jetty-management</artifactId>
			<version>${jetty.version}</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	<build>
		<resources>
			<resource>
				<filtering>false</filtering>
				<directory>src/main/resources</directory>
			</resource>
			<resource>
				<filtering>false</filtering>
				<directory>src/main/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<filtering>false</filtering>
				<directory>src/test/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<inherited>true</inherited>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.5</source>
					<target>1.5</target>
					<optimize>true</optimize>
					<debug>true</debug>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>maven-jetty-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<configuration>
					<downloadSources>true</downloadSources>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<properties>
		<wicket.version>1.4.9</wicket.version>
		<jetty.version>6.1.4</jetty.version>
	</properties>
	</project>
+20 −0
Changes for 1605_Code/1605_01_code_final/recipe0101/src/main/java/cookbook/HomePage.html: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
<html xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd" >
	<head>
		<style>
			body { font-family: Arial; font-size: .8em; }
			h1 { font-size: .9em; font-weight:bold; }
			label { background-color: #eee; padding: .4em; width:9em; display: block; float: left; }
			.feedbackPanelERROR { color: red; }
		</style>
	</head>
    <body>
    	<h1>User Registration</h1>
    	<div wicket:id="feedback"></div>
        <form wicket:id="form">
        	<p><label>Username</label>: <input wicket:id="username" type="text" size="20"/></p>
        	<p><label>Password</label>: <input wicket:id="password1" type="password" size="20"/></p>
        	<p><label>Confirm Password</label>: <input wicket:id="password2" type="password" size="20"/></p>
        	<input type="submit" value="Register"/>
        </form>
    </body>
</html>
+37 −0
Changes for 1605_Code/1605_01_code_final/recipe0101/src/main/java/cookbook/HomePage.java: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
package cookbook;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.PasswordTextField;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.Model;

public class HomePage extends WebPage {

  public HomePage(final PageParameters parameters) {
    add(new FeedbackPanel("feedback"));

    TextField< ? > username = new TextField<String>("username", new Model<String>());
    username.setRequired(true);

    FormComponent< ? > password1 = new PasswordTextField("password1", new Model<String>());
    FormComponent< ? > password2 = new PasswordTextField("password2", new Model<String>());

    Form< ? > form = new Form<Void>("form") {
      @Override
      protected void onSubmit() {
        info("Form successfully submitted");
      }
    };

    form.add(new SameValueValidator(password1, password2));

    add(form);
    form.add(username);
    form.add(password1);
    form.add(password2);
  }
}
+1 −0
Changes for 1605_Code/1605_01_code_final/recipe0101/src/main/java/cookbook/HomePage.properties: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
SameValueValidator=The passwords entered do not match
 No newline at end of file
Loading