Tapestry on GoLang
A Tapestry5 like WebFramework writen in GoLang
Note: This is a very early version that only contains some of the core features.
!! Don't use this in production environment. !!
- TODO …
- Activate()
- Called every time this page object is Activated. Page render or call event on this page.
- ? Take no parameters.
- Called every time this page object is Activated. Page render or call event on this page.
- Setup() or SetupRender()
- After() or AfterRender()
- Activate()
- OnSubmit() or OnSubmitFromTableTID()
- before inject submit values, init fields.
- ?? OnValidate()
- TODO…
- OnSuccess() or OnSuccessFromTalbeTID()
- after inject values, do submit.
- ?? OnValidationFailed()
- ?? OnError()
Got's template engine; Some Examples here:
- If
<if t="some test">…</if>
- Loop
<range source=".List"
>…
- Component
<t:layout_leftnav CurPage="/person/list/{{.PersonType}}" />
Note that got will change the name of the attribute lowercased when attribute name doesn't match with struct's field name.
-
Use components Several method to use a component on template file. Most of them will be transformed to the last one.
<t:order.DetailsForm param1="value1"/>
<t:order_DetailsForm />
<div t:type="order.DetailsForm"></div>
{{t_order_detailsform $ "Param1" "value1"}}
- Example 1: Components use body only, if any.
<html>
<header><t:import> -- script & css -- <t:import></header>
<body> -- component body -- </body>
</html>
- Example 2: if only has html tag, use contents in html tag.
<html> -- component body --</html>
- Note: Things in <t:import> will be treated as js and css. used to remove duplication.
inject type
type OrderCreateIndex struct {
core.Page
Idinpath int param:"."
Id int query:"id"
}