BAEL-1112 - Apache Tapestry
This commit is contained in:
parent
6804dc9b19
commit
90da38847e
@ -1,45 +1,16 @@
|
|||||||
package com.baeldung.tapestry.components;
|
package com.baeldung.tapestry.components;
|
||||||
|
|
||||||
import org.apache.tapestry5.BindingConstants;
|
import org.apache.tapestry5.BindingConstants;
|
||||||
import org.apache.tapestry5.ComponentResources;
|
|
||||||
import org.apache.tapestry5.SymbolConstants;
|
|
||||||
import org.apache.tapestry5.annotations.Import;
|
|
||||||
import org.apache.tapestry5.annotations.Parameter;
|
import org.apache.tapestry5.annotations.Parameter;
|
||||||
import org.apache.tapestry5.annotations.Property;
|
import org.apache.tapestry5.annotations.Property;
|
||||||
import org.apache.tapestry5.ioc.annotations.Inject;
|
|
||||||
import org.apache.tapestry5.ioc.annotations.Symbol;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Layout component for pages of application test-project.
|
* Layout component for pages of application.
|
||||||
*/
|
*/
|
||||||
@Import(module = "bootstrap/collapse")
|
|
||||||
public class Layout {
|
public class Layout {
|
||||||
|
|
||||||
@Inject
|
@Property
|
||||||
private ComponentResources resources;
|
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
|
||||||
|
private String title;
|
||||||
/**
|
|
||||||
* The page title, for the <title> element and the
|
|
||||||
* <h1>element.
|
|
||||||
*/
|
|
||||||
@Property
|
|
||||||
@Parameter(required = true, defaultPrefix = BindingConstants.LITERAL)
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
@Property
|
|
||||||
private String pageName;
|
|
||||||
|
|
||||||
@Property
|
|
||||||
@Inject
|
|
||||||
@Symbol(SymbolConstants.APPLICATION_VERSION)
|
|
||||||
private String appVersion;
|
|
||||||
|
|
||||||
public String getClassForPageName() {
|
|
||||||
return resources.getPageName().equalsIgnoreCase(pageName) ? "active" : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getPageNames() {
|
|
||||||
return new String[] { "Index", "About", "Contact" };
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
package com.baeldung.tapestry.pages;
|
|
||||||
|
|
||||||
import org.apache.tapestry5.annotations.PageActivationContext;
|
|
||||||
|
|
||||||
public class About {
|
|
||||||
|
|
||||||
@PageActivationContext
|
|
||||||
private String learn;
|
|
||||||
|
|
||||||
public String getLearn() {
|
|
||||||
return learn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLearn(String learn) {
|
|
||||||
this.learn = learn;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.baeldung.tapestry.pages;
|
|
||||||
|
|
||||||
public class Contact {
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,36 @@
|
|||||||
|
package com.baeldung.tapestry.pages;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.apache.tapestry5.Block;
|
||||||
|
import org.apache.tapestry5.annotations.Log;
|
||||||
|
import org.apache.tapestry5.annotations.Property;
|
||||||
|
import org.apache.tapestry5.ioc.annotations.Inject;
|
||||||
|
import org.apache.tapestry5.services.ajax.AjaxResponseRenderer;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
|
public class Home {
|
||||||
|
|
||||||
|
@Property
|
||||||
|
private String appName = "apache-tapestry";
|
||||||
|
|
||||||
|
public Date getCurrentTime() {
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Logger logger;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private AjaxResponseRenderer ajaxResponseRenderer;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Block ajaxBlock;
|
||||||
|
|
||||||
|
@Log
|
||||||
|
void onCallAjax() {
|
||||||
|
logger.info("Ajax call");
|
||||||
|
ajaxResponseRenderer.addRender("ajaxZone", ajaxBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -19,50 +19,41 @@ import java.util.Date;
|
|||||||
* Start page of application apache-tapestry.
|
* Start page of application apache-tapestry.
|
||||||
*/
|
*/
|
||||||
public class Index {
|
public class Index {
|
||||||
@Inject
|
@Inject
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AjaxResponseRenderer ajaxResponseRenderer;
|
private AjaxResponseRenderer ajaxResponseRenderer;
|
||||||
|
|
||||||
@Property
|
@Property
|
||||||
@Inject
|
@Inject
|
||||||
@Symbol(SymbolConstants.TAPESTRY_VERSION)
|
@Symbol(SymbolConstants.TAPESTRY_VERSION)
|
||||||
private String tapestryVersion;
|
private String tapestryVersion;
|
||||||
|
|
||||||
@InjectPage
|
@Inject
|
||||||
private About about;
|
private Block block;
|
||||||
|
|
||||||
@Inject
|
// Handle call with an unwanted context
|
||||||
private Block block;
|
Object onActivate(EventContext eventContext) {
|
||||||
|
return eventContext.getCount() > 0 ?
|
||||||
|
new HttpError(404, "Resource not found") :
|
||||||
|
null;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle call with an unwanted context
|
@Log
|
||||||
Object onActivate(EventContext eventContext) {
|
void onComplete() {
|
||||||
return eventContext.getCount() > 0 ?
|
logger.info("Complete call on Index page");
|
||||||
new HttpError(404, "Resource not found") :
|
}
|
||||||
null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object onActionFromLearnMore() {
|
@Log
|
||||||
about.setLearn("LearnMore");
|
void onAjax() {
|
||||||
|
logger.info("Ajax call on Index page");
|
||||||
|
|
||||||
return about;
|
ajaxResponseRenderer.addRender("middlezone", block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log
|
public Date getCurrentTime() {
|
||||||
void onComplete() {
|
return new Date();
|
||||||
logger.info("Complete call on Index page");
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Log
|
|
||||||
void onAjax() {
|
|
||||||
logger.info("Ajax call on Index page");
|
|
||||||
|
|
||||||
ajaxResponseRenderer.addRender("middlezone", block);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCurrentTime() {
|
|
||||||
return new Date();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,51 +4,39 @@ import org.apache.tapestry5.alerts.AlertManager;
|
|||||||
import org.apache.tapestry5.annotations.InjectComponent;
|
import org.apache.tapestry5.annotations.InjectComponent;
|
||||||
import org.apache.tapestry5.annotations.Property;
|
import org.apache.tapestry5.annotations.Property;
|
||||||
import org.apache.tapestry5.corelib.components.Form;
|
import org.apache.tapestry5.corelib.components.Form;
|
||||||
import org.apache.tapestry5.corelib.components.PasswordField;
|
|
||||||
import org.apache.tapestry5.corelib.components.TextField;
|
|
||||||
import org.apache.tapestry5.ioc.annotations.Inject;
|
import org.apache.tapestry5.ioc.annotations.Inject;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
public class Login {
|
public class Login {
|
||||||
@Inject
|
@Inject
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AlertManager alertManager;
|
private AlertManager alertManager;
|
||||||
|
|
||||||
@InjectComponent
|
@InjectComponent
|
||||||
private Form login;
|
private Form login;
|
||||||
|
|
||||||
@InjectComponent("email")
|
@Property
|
||||||
private TextField emailField;
|
private String email;
|
||||||
|
|
||||||
@InjectComponent("password")
|
@Property
|
||||||
private PasswordField passwordField;
|
private String password;
|
||||||
|
|
||||||
@Property
|
void onValidateFromLogin() {
|
||||||
private String email;
|
if(email == null || password == null) {
|
||||||
|
alertManager.error("Email/Password is null");
|
||||||
|
login.recordError("Validation failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Property
|
Object onSuccessFromLogin() {
|
||||||
private String password;
|
alertManager.success("Welcome! Login Successful");
|
||||||
|
return Home.class;
|
||||||
|
}
|
||||||
|
|
||||||
void onValidateFromLogin() {
|
void onFailureFromLogin() {
|
||||||
if (!email.equals("users@tapestry.apache.org"))
|
alertManager.error("Please try again with correct credentials");
|
||||||
login.recordError(emailField, "Try with user: users@tapestry.apache.org");
|
}
|
||||||
|
|
||||||
if ( !password.equals("Tapestry5"))
|
|
||||||
login.recordError(passwordField, "Try with password: Tapestry5");
|
|
||||||
}
|
|
||||||
|
|
||||||
Object onSuccessFromLogin() {
|
|
||||||
logger.info("Login successful!");
|
|
||||||
alertManager.success("Welcome aboard!");
|
|
||||||
|
|
||||||
return Index.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
void onFailureFromLogin() {
|
|
||||||
logger.warn("Login error!");
|
|
||||||
alertManager.error("I'm sorry but I can't log you in!");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.baeldung.tapestry.services;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.tapestry5.*;
|
import org.apache.tapestry5.SymbolConstants;
|
||||||
import org.apache.tapestry5.ioc.MappedConfiguration;
|
import org.apache.tapestry5.ioc.MappedConfiguration;
|
||||||
import org.apache.tapestry5.ioc.OrderedConfiguration;
|
import org.apache.tapestry5.ioc.OrderedConfiguration;
|
||||||
import org.apache.tapestry5.ioc.ServiceBinder;
|
import org.apache.tapestry5.ioc.ServiceBinder;
|
||||||
@ -10,20 +10,18 @@ import org.apache.tapestry5.ioc.annotations.Contribute;
|
|||||||
import org.apache.tapestry5.ioc.annotations.Local;
|
import org.apache.tapestry5.ioc.annotations.Local;
|
||||||
import org.apache.tapestry5.ioc.services.ApplicationDefaults;
|
import org.apache.tapestry5.ioc.services.ApplicationDefaults;
|
||||||
import org.apache.tapestry5.ioc.services.SymbolProvider;
|
import org.apache.tapestry5.ioc.services.SymbolProvider;
|
||||||
import org.apache.tapestry5.services.*;
|
import org.apache.tapestry5.services.Request;
|
||||||
import org.apache.tapestry5.services.javascript.JavaScriptStack;
|
import org.apache.tapestry5.services.RequestFilter;
|
||||||
import org.apache.tapestry5.services.javascript.StackExtension;
|
import org.apache.tapestry5.services.RequestHandler;
|
||||||
import org.apache.tapestry5.services.javascript.StackExtensionType;
|
import org.apache.tapestry5.services.Response;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module is automatically included as part of the Tapestry IoC Registry, it's a good place to
|
* This module is automatically included as part of the Tapestry IoC Registry, it's a good place to
|
||||||
* configure and extend Tapestry, or to place your own service definitions.
|
* configure and extend Tapestry, or to place your own service definitions.
|
||||||
*/
|
*/
|
||||||
public class AppModule
|
public class AppModule {
|
||||||
{
|
public static void bind(ServiceBinder binder) {
|
||||||
public static void bind(ServiceBinder binder)
|
|
||||||
{
|
|
||||||
// binder.bind(MyServiceInterface.class, MyServiceImpl.class);
|
// binder.bind(MyServiceInterface.class, MyServiceImpl.class);
|
||||||
|
|
||||||
// Make bind() calls on the binder object to define most IoC services.
|
// Make bind() calls on the binder object to define most IoC services.
|
||||||
@ -33,8 +31,7 @@ public class AppModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void contributeFactoryDefaults(
|
public static void contributeFactoryDefaults(
|
||||||
MappedConfiguration<String, Object> configuration)
|
MappedConfiguration<String, Object> configuration) {
|
||||||
{
|
|
||||||
// The values defined here (as factory default overrides) are themselves
|
// The values defined here (as factory default overrides) are themselves
|
||||||
// overridden with application defaults by DevelopmentModule and QaModule.
|
// overridden with application defaults by DevelopmentModule and QaModule.
|
||||||
|
|
||||||
@ -48,8 +45,7 @@ public class AppModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void contributeApplicationDefaults(
|
public static void contributeApplicationDefaults(
|
||||||
MappedConfiguration<String, Object> configuration)
|
MappedConfiguration<String, Object> configuration) {
|
||||||
{
|
|
||||||
// Contributions to ApplicationDefaults will override any contributions to
|
// Contributions to ApplicationDefaults will override any contributions to
|
||||||
// FactoryDefaults (with the same key). Here we're restricting the supported
|
// FactoryDefaults (with the same key). Here we're restricting the supported
|
||||||
// locales to just "en" (English). As you add localised message catalogs and other assets,
|
// locales to just "en" (English). As you add localised message catalogs and other assets,
|
||||||
@ -57,23 +53,22 @@ public class AppModule
|
|||||||
// the first locale name is the default when there's no reasonable match).
|
// the first locale name is the default when there's no reasonable match).
|
||||||
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
|
configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en");
|
||||||
|
|
||||||
// You should change the passphrase immediately; the HMAC passphrase is used to secure
|
// You should change the passphrase immediately; the HMAC passphrase is used to secure
|
||||||
// the hidden field data stored in forms to encrypt and digitally sign client-side data.
|
// the hidden field data stored in forms to encrypt and digitally sign client-side data.
|
||||||
configuration.add(SymbolConstants.HMAC_PASSPHRASE, "change this immediately");
|
configuration.add(SymbolConstants.HMAC_PASSPHRASE, "change this immediately");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use annotation or method naming convention: <code>contributeApplicationDefaults</code>
|
* Use annotation or method naming convention: <code>contributeApplicationDefaults</code>
|
||||||
*/
|
*/
|
||||||
@Contribute(SymbolProvider.class)
|
@Contribute(SymbolProvider.class)
|
||||||
@ApplicationDefaults
|
@ApplicationDefaults
|
||||||
public static void setupEnvironment(MappedConfiguration<String, Object> configuration)
|
public static void setupEnvironment(MappedConfiguration<String, Object> configuration) {
|
||||||
{
|
|
||||||
// Support for jQuery is new in Tapestry 5.4 and will become the only supported
|
// Support for jQuery is new in Tapestry 5.4 and will become the only supported
|
||||||
// option in 5.5.
|
// option in 5.5.
|
||||||
configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery");
|
configuration.add(SymbolConstants.JAVASCRIPT_INFRASTRUCTURE_PROVIDER, "jquery");
|
||||||
configuration.add(SymbolConstants.BOOTSTRAP_ROOT, "context:mybootstrap");
|
configuration.add(SymbolConstants.BOOTSTRAP_ROOT, "context:mybootstrap");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,24 +89,19 @@ public class AppModule
|
|||||||
* a service named "RequestFilter" we use an explicit service id that we can reference
|
* a service named "RequestFilter" we use an explicit service id that we can reference
|
||||||
* inside the contribution method.
|
* inside the contribution method.
|
||||||
*/
|
*/
|
||||||
public RequestFilter buildTimingFilter(final Logger log)
|
public RequestFilter buildTimingFilter(final Logger log) {
|
||||||
{
|
return new RequestFilter() {
|
||||||
return new RequestFilter()
|
|
||||||
{
|
|
||||||
public boolean service(Request request, Response response, RequestHandler handler)
|
public boolean service(Request request, Response response, RequestHandler handler)
|
||||||
throws IOException
|
throws IOException {
|
||||||
{
|
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// The responsibility of a filter is to invoke the corresponding method
|
// The responsibility of a filter is to invoke the corresponding method
|
||||||
// in the handler. When you chain multiple filters together, each filter
|
// in the handler. When you chain multiple filters together, each filter
|
||||||
// received a handler that is a bridge to the next filter.
|
// received a handler that is a bridge to the next filter.
|
||||||
|
|
||||||
return handler.service(request, response);
|
return handler.service(request, response);
|
||||||
} finally
|
} finally {
|
||||||
{
|
|
||||||
long elapsed = System.currentTimeMillis() - startTime;
|
long elapsed = System.currentTimeMillis() - startTime;
|
||||||
|
|
||||||
log.info("Request time: {} ms", elapsed);
|
log.info("Request time: {} ms", elapsed);
|
||||||
@ -128,10 +118,7 @@ public class AppModule
|
|||||||
* that implement RequestFilter (defined in other modules).
|
* that implement RequestFilter (defined in other modules).
|
||||||
*/
|
*/
|
||||||
@Contribute(RequestHandler.class)
|
@Contribute(RequestHandler.class)
|
||||||
public void addTimingFilter(OrderedConfiguration<RequestFilter> configuration,
|
public void addTimingFilter(OrderedConfiguration<RequestFilter> configuration, @Local RequestFilter filter) {
|
||||||
@Local
|
|
||||||
RequestFilter filter)
|
|
||||||
{
|
|
||||||
// Each contribution to an ordered configuration has a name, When necessary, you may
|
// Each contribution to an ordered configuration has a name, When necessary, you may
|
||||||
// set constraints to precisely control the invocation order of the contributed filter
|
// set constraints to precisely control the invocation order of the contributed filter
|
||||||
// within the pipeline.
|
// within the pipeline.
|
||||||
|
@ -1,27 +1,15 @@
|
|||||||
package com.baeldung.tapestry.services;
|
package com.baeldung.tapestry.services;
|
||||||
|
|
||||||
import java.io.IOException;
|
import org.apache.tapestry5.SymbolConstants;
|
||||||
|
|
||||||
import org.apache.tapestry5.*;
|
|
||||||
import org.apache.tapestry5.ioc.MappedConfiguration;
|
import org.apache.tapestry5.ioc.MappedConfiguration;
|
||||||
import org.apache.tapestry5.ioc.OrderedConfiguration;
|
|
||||||
import org.apache.tapestry5.ioc.ServiceBinder;
|
|
||||||
import org.apache.tapestry5.ioc.annotations.Local;
|
|
||||||
import org.apache.tapestry5.services.Request;
|
|
||||||
import org.apache.tapestry5.services.RequestFilter;
|
|
||||||
import org.apache.tapestry5.services.RequestHandler;
|
|
||||||
import org.apache.tapestry5.services.Response;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em>
|
* This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em>
|
||||||
* includes <code>development</code>.
|
* includes <code>development</code>.
|
||||||
*/
|
*/
|
||||||
public class DevelopmentModule
|
public class DevelopmentModule {
|
||||||
{
|
|
||||||
public static void contributeApplicationDefaults(
|
public static void contributeApplicationDefaults(
|
||||||
MappedConfiguration<String, Object> configuration)
|
MappedConfiguration<String, Object> configuration) {
|
||||||
{
|
|
||||||
// The factory default is true but during the early stages of an application
|
// The factory default is true but during the early stages of an application
|
||||||
// overriding to false is a good idea. In addition, this is often overridden
|
// overriding to false is a good idea. In addition, this is often overridden
|
||||||
// on the command line as -Dtapestry.production-mode=false
|
// on the command line as -Dtapestry.production-mode=false
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
package com.baeldung.tapestry.services;
|
package com.baeldung.tapestry.services;
|
||||||
|
|
||||||
import java.io.IOException;
|
import org.apache.tapestry5.SymbolConstants;
|
||||||
|
|
||||||
import org.apache.tapestry5.*;
|
|
||||||
import org.apache.tapestry5.ioc.MappedConfiguration;
|
import org.apache.tapestry5.ioc.MappedConfiguration;
|
||||||
import org.apache.tapestry5.ioc.OrderedConfiguration;
|
|
||||||
import org.apache.tapestry5.ioc.ServiceBinder;
|
import org.apache.tapestry5.ioc.ServiceBinder;
|
||||||
import org.apache.tapestry5.ioc.annotations.Local;
|
|
||||||
import org.apache.tapestry5.services.Request;
|
|
||||||
import org.apache.tapestry5.services.RequestFilter;
|
|
||||||
import org.apache.tapestry5.services.RequestHandler;
|
|
||||||
import org.apache.tapestry5.services.Response;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em>
|
* This module is automatically included as part of the Tapestry IoC Registry if <em>tapestry.execution-mode</em>
|
||||||
|
@ -1,67 +1,21 @@
|
|||||||
<!DOCTYPE html>
|
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
|
||||||
<html lang="en" xmlns="http://www.w3.org/1999/xhtml"
|
<head>
|
||||||
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
|
<title>${title}</title>
|
||||||
>
|
</head>
|
||||||
<head>
|
<body>
|
||||||
<meta charset="utf-8"/>
|
<div class="container">
|
||||||
<title>${title}</title>
|
<div class="row">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
<div class="span12">
|
||||||
<meta name="description" content=""/>
|
<t:alerts/>
|
||||||
<meta name="author" content=""/>
|
</div>
|
||||||
<!-- Fav and touch icons -->
|
</div>
|
||||||
<link rel="shortcut icon" href="${asset:context:/favicon.ico}"/>
|
</div>
|
||||||
</head>
|
<div class="container">
|
||||||
|
<t:body />
|
||||||
<body>
|
<hr />
|
||||||
|
<footer>
|
||||||
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
<p>© Your Company 2015</p>
|
||||||
<div class="container">
|
</footer>
|
||||||
<div class="navbar-header">
|
</div>
|
||||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
</body>
|
||||||
<span class="sr-only">Toggle navigation</span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
<span class="icon-bar"></span>
|
|
||||||
</button>
|
|
||||||
<t:pagelink page="index" class="navbar-brand">app</t:pagelink>
|
|
||||||
</div>
|
|
||||||
<div class="navbar-collapse collapse">
|
|
||||||
<ul class="nav navbar-nav">
|
|
||||||
<t:loop source="pageNames" value="pageName">
|
|
||||||
<t:any element="li" class="prop:classForPageName">
|
|
||||||
<t:pagelink page="prop:pageName">${pageName}</t:pagelink>
|
|
||||||
</t:any>
|
|
||||||
</t:loop>
|
|
||||||
</ul>
|
|
||||||
<span class="navbar-right">
|
|
||||||
<li>
|
|
||||||
<t:pagelink page="login" class="btn btn-default navbar-btn">Sign in</t:pagelink>
|
|
||||||
</li>
|
|
||||||
</span>
|
|
||||||
|
|
||||||
</div><!--/.nav-collapse -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<div class="row">
|
|
||||||
<div class="span12">
|
|
||||||
<t:alerts/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
|
|
||||||
<t:body />
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
|
|
||||||
<footer>
|
|
||||||
<p>© Your Company 2015</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
</div> <!-- /container -->
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
<html t:type="layout" title="About apache-tapestry"
|
|
||||||
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
|
|
||||||
xmlns:p="tapestry:parameter">
|
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="span12">
|
|
||||||
<p>About apache-tapestry application ...</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<t:if test="learn">
|
|
||||||
<div class="row">
|
|
||||||
<div class="span12">
|
|
||||||
<p>
|
|
||||||
To learn more go to
|
|
||||||
<a href="http://tapestry.apache.org">Tapestry home</a>
|
|
||||||
and start typing...
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</t:if>
|
|
||||||
|
|
||||||
</html>
|
|
@ -1,7 +0,0 @@
|
|||||||
<html t:type="layout" title="Contact com.baeldung"
|
|
||||||
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
|
|
||||||
xmlns:p="tapestry:parameter">
|
|
||||||
|
|
||||||
<p>Contact com.baeldung ...</p>
|
|
||||||
|
|
||||||
</html>
|
|
@ -0,0 +1 @@
|
|||||||
|
introMsg=Welcome to the Apache Tapestry Tutorial
|
@ -0,0 +1,14 @@
|
|||||||
|
<html t:type="layout" title="apache-tapestry Home" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
|
||||||
|
|
||||||
|
<h1>Home! ${appName}</h1>
|
||||||
|
<h2>${message:introMsg}</h2>
|
||||||
|
<h3>${currentTime}</h3>
|
||||||
|
<p><t:eventlink event="callAjax" zone="ajaxZone" class="btn btn-default">Call Ajax</t:eventlink></p>
|
||||||
|
<t:zone t:id="ajaxZone" class="span4"></t:zone>
|
||||||
|
<t:block t:id="ajaxBlock">
|
||||||
|
<hr/>
|
||||||
|
<h2>Rendered through Ajax</h2>
|
||||||
|
<p>The current time is: <strong>${currentTime}</strong></p>
|
||||||
|
</t:block>
|
||||||
|
|
||||||
|
</html>
|
@ -6,8 +6,8 @@
|
|||||||
<div class="span4 offset3">
|
<div class="span4 offset3">
|
||||||
<t:form t:id="login">
|
<t:form t:id="login">
|
||||||
<h2>Please sign in</h2>
|
<h2>Please sign in</h2>
|
||||||
<t:textfield t:id="email" class="input-block-level" validate="required" placeholder="Email address"/>
|
<t:textfield t:id="email" class="input-block-level" placeholder="Email address"/>
|
||||||
<t:passwordfield t:id="password" class="input-block-level" validate="required" placeholder="Password"/>
|
<t:passwordfield t:id="password" class="input-block-level" placeholder="Password"/>
|
||||||
<t:submit class="btn btn-large btn-primary" value="Sign in"/>
|
<t:submit class="btn btn-large btn-primary" value="Sign in"/>
|
||||||
</t:form>
|
</t:form>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user