http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/index.jsp new file mode 100644 index 0000000..8791fa3 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/index.jsp @@ -0,0 +1,24 @@ + +AJAX Examples + + + +

AJAX Example

+ +

+Note: The Ajax tags are experimental. These examples have only been tested under FireFox 1.5 and IE 6. +

+ + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/options.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/options.ftl b/apps/showcase/src/main/webapp/WEB-INF/ajax/options.ftl new file mode 100644 index 0000000..d12ad6d --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/options.ftl @@ -0,0 +1,5 @@ +[ +<#list options as option> + ["${option?html}"], + +] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotebutton/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotebutton/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotebutton/index.jsp new file mode 100644 index 0000000..b8486ae --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotebutton/index.jsp @@ -0,0 +1,70 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + +
Div 1
+ + +

+ +A submit button, that highlights (blue color) its targets + + +

+ +A submit button, with an indicator + + + +

+ +A submit button, with "notifyTopics" + + +

+ +Use an image as submit + + +

+ + +

+ +Use a button as submit (custom text) + + + + + +

+ + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example1.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example1.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example1.jsp new file mode 100644 index 0000000..4dfdd1d --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example1.jsp @@ -0,0 +1,23 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + + + Initial Content + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example10.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example10.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example10.jsp new file mode 100644 index 0000000..4350984 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example10.jsp @@ -0,0 +1,31 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + + + + Initial Content + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example2.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example2.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example2.jsp new file mode 100644 index 0000000..4257d72 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example2.jsp @@ -0,0 +1,28 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + + + + Initial Content + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example3.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example3.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example3.jsp new file mode 100644 index 0000000..1ea2b17 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example3.jsp @@ -0,0 +1,27 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + + +Initial Content + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example4.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example4.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example4.jsp new file mode 100644 index 0000000..959cff1 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example4.jsp @@ -0,0 +1,28 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + +loading now + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example5.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example5.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example5.jsp new file mode 100644 index 0000000..ac06d1e --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example5.jsp @@ -0,0 +1,27 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + +loading now + + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example6.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example6.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example6.jsp new file mode 100644 index 0000000..c944005 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example6.jsp @@ -0,0 +1,24 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + +loading now + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example7.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example7.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example7.jsp new file mode 100644 index 0000000..d444474 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example7.jsp @@ -0,0 +1,27 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + + +loading now + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example8.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example8.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example8.jsp new file mode 100644 index 0000000..3314475 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example8.jsp @@ -0,0 +1,57 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + +
+ + +
+ +

+ + + + + + + + + Initial Content + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example9.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example9.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example9.jsp new file mode 100644 index 0000000..14ab4f0 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/example9.jsp @@ -0,0 +1,63 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + + + + + + + + + Initial Content + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/index.jsp new file mode 100644 index 0000000..a0e9711 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotediv/index.jsp @@ -0,0 +1,55 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> + + + AJAX-based remote DIV tag + <%@ include file="/WEB-INF/ajax/commonInclude.jsp" %> + + + + +

Examples

+ +

+

    +
  1. + A simple DIV that refreshes only once +
  2. + +
  3. + A simple DIV that uses a custom handler +
  4. + +
  5. + A simple DIV that updates every 2 seconds, with indicator +
  6. + +
  7. + A simple DIV that updates every 5 seconds with loading text and reloading text and delay +
  8. + +
  9. + A simple DIV's that cannot contact the server, with fixed error message +
  10. + + +
  11. + A div that calls the server, and JS in the resulting page is executed +
  12. + +
  13. + A div that will listen to events to refresh and start/stop autoupdate, and gets highlighted in red (when it loads) +
  14. + +
  15. + A div that will listen to events to refresh and start/stop autoupdate, publish notifyTopics +
  16. + +
+ + +

+ + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remoteforms/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remoteforms/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remoteforms/index.jsp new file mode 100644 index 0000000..a961b94 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remoteforms/index.jsp @@ -0,0 +1,119 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + + +
initial content
+ + +

+Remote form replacing another div:
+ + + + + + + + +

+Remote form replacing the forms content:
+ + + + + + + + +

+Remote form evaluating suplied JS on completion:
+ + + + + + + + +

+Submit outside form:
+ + + + + + +

+ +Submit outside form, href in submit tag:
+ + + + + + +

+Remote form whose submit is cancelled:
+ + + + + + + + +

+A form with no remote submit (so should not be ajaxified):
+ + + + + + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/remotelink/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/remotelink/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotelink/index.jsp new file mode 100644 index 0000000..89e32f3 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/remotelink/index.jsp @@ -0,0 +1,127 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Examples + + + + + + + +
Div 1
+ +
+ +
Div 2
+ +

+ + + + +Update 'Div 1' and use red highligh to notify user of changed content + +

+ +Update 'Div 1' and 'Div 2', publish topic '/before' and '/after', use indicator + + +

+ +Try to update 'Div 1', publish '/error', use custom error message + +

+ +Update 'Div 1', use custom loading message + +

+ +Update 'Div 2' and execute returned javascript + +

+ +Update 'Div 2' using a custom handler + + +

+ + + +
+ +
+ +

+ +Update 'Div 2' with the content of the textbox + + +

+ + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example1.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example1.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example1.jsp new file mode 100644 index 0000000..8d455be --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example1.jsp @@ -0,0 +1,95 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax examples - tabbled panel + + + + + + + + + + + + + + + + + +
+ + + This is the first pane
+ +
+ +
+
+ + This is the second panel + + + This is the three + +
+
+ + + This is the left pane
+ +
+ +
+
+ + + middle tab
+ +
+ +
+
+ +
+
+ + + + + + + + + + + Inner 1 + Inner 2 + Inner 3 + + + + Inner 21 + Inner 22 + Inner 23 + + + + Inner 31 + Inner 32 + Inner 33 + + +
+ + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example2.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example2.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example2.jsp new file mode 100644 index 0000000..65b54d2 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example2.jsp @@ -0,0 +1,26 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax examples - tabbled panel + + + + + + + + + I'm a Tab!!! + + + I'm the other Tab!!! + + + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example3.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example3.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example3.jsp new file mode 100644 index 0000000..cd3c9b6 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example3.jsp @@ -0,0 +1,46 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax examples - tabbled panel + + + + + + + + + + + + +
+ + + + This is the left pane
+ +
+ +
+
+ + + middle tab
+ +
+ +
+
+ +
+ +
+ + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example4.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example4.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example4.jsp new file mode 100644 index 0000000..e6f1b2b --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example4.jsp @@ -0,0 +1,57 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax examples - tabbled panel + + + + + + + + + + + Enabled Tab + + + Diabled Tab + + + Some other Tab + + + +
+ + + + +
+ + + + +
+ + + + +

+ + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5.jsp new file mode 100644 index 0000000..25ed4f7 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5.jsp @@ -0,0 +1,29 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax examples - tabbled panel + + + + + + + + + I'm a Tab!!! + + + I'm the other Tab!!! + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5Ok.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5Ok.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5Ok.jsp new file mode 100644 index 0000000..5c3b801 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example5Ok.jsp @@ -0,0 +1,9 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@taglib prefix="s" uri="/struts-tags" %> + +

OK

+
+
+ + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example6.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example6.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example6.jsp new file mode 100644 index 0000000..3bc62cd --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/example6.jsp @@ -0,0 +1,40 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax examples - tabbled panel + + + + + + + + + + Tab 1 + + + Tab 2 + + + +

+ + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/index.jsp new file mode 100644 index 0000000..196d0d4 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/index.jsp @@ -0,0 +1,28 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> + + + Tabbed Panes + <%@ include file="/WEB-INF/ajax/commonInclude.jsp" %> + + + + +

Examples

+ +

+

    +
  1. A local tabbed panel width fixed size (doLayout="true")
  2. +
  3. A Local tabbed panel with disabled tabs
  4. +
  5. A Local tabbed panel that publishes topics when tabs are selected(before and after)
  6. +
  7. A remote (href != "") and local tabbed panel
  8. +
  9. Various remote and local tabbed panels (with enclosed tabbed pannels) with layout (doLayout="false")
  10. +
  11. A local tabbed panel width fixed size (doLayout="true") with close button on the tab pane (closable="true" on tabs), and tabs on the bottom (labelposition="bottom")
  12. +
+ + +

+ + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel1.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel1.ftl b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel1.ftl new file mode 100644 index 0000000..fcc895e --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel1.ftl @@ -0,0 +1,3 @@ + +Hello,
+Today is ${todayDate?html}, the time now is ${todayTime?html} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2.ftl b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2.ftl new file mode 100644 index 0000000..e866e6d --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2.ftl @@ -0,0 +1,7 @@ + +
+
+<@sx.form action="panel2Submit" namespace="/nodecorate"> + <@s.textfield label="Name" name="name" /> + <@sx.submit targets="result" /> + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2Submit.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2Submit.ftl b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2Submit.ftl new file mode 100644 index 0000000..d338eac --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel2Submit.ftl @@ -0,0 +1,2 @@ + +Hello, ${name?html} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3.ftl b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3.ftl new file mode 100644 index 0000000..79209df --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3.ftl @@ -0,0 +1,9 @@ + +
+
+ +<@s.form action="panel3Submit" namespace="/nodecorate"> + <@sx.autocompleter label="Gender" name="gender" list="%{#{'Male':'Male','Female':'Female'}}" /> + <@sx.submit targets="result" /> + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3Submit.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3Submit.ftl b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3Submit.ftl new file mode 100644 index 0000000..7dacc93 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tabbedpanel/nodecorate/panel3Submit.ftl @@ -0,0 +1,2 @@ + +So, you are a ${gender?html} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/testjs.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/testjs.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/testjs.jsp new file mode 100644 index 0000000..5223ef7 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/testjs.jsp @@ -0,0 +1,14 @@ +<% + request.setAttribute("decorator", "none"); + response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 + response.setHeader("Pragma","no-cache"); //HTTP 1.0 + response.setDateHeader ("Expires", 0); //prevents caching at the proxy server +%> + + +Show me some text also + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/getCategory.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/getCategory.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/getCategory.jsp new file mode 100644 index 0000000..6a56cbd --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/getCategory.jsp @@ -0,0 +1,23 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@include file="partialChunkHeader.jsp"%> +
    + +
  • + + + + + +
  • + + + + + + › + + +
    +
\ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/partialChunkHeader.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/partialChunkHeader.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/partialChunkHeader.jsp new file mode 100644 index 0000000..01113d6 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/partialChunkHeader.jsp @@ -0,0 +1,6 @@ +<% + request.setAttribute("decorator", "none"); + response.setHeader("Cache-Control","no-cache"); //HTTP 1.1 + response.setHeader("Pragma","no-cache"); //HTTP 1.0 + response.setDateHeader ("Expires", 0); //prevents caching at the proxy server +%> http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/toggle.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/toggle.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/toggle.jsp new file mode 100644 index 0000000..35010bb --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/toggle.jsp @@ -0,0 +1,12 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@include file="partialChunkHeader.jsp"%> +<% + response.setContentType("text/javascript"); +%> +dojo.event.topic.publish("children_"); +var d = document.getElementById("children_"); +if (d.style.display != "none") { + d.style.display = "none"; +} else { + d.style.display = ""; +} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/tree.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/tree.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/tree.jsp new file mode 100644 index 0000000..81d68d6 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/tree/tree.jsp @@ -0,0 +1,13 @@ +<%@ taglib prefix="s" uri="/struts-tags" %> + + + Tree + + + + + + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/ajax/widgets/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/ajax/widgets/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/ajax/widgets/index.jsp new file mode 100644 index 0000000..e86efbd --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/ajax/widgets/index.jsp @@ -0,0 +1,40 @@ +<%@ page contentType="text/html;charset=UTF-8" language="java" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sx" uri="/struts-dojo-tags" %> + + + + Ajax Widgets + + + + + +
+NOTES: +
    +
  • Make sure that there is a 'value' attribute in the textarea with the content for the editor
  • +
  • This is experimental
  • +
+ + +Default Editor configuration:
+ + + + +
+ +Configured Editor configuration:
+ + + textGroup;|;justifyGroup;|;listGroup;|;indentGroup + + + +
+ + + + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/chatLogin.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/chatLogin.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/chatLogin.ftl new file mode 100644 index 0000000..439ea6b --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/chatLogin.ftl @@ -0,0 +1,27 @@ + + + Struts2 Showcase - Chat - Login + <@s.head /> + + + + +
+
+
+ <@s.actionerror cssClass="alert alert-error"/> + <@s.actionmessage cssClass="alert alert-info"/> + <@s.fielderror cssClass="alert alert-error"/> + + <@s.form action="login" namespace="/chat" method="POST"> + <@s.textfield name="name" label="Name" required="true" /> + <@s.submit cssClass="btn btn-primary"/> + +
+
+
+ + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/createRoom.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/createRoom.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/createRoom.ftl new file mode 100644 index 0000000..fbe71cc --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/createRoom.ftl @@ -0,0 +1,2 @@ +<@s.actionerror /> +<@s.fielderror /> http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/chat/index.jsp new file mode 100644 index 0000000..b58d7a3 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/index.jsp @@ -0,0 +1,3 @@ + +<% response.sendRedirect("main.action"); %> + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/messagesAvailableInRoom.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/messagesAvailableInRoom.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/messagesAvailableInRoom.ftl new file mode 100644 index 0000000..2550dcd --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/messagesAvailableInRoom.ftl @@ -0,0 +1,33 @@ + + + + + + + +<@s.iterator id="message" value="%{messagesAvailableInRoom}" status="stat"> + + <#if stat.odd> + + <#if stat.odd> + + <#if stat.odd> + + + +
SenderDateMessage
+ <#else> + + + <@s.property value="%{#message.creator.name}" /> + + <#else> + + + <@s.property value="%{#message.creationDate}" /> + + <#else> + + + <@s.property value="%{#message.message}" /> +
http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/roomSelection.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/roomSelection.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/roomSelection.ftl new file mode 100644 index 0000000..05eaf17 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/roomSelection.ftl @@ -0,0 +1,172 @@ + + + Struts2 Showcase - Chat - Room Selection +<@sx.head /> + + + + + +
+
+
+ + +
+
+

Operations

+ <@s.url id="url" action="logout" namespace="/chat" /> +
    +
  • <@s.a href="%{#url}">Logout
  • +
+
+ <#if (actionErrors?size gt 0)> +
+

Action Errors

+ <@s.actionerrors /> +
+ +
+

Users Available In Chat

+ <@s.url id="usersAvailableUrl" action="usersAvailable" namespace="/chat/ajax" /> + <@sx.div id="usersAvailable" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}" + href="%{usersAvailableUrl}" + class="box"> + Initial Loading Users ... + +
+
+ + +
+
+

Rooms Available In Chat

+ <@s.url id="roomsAvailableUrl" action="roomsAvailable" namespace="/chat/ajax" /> + <@sx.div id="roomsAvailable" listenTopics="topicRoomCreated" + updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}" + href="%{roomsAvailableUrl}" > + Initial Loading Rooms ... + +
+ +
+

Create Room In Chat

+ +
+ <@s.form id="createRoomId" action="createRoom" namespace="/chat/ajax" method="POST"> + <@s.textfield label="Room Name" required="true" name="name" /> + <@s.textarea theme="xhtml" label="Room Description" required="true" name="Description" /> + <@sx.submit value="%{'Create Room'}" targets="createRoomResult" afterNotifyTopics="topicRoomCreated" align="left" cssClass="btn btn-primary" /> + +
+
+ +
+
+
+ + + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/roomsAvailable.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/roomsAvailable.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/roomsAvailable.ftl new file mode 100644 index 0000000..1d343c0 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/roomsAvailable.ftl @@ -0,0 +1,44 @@ + + + + + + + + +<@s.iterator id="room" value="%{availableRooms}" status="stat"> + + <#if stat.isOdd()> + + <#if stat.odd> + + <#if stat.odd> + + <#if stat.odd> + + + +
OperationNameDescriptionDate Created
+ <#else> + + + <@s.url id="url" action="enterRoom" namespace="/chat"> + <@s.param name="roomName" value="%{#room.name}" /> + + <@s.a href="%{url}">Enter + + <#else> + + + <@s.property value="%{#room.name}" /> + + <#else> + + + <@s.property value="%{#room.description}" /> + + <#else> + + + <@s.property value="%{#room.creationDate}" /> +
http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/sendMessageToRoomResult.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/sendMessageToRoomResult.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/sendMessageToRoomResult.ftl new file mode 100644 index 0000000..c75d32b --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/sendMessageToRoomResult.ftl @@ -0,0 +1,2 @@ + +<@s.fielderror /> http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/showRoom.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/showRoom.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/showRoom.ftl new file mode 100644 index 0000000..0a82d48 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/showRoom.ftl @@ -0,0 +1,167 @@ + + + Struts2 Showcase - Chat - Show Room +<@sx.head /> + + + + + +
+
+
+
+
+

Operation

+ <@s.url id="url" action="exitRoom" namespace="/chat"> + <@s.param name="roomName" value="%{roomName}" /> + +
    +
  • <@s.a href="%{#url}">Exit Room
  • +
+
+
+

Users Available In Chat

+ <@s.url id="usersAvailableUrl" action="usersAvailable" namespace="/chat/ajax" /> + <@sx.div id="usersAvailable" href="%{usersAvailableUrl}" + updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"> + Initial Users Available ... + +
+
+ +
+
+

Messages Posted In Room [${roomName?default('')?html}]

+ <@s.url id="url" value="/chat/ajax/messagesAvailableInRoom.action" includeContext="true"> + <@s.param name="roomName" value="%{roomName}" /> + + <@sx.div id="messagesInRoom" href="%{#url}" includeContext="true" + updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}" + listenTopics="topicMessageSend"> + Initial Messages In Room ... + +
+ +
+

Send Messages

+ <@s.form id="sendMessageForm" action="sendMessageToRoom" namespace="/chat/ajax" method="POST"> +
+ <@s.textarea label="Message"name="message" theme="xhtml" /> + <@s.hidden name="roomName" value="%{roomName}" /> + <@sx.submit id="submit" resultDivId="sendMessageResult" afterNotifyTopics="topicMessageSend" value="%{'Send'}" cssClass="btn btn-primary"/> + +
+
+ + +
+
+

Users Available In Room [${roomName?default('')?html}]

+ <@s.url id="url" value="/chat/ajax/usersAvailableInRoom.action" includeContext="true"> + <@s.param name="roomName" value="%{roomName}" /> + + <@sx.div id="usersAvailableInRoom" href="%{#url}" includeContext="true" + delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"> + Initial Users Available In Room ... + +
+
+ + +
+
+
+ + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailable.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailable.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailable.ftl new file mode 100644 index 0000000..1ff2963 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailable.ftl @@ -0,0 +1,6 @@ + +
    +<#list availableUsers as user> +
  • ${user.name?html}
  • + +
http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailableInRoom.ftl ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailableInRoom.ftl b/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailableInRoom.ftl new file mode 100644 index 0000000..95822bf --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/chat/usersAvailableInRoom.ftl @@ -0,0 +1,8 @@ + +
    +<@s.iterator id="member" value="%{usersAvailableInRoom}"> +
  • <@s.property value="%{#member.name}" />
  • + +
+ + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/Address.java.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/Address.java.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/Address.java.txt new file mode 100644 index 0000000..d3e494c --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/Address.java.txt @@ -0,0 +1,35 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.showcase.conversion; + + +/** + * @version $Date$ $Id$ + */ +public class Address { + + private String id; + private String address; + + public String getId() { return id; } + public void setId(String id) { this.id = id; } + + public String getAddress() { return address; } + public void setAddress(String address) { this.address = address; } + +} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/AddressAction.java.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/AddressAction.java.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/AddressAction.java.txt new file mode 100644 index 0000000..4342f8b --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/AddressAction.java.txt @@ -0,0 +1,44 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.showcase.conversion; + +import java.util.LinkedHashSet; +import java.util.Set; + +import com.opensymphony.xwork2.ActionSupport; + +/** + * @version $Date$ $Id$ + */ +public class AddressAction extends ActionSupport { + + private Set addresses = new LinkedHashSet(); + + public Set getAddresses() { return addresses; } + public void setAddresses(Set addresses) { this.addresses = addresses; } + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + System.out.println(addresses); + return SUCCESS; + } +} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/EnumTypeConverter.java.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/EnumTypeConverter.java.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/EnumTypeConverter.java.txt new file mode 100644 index 0000000..acc3cf2 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/EnumTypeConverter.java.txt @@ -0,0 +1,55 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.showcase.conversion; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import org.apache.struts2.util.StrutsTypeConverter; + +/** + * @version $Date$ $Id$ + */ +public class EnumTypeConverter extends StrutsTypeConverter { + + @Override + public Object convertFromString(Map context, String[] values, Class toClass) { + List result = new ArrayList(); + for (int a=0; a< values.length; a++) { + Enum e = Enum.valueOf(OperationsEnum.class, values[a]); + if (e != null) + result.add(e); + } + return result; + } + + @Override + public String convertToString(Map context, Object o) { + List l = (List) o; + String result ="<"; + for (Iterator i = l.iterator(); i.hasNext(); ) { + result = result + "["+ i.next() +"]"; + } + result = result+">"; + return result; + } + + +} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnum.java.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnum.java.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnum.java.txt new file mode 100644 index 0000000..14865ce --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnum.java.txt @@ -0,0 +1,30 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.showcase.conversion; + +/** + * + * @version $Date$ $Id$ + */ +public enum OperationsEnum { + ADD, + MINUS, + DIVIDE, + MULTIPLY, + REMAINDER; +} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumAction.java.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumAction.java.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumAction.java.txt new file mode 100644 index 0000000..35e1175 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumAction.java.txt @@ -0,0 +1,53 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.showcase.conversion; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import com.opensymphony.xwork2.ActionSupport; + +/** + * + * @version $Date$ $Id$ + */ +public class OperationsEnumAction extends ActionSupport { + + private static final long serialVersionUID = -2229489704988870318L; + + private List selectedOperations = new LinkedList(); + + public List getSelectedOperations() { return this.selectedOperations; } + public void setSelectedOperations(List selectedOperations) { + this.selectedOperations = selectedOperations; + } + + + public List getAvailableOperations() { + return Arrays.asList(OperationsEnum.values()); + } + + public String input() throws Exception { + return SUCCESS; + } + public String submit() throws Exception { + return SUCCESS; + } +} + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumActionConversion.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumActionConversion.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumActionConversion.txt new file mode 100644 index 0000000..621beaf --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/OperationsEnumActionConversion.txt @@ -0,0 +1,4 @@ + +selectedOperations=org.apache.struts2.showcase.conversion.EnumTypeConverter +Element_selectedOperations=org.apache.struts2.showcase.conversion.OperationsEnum + http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/Person.java.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/Person.java.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/Person.java.txt new file mode 100644 index 0000000..f87072c --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/Person.java.txt @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.showcase.conversion; + +import java.io.Serializable; + +/** + * + */ +public class Person implements Serializable { + private String name; + private Integer age; + + public void setName(String name) { this.name = name; } + public String getName() { return this.name; } + + public void setAge(Integer age) { this.age = age; } + public Integer getAge() { return this.age; } +} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/PersonAction.java.txt ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/PersonAction.java.txt b/apps/showcase/src/main/webapp/WEB-INF/conversion/PersonAction.java.txt new file mode 100644 index 0000000..1e0bd55 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/PersonAction.java.txt @@ -0,0 +1,43 @@ +/* + * $Id$ + * + * Copyright 2006 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.struts2.showcase.conversion; + +import java.util.List; + +import com.opensymphony.xwork2.ActionSupport; + +/** + * + */ +public class PersonAction extends ActionSupport { + + private List persons; + + public List getPersons() { return persons; } + public void setPersons(List persons) { this.persons = persons; } + + + + public String input() throws Exception { + return SUCCESS; + } + + public String submit() throws Exception { + return SUCCESS; + } +} http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/enterAddressInfo.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/enterAddressInfo.jsp b/apps/showcase/src/main/webapp/WEB-INF/conversion/enterAddressInfo.jsp new file mode 100644 index 0000000..b0e3e79 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/enterAddressInfo.jsp @@ -0,0 +1,53 @@ +<%@taglib prefix="s" uri="/struts-tags" %> + + + Struts2 Showcase - Conversion - Populate into Struts action class a Set of Address.java Object + + + + +
+
+
+ +

+ An example populating a Set of object (Address.java) into Struts' action (AddressAction.java) +

+ + See the jsp code here.
+ See the code for PersonAction.java here.
+ See the code for Person.java here.
+ +

+ + + + + + + + + <%-- + The following is how its done statically + --%> + <%-- + + + + + + + --%> + +

+
+
+ + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/enterOperations.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/enterOperations.jsp b/apps/showcase/src/main/webapp/WEB-INF/conversion/enterOperations.jsp new file mode 100644 index 0000000..817e81f --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/enterOperations.jsp @@ -0,0 +1,38 @@ +<%@taglib prefix="s" uri="/struts-tags" %> + + + Struts2 Showcase - Conversion - Tiger 5 Enum + + + + +
+
+
+ + + See the jsp code here.
+ See the code for OperationsEnum.java here.
+ See the code for OperationsEnumAction.java here.
+ See the code for EnumTypeConverter.java here.
+ See the properties for OperationsEnumAction-conversion.properties here. +
+
+ + + + + + +
+
+
+ + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/enterPersonInfo.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/enterPersonInfo.jsp b/apps/showcase/src/main/webapp/WEB-INF/conversion/enterPersonInfo.jsp new file mode 100644 index 0000000..ba30a79 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/enterPersonInfo.jsp @@ -0,0 +1,67 @@ +<%@taglib prefix="s" uri="/struts-tags" %> + + + Struts2 Showcase - Conversion - Populate Object into Struts' action List + + + + +
+
+
+ + +

+ An example populating a list of object (Person.java) into Struts' action (PersonAction.java) +

+ + See the jsp code here.
+ See the code for PersonAction.java here.
+ See the code for Person.java here.
+ +

+ + + + + + <%-- + The following is done Dynamically + --%> + + + + + + + + <%-- + The following is done statically:- + --%> + <%-- + + + + + + + --%> + + + + +

+
+
+ + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/index.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/index.jsp b/apps/showcase/src/main/webapp/WEB-INF/conversion/index.jsp new file mode 100644 index 0000000..805d490 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/index.jsp @@ -0,0 +1,35 @@ +<%@taglib prefix="s" uri="/struts-tags" %> + + + + Struts2 Showcase - Conversion + + + + +
+
+
+ +
    +
  • + + Populate into the Struts action class a List of Person.java Object +
  • +
  • + + Populate into Struts action class a Set of Address.java Object +
  • +
  • + + Populate into Struts action class a List of OperationEnum.java (Java5 Enum) +
  • +
+ +
+
+
+ + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/65eb9751/apps/showcase/src/main/webapp/WEB-INF/conversion/showAddressInfo.jsp ---------------------------------------------------------------------- diff --git a/apps/showcase/src/main/webapp/WEB-INF/conversion/showAddressInfo.jsp b/apps/showcase/src/main/webapp/WEB-INF/conversion/showAddressInfo.jsp new file mode 100644 index 0000000..8f2c0c4 --- /dev/null +++ b/apps/showcase/src/main/webapp/WEB-INF/conversion/showAddressInfo.jsp @@ -0,0 +1,21 @@ +<%@taglib prefix="s" uri="/struts-tags" %> + + + Struts2 Showcase - Conversion - Populate into Struts action class a Set of Address.java Object + + + + +
+
+
+ + ->
+
+
+
+
+ + \ No newline at end of file