mirror of
https://github.com/apache/struts.git
synced 2026-08-06 07:06:58 +00:00
Cleanup struts2 showcase after removing of deprecated plugins
- Remove struts1 integration example - Remove JSF integration example - Remove all references to dojo plugin
This commit is contained in:
@@ -45,22 +45,6 @@
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-struts1-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-dojo-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-jsf-plugin</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.struts</groupId>
|
||||
<artifactId>struts2-config-browser-plugin</artifactId>
|
||||
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.integration;
|
||||
|
||||
import org.apache.struts.action.Action;
|
||||
import org.apache.struts.action.ActionForm;
|
||||
import org.apache.struts.action.ActionForward;
|
||||
import org.apache.struts.action.ActionMapping;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class EditGangsterAction extends Action {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
// Some code to load the gangster from the db as necessary
|
||||
|
||||
return mapping.findForward("success");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-115
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.integration;
|
||||
|
||||
import org.apache.struts.action.ActionErrors;
|
||||
import org.apache.struts.action.ActionMapping;
|
||||
import org.apache.struts.action.ActionMessage;
|
||||
import org.apache.struts.validator.ValidatorForm;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class GangsterForm extends ValidatorForm {
|
||||
|
||||
private String name;
|
||||
private String age;
|
||||
private String description;
|
||||
private boolean bustedBefore;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.struts.action.ActionForm#reset(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
|
||||
*/
|
||||
@Override
|
||||
public void reset(ActionMapping arg0, HttpServletRequest arg1) {
|
||||
bustedBefore = false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.struts.action.ActionForm#validate(org.apache.struts.action.ActionMapping, javax.servlet.http.HttpServletRequest)
|
||||
*/
|
||||
@Override
|
||||
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
|
||||
ActionErrors errors = super.validate(mapping, request);
|
||||
if (name == null || name.length() == 0) {
|
||||
errors.add("name", new ActionMessage("The name must not be blank"));
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the age
|
||||
*/
|
||||
public String getAge() {
|
||||
return age;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param age the age to set
|
||||
*/
|
||||
public void setAge(String age) {
|
||||
this.age = age;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bustedBefore
|
||||
*/
|
||||
public boolean isBustedBefore() {
|
||||
return bustedBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bustedBefore the bustedBefore to set
|
||||
*/
|
||||
public void setBustedBefore(boolean bustedBefore) {
|
||||
this.bustedBefore = bustedBefore;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.integration;
|
||||
|
||||
import org.apache.struts.action.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
public class SaveGangsterAction extends Action {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
|
||||
*/
|
||||
@Override
|
||||
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
|
||||
// Some code to save the gangster to the db as necessary
|
||||
GangsterForm gform = (GangsterForm) form;
|
||||
ActionMessages messages = new ActionMessages();
|
||||
messages.add("msg", new ActionMessage("Gangster " + gform.getName() + " added successfully"));
|
||||
addMessages(request, messages);
|
||||
|
||||
return mapping.findForward("success");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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.jsf;
|
||||
|
||||
import org.apache.struts2.showcase.action.EmployeeAction;
|
||||
import org.apache.struts2.showcase.dao.SkillDao;
|
||||
import org.apache.struts2.showcase.model.Employee;
|
||||
import org.apache.struts2.showcase.model.Skill;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Overriding the EmployeeAction to main provide getters returning the data in
|
||||
* the form required by the JSF components
|
||||
*/
|
||||
public class JsfEmployeeAction extends EmployeeAction {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Autowired
|
||||
private SkillDao skillDao;
|
||||
|
||||
/**
|
||||
* Creating a default employee and main skill, since the JSF EL can't handle
|
||||
* creating new objects as necessary
|
||||
*/
|
||||
public JsfEmployeeAction() {
|
||||
Employee e = new Employee();
|
||||
e.setMainSkill(new Skill());
|
||||
setCurrentEmployee(e);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returning a List because the JSF dataGrid can't handle a Set for some
|
||||
* reason
|
||||
*/
|
||||
@Override
|
||||
public Collection getAvailableItems() {
|
||||
return new ArrayList(super.getAvailableItems());
|
||||
}
|
||||
|
||||
/**
|
||||
* Changing the String array into a Map
|
||||
*/
|
||||
public Map<String, String> getAvailablePositionsAsMap() {
|
||||
Map<String, String> map = new LinkedHashMap<String, String>();
|
||||
for (String val : super.getAvailablePositions()) {
|
||||
map.put(val, val);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converting the list into a map
|
||||
*/
|
||||
public Map getAvailableLevelsAsMap() {
|
||||
Map map = new LinkedHashMap();
|
||||
for (Object val : super.getAvailableLevels()) {
|
||||
map.put(val, val);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converting the Skill object list into a map
|
||||
*/
|
||||
public Map<String, String> getAvailableSkills() {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
for (Object val : skillDao.findAll()) {
|
||||
Skill skill = (Skill) val;
|
||||
map.put(skill.getDescription(), skill.getName());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the selected Skill objects as a list
|
||||
*/
|
||||
public List<String> getSelectedSkillsAsList() {
|
||||
System.out.println("asked for skills");
|
||||
List<String> list = new ArrayList<String>();
|
||||
List skills = super.getSelectedSkills();
|
||||
if (skills != null) {
|
||||
for (Object val : skills) {
|
||||
if (val instanceof Skill) {
|
||||
list.add(((Skill) val).getDescription());
|
||||
} else {
|
||||
Skill skill = skillDao.getSkill((String) val);
|
||||
list.add(skill.getDescription());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
<field-validator type="requiredstring">
|
||||
<message>Name is required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="age">
|
||||
<field-validator type="required">
|
||||
<message>Age is required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message>Name is required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
creationDate=org.apache.struts2.showcase.chat.DateConverter
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="name">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message>Room name is required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
<field name="description">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message>Room description is required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
creationDate=org.apache.struts2.showcase.chat.DateConverter
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE validators PUBLIC
|
||||
"-//Apache Struts//XWork Validator 1.0.2//EN"
|
||||
"http://struts.apache.org/dtds/xwork-validator-1.0.2.dtd">
|
||||
|
||||
<validators>
|
||||
<field name="message">
|
||||
<field-validator type="requiredstring">
|
||||
<param name="trim">true</param>
|
||||
<message>Message is required</message>
|
||||
</field-validator>
|
||||
</field>
|
||||
</validators>
|
||||
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="ajax" extends="struts-default">
|
||||
<action name="AjaxTest" class="org.apache.struts2.showcase.ajax.AjaxTestAction">
|
||||
<result>/WEB-INF/ajax/AjaxResult.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="AjaxRemoteLink" class="org.apache.struts2.showcase.ajax.AjaxTestAction">
|
||||
<result>/WEB-INF/ajax/AjaxResult2.js</result>
|
||||
</action>
|
||||
|
||||
<action name="AjaxRemoteForm" class="org.apache.struts2.showcase.ajax.AjaxTestAction">
|
||||
<result>/WEB-INF/ajax/AjaxResult3.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="Test1">
|
||||
<result>/WEB-INF/ajax/remoteforms/test2.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="Test2">
|
||||
<result>/WEB-INF/ajax/remoteforms/test3.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="Test3">
|
||||
<result>/WEB-INF/ajax/testjs.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="JSONList">
|
||||
<result>/ajax/JSONList.js</result>
|
||||
</action>
|
||||
|
||||
<action name="tree">
|
||||
<result>/WEB-INF/ajax/tree/tree.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="getCategory" class="org.apache.struts2.showcase.ajax.tree.GetCategory">
|
||||
<result>/WEB-INF/ajax/tree/getCategory.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="toggle" class="org.apache.struts2.showcase.ajax.tree.Toggle">
|
||||
<result>/WEB-INF/ajax/tree/toggle.jsp</result>
|
||||
</action>
|
||||
|
||||
<action name="example4">
|
||||
<result type="freemarker">/WEB-INF/ajax/tabbedpanel/example4.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="example5" class="org.apache.struts2.showcase.ajax.Example5Action">
|
||||
<result name="input">/WEB-INF/ajax/tabbedpanel/example5.jsp</result>
|
||||
<result>/WEB-INF/ajax/tabbedpanel/example5Ok.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="ajax-examples" namespace="/ajax" extends="struts-default">
|
||||
<action name="bind">
|
||||
<result>/WEB-INF/ajax/bind/index.jsp</result>
|
||||
</action>
|
||||
<action name="autocompleter">
|
||||
<result>/WEB-INF/ajax/autocompleter/index.jsp</result>
|
||||
</action>
|
||||
<action name="remotebutton">
|
||||
<result>/WEB-INF/ajax/remotebutton/index.jsp</result>
|
||||
</action>
|
||||
<action name="remotediv">
|
||||
<result>/WEB-INF/ajax/remotediv/index.jsp</result>
|
||||
</action>
|
||||
<action name="remotelink">
|
||||
<result>/WEB-INF/ajax/remotelink/index.jsp</result>
|
||||
</action>
|
||||
<action name="tabbedpanel">
|
||||
<result>/WEB-INF/ajax/tabbedpanel/index.jsp</result>
|
||||
</action>
|
||||
<action name="remoteforms">
|
||||
<result>/WEB-INF/ajax/remoteforms/index.jsp</result>
|
||||
</action>
|
||||
<action name="widgets">
|
||||
<result>/WEB-INF/ajax/widgets/index.jsp</result>
|
||||
</action>
|
||||
</package>
|
||||
|
||||
<package name="ajaxNoDecorate" namespace="/nodecorate" extends="json-default">
|
||||
<!-- example 4 -->
|
||||
<action name="panel1" class="org.apache.struts2.showcase.ajax.Example4ShowPanelAction" method="panel1">
|
||||
<result type="freemarker">/WEB-INF/ajax/tabbedpanel/nodecorate/panel1.ftl</result>
|
||||
</action>
|
||||
<action name="panel2">
|
||||
<result type="freemarker">/WEB-INF/ajax/tabbedpanel/nodecorate/panel2.ftl</result>
|
||||
</action>
|
||||
<action name="panel3">
|
||||
<result type="freemarker">/WEB-INF/ajax/tabbedpanel/nodecorate/panel3.ftl</result>
|
||||
</action>
|
||||
<action name="panel2Submit" class="org.apache.struts2.showcase.ajax.Example4ShowPanelAction" method="panel2">
|
||||
<result type="freemarker">/WEB-INF/ajax/tabbedpanel/nodecorate/panel2Submit.ftl</result>
|
||||
</action>
|
||||
<action name="panel3Submit" class="org.apache.struts2.showcase.ajax.Example4ShowPanelAction" method="panel3">
|
||||
<result type="freemarker">/WEB-INF/ajax/tabbedpanel/nodecorate/panel3Submit.ftl</result>
|
||||
</action>
|
||||
<action name="AutocompleterExample" class="org.apache.struts2.showcase.ajax.AutocompleterExampleAction">
|
||||
<result type="freemarker">/WEB-INF/ajax/options.ftl</result>
|
||||
</action>
|
||||
<action name="quizAjax" class="org.apache.struts2.showcase.validation.QuizAction">
|
||||
<interceptor-ref name="jsonValidationWorkflowStack"/>
|
||||
<result name="input">/WEB-INF/validation/quiz-ajax.jsp</result>
|
||||
<result>/WEB-INF/validation/quiz-success.jsp</result>
|
||||
</action>
|
||||
<action name="getNodes" class="org.apache.struts2.showcase.ShowAjaxDynamicTreeAction">
|
||||
<result type="freemarker">/WEB-INF/tags/ui/treeExampleAjaxDynamic.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
@@ -1,135 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="chat" extends="struts-default" namespace="/chat">
|
||||
<interceptors>
|
||||
<interceptor name="chatAuthentication"
|
||||
class="org.apache.struts2.showcase.chat.ChatAuthenticationInterceptor" />
|
||||
<interceptor-stack name="chatAuthenticationStack">
|
||||
<interceptor-ref name="createSession" />
|
||||
<interceptor-ref name="exception"/>
|
||||
<interceptor-ref name="alias"/>
|
||||
<interceptor-ref name="servletConfig"/>
|
||||
<interceptor-ref name="prepare"/>
|
||||
<interceptor-ref name="i18n"/>
|
||||
<interceptor-ref name="chain"/>
|
||||
<interceptor-ref name="debugging"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<interceptor-ref name="fileUpload"/>
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="params"/>
|
||||
<interceptor-ref name="conversionError"/>
|
||||
<interceptor-ref name="validation">
|
||||
<param name="excludeMethods">input,back,cancel,browse</param>
|
||||
</interceptor-ref>
|
||||
<interceptor-ref name="workflow">
|
||||
<param name="excludeMethods">input,back,cancel,browse</param>
|
||||
</interceptor-ref>
|
||||
<interceptor-ref name="chatAuthentication" />
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<global-results>
|
||||
<result name="login" type="freemarker">/WEB-INF/chat/chatLogin.ftl</result>
|
||||
</global-results>
|
||||
|
||||
<action name="main">
|
||||
<interceptor-ref name="chatAuthentication" />
|
||||
<result type="freemarker">/WEB-INF/chat/roomSelection.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="login" class="chatLoginAction">
|
||||
<interceptor-ref name="defaultStack" />
|
||||
<result type="redirect">/chat/showRooms.action</result>
|
||||
<result name="input" type="freemarker">/WEB-INF/chat/chatLogin.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="logout" class="chatLogoutAction">
|
||||
<interceptor-ref name="defaultStack" />
|
||||
<result type="redirect">/chat/main.action</result>
|
||||
</action>
|
||||
|
||||
<action name="showRooms">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/roomSelection.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="enterRoom" class="enterRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/showRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="exitRoom" class="exitRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="redirect">/chat/showRooms.action</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
<package name="chat-remote" extends="struts-default" namespace="/chat/ajax">
|
||||
<interceptors>
|
||||
<interceptor name="chatAuthentication"
|
||||
class="org.apache.struts2.showcase.chat.ChatAuthenticationInterceptor" />
|
||||
<interceptor-stack name="chatAuthenticationStack">
|
||||
<interceptor-ref name="createSession" />
|
||||
<interceptor-ref name="exception"/>
|
||||
<interceptor-ref name="alias"/>
|
||||
<interceptor-ref name="servletConfig"/>
|
||||
<interceptor-ref name="prepare"/>
|
||||
<interceptor-ref name="i18n"/>
|
||||
<interceptor-ref name="chain"/>
|
||||
<interceptor-ref name="debugging"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<interceptor-ref name="fileUpload"/>
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="params"/>
|
||||
<interceptor-ref name="conversionError"/>
|
||||
<interceptor-ref name="validation">
|
||||
<param name="excludeMethods">input,back,cancel,browse</param>
|
||||
</interceptor-ref>
|
||||
<interceptor-ref name="workflow">
|
||||
<param name="excludeMethods">input,back,cancel,browse</param>
|
||||
</interceptor-ref>
|
||||
<interceptor-ref name="chatAuthentication" />
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
|
||||
<action name="usersAvailable" class="usersAvailableAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/usersAvailable.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="roomsAvailable" class="roomsAvailableAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/roomsAvailable.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="createRoom" class="crudRoomAction" method="create">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/createRoom.ftl</result>
|
||||
<result name="input" type="freemarker">/WEB-INF/chat/createRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="messagesAvailableInRoom" class="messagesAvailableInRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/messagesAvailableInRoom.ftl</result>
|
||||
<result name="input" type="freemarker">/WEB-INF/chat/messagesAvailableInRoom.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="sendMessageToRoom" class="sendMessageToRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/sendMessageToRoomResult.ftl</result>
|
||||
<result name="input" type="freemarker">/WEB-INF/chat/sendMessageToRoomResult.ftl</result>
|
||||
</action>
|
||||
|
||||
<action name="usersAvailableInRoom" class="usersAvailableInRoomAction">
|
||||
<interceptor-ref name="chatAuthenticationStack" />
|
||||
<result type="freemarker">/WEB-INF/chat/usersAvailableInRoom.ftl</result>
|
||||
</action>
|
||||
</package>
|
||||
</struts>
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="integration" extends="struts1-default" namespace="/integration">
|
||||
|
||||
<interceptors>
|
||||
<interceptor name="gangsterForm" class="com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor">
|
||||
<param name="className">org.apache.struts2.showcase.integration.GangsterForm</param>
|
||||
<param name="name">gangsterForm</param>
|
||||
</interceptor>
|
||||
<interceptor name="gangsterValidation" class="org.apache.struts2.s1.ActionFormValidationInterceptor">
|
||||
<param name="pathnames">/org/apache/struts/validator/validator-rules.xml,/WEB-INF/validation.xml</param>
|
||||
</interceptor>
|
||||
|
||||
<interceptor-stack name="integration">
|
||||
<interceptor-ref name="staticParams"/>
|
||||
<interceptor-ref name="gangsterForm"/>
|
||||
<interceptor-ref name="modelDriven"/>
|
||||
<interceptor-ref name="actionForm-reset"/>
|
||||
<interceptor-ref name="basicStack"/>
|
||||
<interceptor-ref name="gangsterValidation"/>
|
||||
<interceptor-ref name="workflow"/>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="integration"/>
|
||||
<default-action-ref name="editGangster"/>
|
||||
|
||||
<!-- Display entry page that uses Model-Driven technique -->
|
||||
<action name="editGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.EditGangsterAction</param>
|
||||
<result>/WEB-INF/integration/modelDriven.jsp</result>
|
||||
</action>
|
||||
|
||||
<!-- Display the result page whose content is populated using the Model-Driven technique -->
|
||||
<action name="saveGangster" class="org.apache.struts2.s1.Struts1Action">
|
||||
<param name="className">org.apache.struts2.showcase.integration.SaveGangsterAction</param>
|
||||
<param name="validate">true</param>
|
||||
<result name="input">/WEB-INF/integration/modelDriven.jsp</result>
|
||||
<result>/WEB-INF/integration/modelDrivenResult.jsp</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
</struts>
|
||||
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE struts PUBLIC
|
||||
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
|
||||
"http://struts.apache.org/dtds/struts-2.3.dtd">
|
||||
|
||||
<struts>
|
||||
<package name="jsf" extends="jsf-default" namespace="/jsf">
|
||||
|
||||
<result-types>
|
||||
<result-type name="jsf" class="org.apache.struts2.jsf.FacesResult" />
|
||||
</result-types>
|
||||
|
||||
<interceptors>
|
||||
<interceptor-stack name="jsfFullStack">
|
||||
<interceptor-ref name="params" />
|
||||
<interceptor-ref name="basicStack"/>
|
||||
<interceptor-ref name="jsfStack"/>
|
||||
</interceptor-stack>
|
||||
</interceptors>
|
||||
|
||||
<default-interceptor-ref name="jsfFullStack"/>
|
||||
|
||||
<action name="index">
|
||||
<result>/WEB-INF/jsf/index.jsp</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
<package name="jsf.employee" extends="jsf" namespace="/jsf/employee">
|
||||
|
||||
<action name="list" class="org.apache.struts2.showcase.jsf.JsfEmployeeAction" method="list">
|
||||
<result name="success" type="jsf" />
|
||||
</action>
|
||||
<action name="edit" class="org.apache.struts2.showcase.jsf.JsfEmployeeAction">
|
||||
<result name="success" type="jsf" />
|
||||
</action>
|
||||
<action name="delete" class="org.apache.struts2.showcase.action.EmployeeAction" method="delete">
|
||||
<result name="error" type="redirect">list.action</result>
|
||||
<result type="redirect">list.action</result>
|
||||
</action>
|
||||
|
||||
</package>
|
||||
|
||||
</struts>
|
||||
@@ -25,8 +25,6 @@
|
||||
<constant name="struts.serve.static" value="true" />
|
||||
<constant name="struts.serve.static.browserCache" value="false" />
|
||||
|
||||
<include file="struts-chat.xml" />
|
||||
|
||||
<include file="struts-interactive.xml" />
|
||||
|
||||
<include file="struts-hangman.xml" />
|
||||
@@ -37,22 +35,16 @@
|
||||
|
||||
<include file="struts-actionchaining.xml" />
|
||||
|
||||
<include file="struts-ajax.xml" />
|
||||
|
||||
<include file="struts-fileupload.xml" />
|
||||
|
||||
<include file="struts-person.xml" />
|
||||
|
||||
<include file="struts-wait.xml" />
|
||||
|
||||
<include file="struts-jsf.xml" />
|
||||
|
||||
<include file="struts-token.xml" />
|
||||
|
||||
<include file="struts-model-driven.xml" />
|
||||
|
||||
<include file="struts-integration.xml" />
|
||||
|
||||
<include file="struts-filedownload.xml" />
|
||||
|
||||
<include file="struts-conversion.xml" />
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<%
|
||||
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
|
||||
%>
|
||||
|
||||
Result: <s:property value="count"/> @ <s:property value="serverTime"/>
|
||||
<br/>
|
||||
<s:property value="data"/>
|
||||
@@ -1,2 +0,0 @@
|
||||
alert('This JavaScript currently being evaluated is the result...');
|
||||
alert('... of an action executed on the server!');
|
||||
@@ -1,12 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<%
|
||||
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
|
||||
%>
|
||||
|
||||
Result: <s:property value="count"/> @ <s:property value="serverTime"/>
|
||||
|
||||
The value you entered was: <s:property value="data"/><br/>
|
||||
@@ -1,186 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
|
||||
<!--// START SNIPPET: common-include-->
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
<!--// END SNIPPET: common-include-->
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
dojo.event.topic.subscribe("/before", function(event, widget){
|
||||
alert('inside a topic event. before request');
|
||||
//event: set event.cancel = true, to cancel request
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, request, widget){
|
||||
alert('inside a topic event. after request');
|
||||
//data : json object from request
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/value", function(error, request, widget){
|
||||
alert('inside a topic event. on error');
|
||||
//error : error object (error.message has the error message)
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
function showKey() {
|
||||
var autoCompleter = dojo.widget.byId('jsauto');
|
||||
alert(autoCompleter.getSelectedKey());
|
||||
}
|
||||
|
||||
function showValue() {
|
||||
var autoCompleter = dojo.widget.byId('jsauto');
|
||||
alert(autoCompleter.getSelectedValue());
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<s:url var="jsonList" value="/JSONList.action"/>
|
||||
|
||||
Using a JSON list returned from an action (href="/JSONList.action"), without autoComplete (autoComplete="false"), use indicator, search substring (searchType="substring")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
id="auto1"
|
||||
indicator="indicator1"
|
||||
href="%{jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
autoComplete="false"
|
||||
searchType="substring"
|
||||
name="state"/>
|
||||
<img id="indicator1" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Reload on type (loadOnTextChange="true"), after 3 characters (loadMinimumCount="3", it is "3" by default), without the down arrow button (showDownArrow="false")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
id="auto2"
|
||||
indicator="indicator"
|
||||
href="%{jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
autoComplete="false"
|
||||
loadOnTextChange="true"
|
||||
loadMinimumCount="3"
|
||||
showDownArrow="false"/>
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Using a JSON list returned from an action (href="/JSONList.action"), with autoComplete (autoComplete="true")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
id="auto3"
|
||||
name="auto3"
|
||||
href="%{#jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
autoComplete="true" />
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Using a local list (list="%{'apple','banana','grape','pear'}")
|
||||
<br/>
|
||||
<sx:autocompleter id="auto-list" list="{'apple','banana','grape','pear'}" cssStyle="width: 150px;"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Force valid options (forceValidOption="true")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
id="auto4"
|
||||
name="auto4"
|
||||
href="%{#jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
forceValidOption="true"/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Make dropdown's height to 180px (dropdownHeight="180")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
id="auto5"
|
||||
name="auto5"
|
||||
href="%{#jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
dropdownHeight="180"/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
Disabled combobox (disabled="true")
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
id="auto6"
|
||||
name="auto6"
|
||||
href="%{#jsonList}"
|
||||
cssStyle="width: 200px;"
|
||||
disabled="true"/>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<s:url var="autoex" action="AutocompleterExample" namespace="/nodecorate"/>
|
||||
|
||||
Link two autocompleter elements. When the selected value in 'Autocompleter 1' changes, the available values in 'Autocompleter 2' will change also.
|
||||
<br/>
|
||||
<form id="selectForm">
|
||||
<p>
|
||||
Autocompleter 1
|
||||
<sx:autocompleter
|
||||
id="auto7"
|
||||
name="select"
|
||||
list="{'fruits','colors'}"
|
||||
value="colors"
|
||||
valueNotifyTopics="/Changed"
|
||||
forceValidOption="true"/>
|
||||
</p>
|
||||
</form>
|
||||
Autocompleter 2
|
||||
<sx:autocompleter
|
||||
id="auto8"
|
||||
name="auto8"
|
||||
href="%{#autoex}"
|
||||
autoComplete="false"
|
||||
formId="selectForm"
|
||||
listenTopics="/Changed"
|
||||
forceValidOption="true" />
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Publish before/after/value notify topics
|
||||
<br/>
|
||||
<sx:autocompleter
|
||||
id="auto9"
|
||||
name="auto9"
|
||||
href="%{#jsonList}"
|
||||
listenTopics="/reload"
|
||||
beforeNotifyTopics="/before"
|
||||
afterNotifyTopics="/after"
|
||||
valueNotifyTopics="/value"
|
||||
cssStyle="width: 200px;" />
|
||||
<s:submit theme="simple" value="Reload Values" onclick="dojo.event.topic.publish('/reload')"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Get values using JavaScript
|
||||
<br/>
|
||||
<sx:autocompleter href="%{#jsonList}" id="jsauto" name="state"/>
|
||||
<s:submit theme="simple" value="Show Key" onclick="showKey()"/>
|
||||
<s:submit theme="simple" value="Show Value" onclick="showValue()"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,61 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Bind Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
dojo.event.topic.subscribe("/before", function(event, widget){
|
||||
alert('inside a topic event. before request');
|
||||
//event: set event.cancel = true, to cancel request
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, request, widget){
|
||||
alert('inside a topic event. after request');
|
||||
//data : text returned from request
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="div1">Div 1</div>
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<br/><br/>
|
||||
<p>
|
||||
1. Attach to "onclick" event on button. Update content of Div 1. Use with indicator.
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<sx:bind href="%{#ajaxTest}" sources="button" targets="div1" events="onclick" indicator="indicator" />
|
||||
<br/>
|
||||
<s:submit theme="simple" type="submit" value="submit" id="button"/>
|
||||
</p>
|
||||
<br/><br/>
|
||||
<p>
|
||||
2. Attach to "onmouseover", and "onclick" event on Area below and update content of Div1, highlight targets with green color
|
||||
<sx:bind id="ex2" href="%{#ajaxTest}" sources="div2" targets="div1" events="onmouseover,onclick" highlightColor="green"/>
|
||||
<div id="div2" style="width: 300px; height: 50px; border: 1px solid black">
|
||||
Mouse Over or Click Here!
|
||||
</div>
|
||||
</p>
|
||||
<br/><br/>
|
||||
<p>
|
||||
3. Attach to "onkeydown" event on Textbox below update content of Div1. Publish topics.
|
||||
<sx:bind id="ex4" href="%{#ajaxTest}" sources="txt1" targets="div1" events="onkeydown" beforeNotifyTopics="/before" afterNotifyTopics="/after" />
|
||||
<br/>
|
||||
<s:textfield id="txt1"/>
|
||||
</p>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<!--// START SNIPPET: common-include-->
|
||||
<sx:head cache="false"/>
|
||||
<!--// END SNIPPET: common-include-->
|
||||
@@ -1,8 +0,0 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<hr/>
|
||||
|
||||
<s:url var="backToAjaxExamples" value="/ajax/index.html" />
|
||||
|
||||
<s:a href="%{backToAjaxExamples}">Back To AJAX Examples</s:a>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
[
|
||||
<#list options as option>
|
||||
["${option?html}"],
|
||||
</#list>
|
||||
]
|
||||
@@ -1,70 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsplude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
function before() {alert("before request");}
|
||||
function after() {alert("after request");}
|
||||
function handler(widget, node) {
|
||||
alert('I will handle this myself!');
|
||||
dojo.byId(widget.targetsArray[0]).innerHTML = "Done";
|
||||
}
|
||||
|
||||
dojo.event.topic.subscribe("/alltopics", function(data, type, e){
|
||||
alert('inside a topic event. type='+type);
|
||||
//data : text returned
|
||||
//type : "before", "load" or "error"
|
||||
//e : request object
|
||||
});
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="t1">Div 1</div>
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<br/><br/>
|
||||
|
||||
A submit button, that highlights (blue color) its targets
|
||||
<sx:submit type="submit" value="submit" targets="t1" href="%{ajaxTest}" highlightColor="blue"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
A submit button, with an indicator
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<sx:submit id="submit2" type="submit" value="submit" targets="t1" href="%{ajaxTest}" indicator="indicator"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
A submit button, with "notifyTopics"
|
||||
<sx:submit type="submit" value="submit" targets="t1" href="%{ajaxTest}" notifyTopics="/alltopics"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
Use an image as submit
|
||||
<s:url value="/images/struts-power.gif" var="imgUrl" />
|
||||
<sx:submit type="image" label="Alt Text" targets="t1"
|
||||
src="%{imgUrl}" href="%{ajaxTest}" />
|
||||
<br/><br/>
|
||||
|
||||
<label for="textInput">Text to be echoed</label>
|
||||
<br/><br/>
|
||||
|
||||
Use a button as submit (custom text)
|
||||
<s:form id="form" action="AjaxTest">
|
||||
<input type=textbox name="data">
|
||||
<sx:submit type="button" label="Update Content" targets="t1" id="ajaxbtn"/>
|
||||
</s:form>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,23 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<body>
|
||||
<sx:div
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}">
|
||||
Initial Content</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,31 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
function handler(widget, node) {
|
||||
alert('I will handle this myself!');
|
||||
node.innerHTML = "Done";
|
||||
}
|
||||
</script>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<body>
|
||||
<sx:div
|
||||
id="once"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
handler="handler">
|
||||
Initial Content</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
|
||||
<body>
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<sx:div
|
||||
id="once"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{#ajaxTest}"
|
||||
updateFreq="2000"
|
||||
indicator="indicator"
|
||||
>
|
||||
Initial Content</sx:div>
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,27 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
|
||||
<sx:div
|
||||
id="twoseconds"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
delay="2000"
|
||||
updateFreq="%{#parameters.period}"
|
||||
errorText="There was an error">Initial Content</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<sx:div
|
||||
id="fiveseconds"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
delay="1000"
|
||||
updateFreq="5000"
|
||||
errorText="There was an error"
|
||||
loadingText="reloading"
|
||||
showLoadingText="true">loading now</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,27 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="ajaxNoUrl" value="/AjaxNoUrl.jsp" />
|
||||
|
||||
<sx:div
|
||||
id="error"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="/AjaxNoUrl.jsp"
|
||||
delay="1000"
|
||||
errorText="Could not contact server"
|
||||
loadingText="reloading">loading now</sx:div>
|
||||
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,24 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<sx:div
|
||||
id="error"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="/AjaxNoUrl.jsp"
|
||||
delay="1000"
|
||||
showErrorTransportText="true"
|
||||
loadingText="reloading">loading now</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,27 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<s:url var="test3" value="/Test3.action" />
|
||||
|
||||
|
||||
<sx:div
|
||||
id="error"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{test3}"
|
||||
delay="1000"
|
||||
executeScripts="true"
|
||||
loadingText="reloading">loading now</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,57 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script>
|
||||
var controller = {
|
||||
refresh : function() {},
|
||||
start : function() {},
|
||||
stop : function() {}
|
||||
};
|
||||
|
||||
|
||||
dojo.event.topic.registerPublisher("/refresh", controller, "refresh");
|
||||
dojo.event.topic.registerPublisher("/startTimer", controller, "start");
|
||||
dojo.event.topic.registerPublisher("/stopTimer", controller, "stop");
|
||||
|
||||
</script>
|
||||
<form id="form">
|
||||
<label for="textInput">Text to be echoed</label>
|
||||
<input type=textbox id="textInput" name="data">
|
||||
</form>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<input type=button value="refresh" onclick="controller.refresh()">
|
||||
<input type=button value="stop timer" onclick="controller.stop()">
|
||||
<input type=button value="start timer" onclick="controller.start()">
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<sx:div
|
||||
id="once"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
loadingText="Loading..."
|
||||
listenTopics="/refresh"
|
||||
startTimerListenTopics="/startTimer"
|
||||
stopTimerListenTopics="/stopTimer"
|
||||
updateFreq="3000"
|
||||
autoStart="true"
|
||||
highlightColor="red"
|
||||
formId="form"
|
||||
>
|
||||
Initial Content</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,63 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<script>
|
||||
var controller = {
|
||||
refresh : function() {},
|
||||
start : function() {},
|
||||
stop : function() {}
|
||||
};
|
||||
|
||||
dojo.event.topic.registerPublisher("/refresh", controller, "refresh");
|
||||
dojo.event.topic.registerPublisher("/startTimer", controller, "start");
|
||||
dojo.event.topic.registerPublisher("/stopTimer", controller, "stop");
|
||||
|
||||
dojo.event.topic.subscribe("/before", function(data, type, e){
|
||||
alert('inside a topic event. before request');
|
||||
//data : source element id
|
||||
//type : "before"
|
||||
//e : request object
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, type, e){
|
||||
alert('inside a topic event. after request');
|
||||
//data : text returned
|
||||
//type : "load"
|
||||
//e : undefined
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<input type=button value="refresh" onclick="controller.refresh()">
|
||||
<input type=button value="start timer" onclick="controller.start()">
|
||||
<input type=button value="stop timer" onclick="controller.stop()">
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<sx:div
|
||||
id="div1"
|
||||
cssStyle="border: 1px solid yellow;"
|
||||
href="%{ajaxTest}"
|
||||
listenTopics="/refresh"
|
||||
startTimerListenTopics="/startTimer"
|
||||
stopTimerListenTopics="/stopTimer"
|
||||
updateFreq="10000"
|
||||
autoStart="false"
|
||||
beforeNotifyTopics="/before"
|
||||
afterNotifyTopics="/after"
|
||||
>
|
||||
Initial Content</sx:div>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,55 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>AJAX-based remote DIV tag</title>
|
||||
<%@ include file="/WEB-INF/ajax/commonInclude.jsp" %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Examples</h2>
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li>
|
||||
<a href="example1.jsp">A simple DIV that refreshes only once</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="example10.jsp">A simple DIV that uses a custom handler</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="example2.jsp?url=/AjaxTest.action">A simple DIV that updates every 2 seconds, with indicator</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="example4.jsp">A simple DIV that updates every 5 seconds with loading text and reloading text and delay</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="example5.jsp">A simple DIV's that cannot contact the server, with fixed error message</a>
|
||||
</li>
|
||||
|
||||
|
||||
<li>
|
||||
<a href="example7.jsp">A div that calls the server, and JS in the resulting page is executed</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="example8.jsp">A div that will listen to events to refresh and start/stop autoupdate, and gets highlighted in red (when it loads)</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a href="example9.jsp">A div that will listen to events to refresh and start/stop autoupdate, publish notifyTopics</a>
|
||||
</li>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,119 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<sx:head />
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
dojo.event.topic.subscribe("/beforeSubmit", function(event, widget) {
|
||||
alert('you can manipulate the form before it gets submitted. To cancel the submit event set event.cancel=true');
|
||||
event.cancel = true;
|
||||
});
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id='two' style="border: 1px solid yellow;"><b>initial content</b></div>
|
||||
|
||||
|
||||
<br /><br />
|
||||
Remote form replacing another div:<br/>
|
||||
<s:form
|
||||
id='theForm2'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO2" targets="two"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
Remote form replacing the forms content:<br/>
|
||||
<s:form
|
||||
id='theForm3'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO3" targets="theForm3"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
Remote form evaluating suplied JS on completion:<br/>
|
||||
<s:form
|
||||
id='theForm4'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='Test3'
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO4" executeScripts="true"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
Submit outside form:<br/>
|
||||
<s:form
|
||||
id='theForm5'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
</s:form>
|
||||
<sx:submit value="GO5" formId="theForm5" targets="two"/>
|
||||
|
||||
<br /><br />
|
||||
<s:url var="remoteUrl" namespace="/remoteforms" action="AjaxRemoteForm"/>
|
||||
Submit outside form, href in submit tag:<br/>
|
||||
<s:form
|
||||
id='theForm6'
|
||||
cssStyle="border: 1px solid green;"
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
</s:form>
|
||||
<sx:submit value="GO6" formId="theForm6" targets="two" href="%{#remoteUrl}"/>
|
||||
|
||||
<br /><br />
|
||||
Remote form whose submit is cancelled:<br/>
|
||||
<s:form
|
||||
id='theForm7'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<sx:submit value="GO7" targets="theForm7" beforeNotifyTopics="/beforeSubmit"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
<br /><br />
|
||||
A form with no remote submit (so should not be ajaxified):<br/>
|
||||
<s:form
|
||||
id='theForm8'
|
||||
cssStyle="border: 1px solid green;"
|
||||
action='AjaxRemoteForm'
|
||||
method='post'>
|
||||
|
||||
<input type='text' name='data' value='Struts User'>
|
||||
|
||||
<s:submit value="Go AWAY" />
|
||||
|
||||
</s:form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,127 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Examples</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
function handler(widget, node) {
|
||||
alert('I will handle this myself!');
|
||||
dojo.byId(widget.targetsArray[0]).innerHTML = "Done";
|
||||
}
|
||||
|
||||
dojo.event.topic.subscribe("/before", function(event, widget){
|
||||
alert('inside a topic event. before request');
|
||||
//event: set event.cancel = true, to cancel request
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/after", function(data, request, widget){
|
||||
alert('inside a topic event. after request');
|
||||
//data : text returned from request
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/error", function(error, request, widget){
|
||||
alert('inside a topic event. on error');
|
||||
//error : error object (error.message has the error message)
|
||||
//request: XMLHttpRequest object
|
||||
//widget: widget that published the topic
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/topics", function(data, type, e){
|
||||
alert('inside a topic event. type='+type);
|
||||
//data : text returned
|
||||
//type : "before", "load", "error"
|
||||
//e : request object
|
||||
});
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="t1">Div 1</div>
|
||||
|
||||
<br/>
|
||||
|
||||
<div id="t2">Div 2</div>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
<s:url var="test3" value="/Test3.action" />
|
||||
|
||||
<sx:a
|
||||
href="%{#ajaxTest}"
|
||||
targets="t1"
|
||||
highlightColor="red"
|
||||
highlightDuration="2000">Update 'Div 1' and use red highligh to notify user of changed content</sx:a>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link1"
|
||||
href="%{#ajaxTest}"
|
||||
indicator="indicator"
|
||||
targets="t1,t2"
|
||||
beforeNotifyTopics="/before"
|
||||
afterNotifyTopics="/after" >Update 'Div 1' and 'Div 2', publish topic '/before' and '/after', use indicator</sx:a>
|
||||
<img id="indicator" src="${pageContext.request.contextPath}/images/indicator.gif" alt="Loading..." style="display:none"/>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link2"
|
||||
href="/AjaxNoUrl.jsp"
|
||||
errorText="Error Loading"
|
||||
targets="t1"
|
||||
errorNotifyTopics="/error">Try to update 'Div 1', publish '/error', use custom error message</sx:a>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link3"
|
||||
href="%{#ajaxTest}"
|
||||
loadingText="Loading!!!"
|
||||
showLoadingText="true"
|
||||
targets="t1">Update 'Div 1', use custom loading message</sx:a>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link4"
|
||||
href="%{#test3}"
|
||||
executeScripts="true"
|
||||
targets="t2">Update 'Div 2' and execute returned javascript </sx:a>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link5"
|
||||
href="%{#ajaxTest}"
|
||||
handler="handler"
|
||||
targets="t2">Update 'Div 2' using a custom handler </sx:a>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<label for="textInput">Text to be echoed</label>
|
||||
|
||||
<form id="form">
|
||||
<input type=textbox name="data">
|
||||
</form>
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<sx:a id="link6"
|
||||
href="%{#ajaxTest}"
|
||||
targets="t2"
|
||||
formId="form"
|
||||
>Update 'Div 2' with the content of the textbox </sx:a>
|
||||
|
||||
|
||||
<br/><br/>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,95 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<body>
|
||||
|
||||
<table cellpadding="0" cellspacing="10" border="0" width="900">
|
||||
<tr>
|
||||
<td align="top" width="400">
|
||||
<sx:tabbedpanel id="test" >
|
||||
<sx:div id="one" label="one" >
|
||||
This is the first pane<br/>
|
||||
<s:form>
|
||||
<s:textfield name="tt" label="Test Text"/> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2"/>
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div id="two" label="two" >
|
||||
This is the second panel
|
||||
</sx:div>
|
||||
<sx:div id="three" label="three" >
|
||||
This is the three
|
||||
</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
</td>
|
||||
<td align="top">
|
||||
<sx:tabbedpanel id="test2" >
|
||||
<sx:div id="left" label="left" >
|
||||
This is the left pane<br/>
|
||||
<s:form>
|
||||
<s:textfield name="tt" label="Test Text"/> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2"/>
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh1"
|
||||
label="remote one"></sx:div>
|
||||
<sx:div id="middle" label="middle" >
|
||||
middle tab<br/>
|
||||
<s:form>
|
||||
<s:textfield name="tt" label="Test Text44"/> <br/>
|
||||
<s:textfield name="tt2" label="Test Text442"/>
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh21" label="remote right"/>
|
||||
</sx:tabbedpanel>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="top">
|
||||
<sx:tabbedpanel id="testremote">
|
||||
<sx:div href="%{ajaxTest}" id="r1" label="remote one">
|
||||
<s:action name="AjaxTest" executeResult="true" />
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="r2" label="remote two"></sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="r3" label="remote three"></sx:div>
|
||||
</sx:tabbedpanel>
|
||||
</td>
|
||||
<td align="top">
|
||||
<sx:tabbedpanel id="test3" >
|
||||
<sx:tabbedpanel id="test11" label="Container 1">
|
||||
<sx:div id="i11" label="inner 1 one">Inner 1</sx:div>
|
||||
<sx:div id="112" label="inner 1 two">Inner 2</sx:div>
|
||||
<sx:div id="i13" label="inner 1 three">Inner 3</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<sx:tabbedpanel id="test12" label="Container 2">
|
||||
<sx:div id="i21" label="inner 2 one" >Inner 21</sx:div>
|
||||
<sx:div id="122" label="inner 2 two" >Inner 22</sx:div>
|
||||
<sx:div id="i23" label="inner 2 three" >Inner 23</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<sx:tabbedpanel id="test13" label="Container 3">
|
||||
<sx:div id="i31" label="inner 3 one" >Inner 31</sx:div>
|
||||
<sx:div id="132" label="inner 3 two" >Inner 32</sx:div>
|
||||
<sx:div id="i33" label="inner 3 three" >Inner 33</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
</sx:tabbedpanel>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,26 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div label="test1" >
|
||||
I'm a Tab!!!
|
||||
</sx:div >
|
||||
<sx:div id="middle" label="test2" >
|
||||
I'm the other Tab!!!
|
||||
</sx:div >
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,46 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<s:url var="ajaxTest" value="/AjaxTest.action" />
|
||||
|
||||
<body>
|
||||
|
||||
<table cellpadding="0" cellspacing="10" border="0" width="600">
|
||||
<tr>
|
||||
<td align="top">
|
||||
<!--// START SNIPPET: tabbedpanel-tag-->
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div id="left" label="left">
|
||||
This is the left pane<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text2" />
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh1" label="remote one" preload="false"/>
|
||||
<sx:div id="middle" label="middle">
|
||||
middle tab<br/>
|
||||
<s:form >
|
||||
<s:textfield name="tt" label="Test Text44" /> <br/>
|
||||
<s:textfield name="tt2" label="Test Text442" />
|
||||
</s:form>
|
||||
</sx:div>
|
||||
<sx:div href="%{ajaxTest}" id="ryh21" label="remote right" preload="false"/>
|
||||
</sx:tabbedpanel>
|
||||
<!--// END SNIPPET: tabbedpanel-tag-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,57 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script>
|
||||
function enableTab(id) {
|
||||
var tabContainer = dojo.widget.byId('tabContainer');
|
||||
tabContainer.enableTab(id);
|
||||
}
|
||||
|
||||
function disableTab(index) {
|
||||
var tabContainer = dojo.widget.byId('tabContainer');
|
||||
tabContainer.disableTab(index);
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel id="tabContainer" cssStyle="width: 500px; height: 300px;" doLayout="true">
|
||||
<sx:div id="tab1" label="test1" >
|
||||
Enabled Tab
|
||||
</sx:div >
|
||||
<sx:div id="tab2" label="test2" disabled="true" >
|
||||
Diabled Tab
|
||||
</sx:div >
|
||||
<sx:div id="tab3" label="test3" >
|
||||
Some other Tab
|
||||
</sx:div >
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<br />
|
||||
|
||||
<input type="button" onclick="enableTab(1)" value="Enable Tab 2 using Index" />
|
||||
<input type="button" onclick="disableTab(1)" value="Disable Tab 2 using Index" />
|
||||
|
||||
<br />
|
||||
|
||||
<input type="button" onclick="enableTab('tab2')" value="Enable Tab 2 using Id" />
|
||||
<input type="button" onclick="disableTab('tab2')" value="Disable Tab 2 using Id" />
|
||||
|
||||
<br />
|
||||
|
||||
<input type="button" onclick="enableTab(dojo.widget.byId('tab2'))" value="Enable Tab 2 using widget" />
|
||||
<input type="button" onclick="disableTab(dojo.widget.byId('tab2'))" value="Disable Tab 2 using widget" />
|
||||
|
||||
<br /> <br />
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,29 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel id="test2" cssStyle="width: 500px; height: 300px;" doLayout="true" labelposition="bottom">
|
||||
<sx:div id="left" label="test1" closable="true">
|
||||
I'm a Tab!!!
|
||||
</sx:div >
|
||||
<sx:div id="middle" label="test2" closable="true">
|
||||
I'm the other Tab!!!
|
||||
</sx:div >
|
||||
|
||||
</sx:tabbedpanel>
|
||||
|
||||
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +0,0 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8"%>
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
|
||||
<h1>OK</h1>
|
||||
<s:property value="name" /><br/>
|
||||
<s:property value="age" /><br/>
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax examples - tabbled panel</title>
|
||||
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<script>
|
||||
dojo.event.topic.subscribe('/before', function(event, tab, tabContainer) {
|
||||
alert("Before selecting tab. Set 'event.cancel=true' to prevent selection");
|
||||
});
|
||||
dojo.event.topic.subscribe('/after', function(tab, tabContainer) {
|
||||
alert("After tab was selected");
|
||||
});
|
||||
</script>
|
||||
<body>
|
||||
|
||||
<sx:tabbedpanel
|
||||
id="tabContainer"
|
||||
cssStyle="width: 500px; height: 300px;"
|
||||
doLayout="true"
|
||||
beforeSelectTabNotifyTopics="/before"
|
||||
afterSelectTabNotifyTopics="/after">
|
||||
<sx:div id="tab1" label="test1" >
|
||||
Tab 1
|
||||
</sx:div >
|
||||
<sx:div id="tab2" label="test2" >
|
||||
Tab 2
|
||||
</sx:div >
|
||||
</sx:tabbedpanel>
|
||||
|
||||
<br /><br />
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,28 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Tabbed Panes</title>
|
||||
<%@ include file="/WEB-INF/ajax/commonInclude.jsp" %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h2>Examples</h2>
|
||||
|
||||
<p>
|
||||
<ol>
|
||||
<li><a href="example2.jsp">A local tabbed panel width fixed size (doLayout="true")</a></li>
|
||||
<li><a href="example4.jsp">A Local tabbed panel with disabled tabs</a></li>
|
||||
<li><a href="example6.jsp">A Local tabbed panel that publishes topics when tabs are selected(before and after)</a></li>
|
||||
<li><a href="example3.jsp">A remote (href != "") and local tabbed panel</a></li>
|
||||
<li><a href="example1.jsp">Various remote and local tabbed panels (with enclosed tabbed pannels) with layout (doLayout="false")</a></li>
|
||||
<li><a href="example5.jsp">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")</a></li>
|
||||
</ol>
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
Hello, <br/>
|
||||
Today is ${todayDate?html}, the time now is ${todayTime?html}
|
||||
@@ -1,7 +0,0 @@
|
||||
|
||||
<div id="result">
|
||||
</div>
|
||||
<@sx.form action="panel2Submit" namespace="/nodecorate">
|
||||
<@s.textfield label="Name" name="name" />
|
||||
<@sx.submit targets="result" />
|
||||
</@sx.form>
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
Hello, ${name?html}
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
<div id="result">
|
||||
</div>
|
||||
|
||||
<@s.form action="panel3Submit" namespace="/nodecorate">
|
||||
<@sx.autocompleter label="Gender" name="gender" list="%{#{'Male':'Male','Female':'Female'}}" />
|
||||
<@sx.submit targets="result" />
|
||||
</@s.form>
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
So, you are a ${gender?html}
|
||||
@@ -1,14 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
alert('This JavaScript currently being evaluated is in the result...');
|
||||
</script>
|
||||
Show me some text also
|
||||
<script language="JavaScript" type="text/javascript">
|
||||
alert('And some more text for fun!');
|
||||
</script>
|
||||
@@ -1,23 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@include file="partialChunkHeader.jsp"%>
|
||||
<ul>
|
||||
<s:iterator value="category.children">
|
||||
<li>
|
||||
<s:if test="children.size() > 0">
|
||||
<sx:a href="toggle.action?catId=%{id}">+</sx:a>
|
||||
</s:if>
|
||||
<s:property value="name"/>
|
||||
</li>
|
||||
<s:if test="toggle">
|
||||
<s:set name="display" value="'none'"/>
|
||||
</s:if>
|
||||
<s:else>
|
||||
<s:set name="display" value="''"/>
|
||||
</s:else> ›
|
||||
|
||||
<sx:div id="children_%{id}"
|
||||
cssStyle="display: %{display}"
|
||||
href="getCategory.action?catId=%{id}"
|
||||
refreshListenTopic="children_%{id}"/>
|
||||
</s:iterator>
|
||||
</ul>
|
||||
@@ -1,6 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
@@ -1,12 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@include file="partialChunkHeader.jsp"%>
|
||||
<%
|
||||
response.setContentType("text/javascript");
|
||||
%>
|
||||
dojo.event.topic.publish("children_<s:property value="category.id"/>");
|
||||
var d = document.getElementById("children_<s:property value="category.id"/>");
|
||||
if (d.style.display != "none") {
|
||||
d.style.display = "none";
|
||||
} else {
|
||||
d.style.display = "";
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Tree</title>
|
||||
<sx:head />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<s:action name="getCategory" executeResult="true"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,40 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Ajax Widgets</title>
|
||||
<jsp:include page="/WEB-INF/ajax/commonInclude.jsp"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<br/>
|
||||
NOTES:
|
||||
<ul>
|
||||
<li>Make sure that there is a 'value' attribute in the textarea with the content for the editor</li>
|
||||
<li>This is experimental</li>
|
||||
</ul>
|
||||
|
||||
|
||||
Default Editor configuration:<br/>
|
||||
<s:form id="form1" action="AjaxRemoteForm" method="post">
|
||||
<sx:textarea name="data" cols="50" rows="10" value="Test Data 1" />
|
||||
<s:submit value="Submit"/>
|
||||
</s:form>
|
||||
<br/>
|
||||
|
||||
Configured Editor configuration:<br/>
|
||||
<s:form id="form2" action="AjaxRemoteForm" method="post">
|
||||
<sx:textarea id="editor2" name="data" cols="50" rows="10" value="Test Data 2">
|
||||
<s:param name="editorControls">textGroup;|;justifyGroup;|;listGroup;|;indentGroup</s:param>
|
||||
</sx:textarea>
|
||||
<s:submit value="Submit"/>
|
||||
</s:form>
|
||||
<br/>
|
||||
|
||||
<s:include value="../footer.jsp"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,27 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - Chat - Login</title>
|
||||
<@s.head />
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>Chat - Login</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<@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"/>
|
||||
</@s.form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
<@s.actionerror />
|
||||
<@s.fielderror />
|
||||
@@ -1,3 +0,0 @@
|
||||
|
||||
<% response.sendRedirect("main.action"); %>
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
|
||||
<table class="table">
|
||||
<tr class="tableHeader">
|
||||
<td class="tableSenderColumn">Sender</td>
|
||||
<td class="tableDateColumn">Date</td>
|
||||
<td class="tableMessageColumn">Message</td>
|
||||
</tr>
|
||||
<@s.iterator id="message" value="%{messagesAvailableInRoom}" status="stat">
|
||||
<tr class="tableContent">
|
||||
<#if stat.odd>
|
||||
<td class="tableSenderColumnOdd">
|
||||
<#else>
|
||||
<td clas="tableSenderColumnEven">
|
||||
</#if>
|
||||
<@s.property value="%{#message.creator.name}" />
|
||||
</td>
|
||||
<#if stat.odd>
|
||||
<td class="tableDateColumnOdd">
|
||||
<#else>
|
||||
<td class="tableDateColumnEven">
|
||||
</#if>
|
||||
<@s.property value="%{#message.creationDate}" />
|
||||
</td>
|
||||
<#if stat.odd>
|
||||
<td class="tableMessageColumnOdd">
|
||||
<#else>
|
||||
<td class="tableMessageColumnEven">
|
||||
</#if>
|
||||
<@s.property value="%{#message.message}" />
|
||||
</td>
|
||||
</tr>
|
||||
</@s.iterator>
|
||||
</table>
|
||||
@@ -1,172 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - Chat - Room Selection</title>
|
||||
<@sx.head />
|
||||
<style type="text/css">
|
||||
div.box {
|
||||
border: 1px solid darkblue;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
div.box h3 {
|
||||
color: white;
|
||||
background: darkblue;
|
||||
margin: 3px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
div.nobox {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
table.table {
|
||||
border: 1px solid darkblue;
|
||||
width: 98%;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
table.table tr.tableHeader {
|
||||
color: white;
|
||||
background: darkblue;
|
||||
margin: 3px;
|
||||
padding: 2px;
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.table td.tableOperationColumnOdd {
|
||||
background: gray;
|
||||
color: white;
|
||||
width: 20%
|
||||
}
|
||||
|
||||
table.table td.tableNameColumnOdd {
|
||||
background: gray;
|
||||
color: white;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.table td.tableDescriptionColumnOdd {
|
||||
background: gray;
|
||||
color: white;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
table.table td.tableDateCreatedColumnOdd {
|
||||
background: gray;
|
||||
color: white;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.table td.tableOperationColumnEven {
|
||||
background: white;
|
||||
color: gray;
|
||||
width: 20%
|
||||
}
|
||||
|
||||
table.table td.tableNameColumnEven {
|
||||
background: white;
|
||||
color: gray;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.table td.tableDescriptionColumnEven {
|
||||
background: white;
|
||||
color: gray;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
table.table td.tableDateCreatedColumnEven {
|
||||
background: white;
|
||||
color: gray;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
div.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.left {
|
||||
width: 20%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.right {
|
||||
width: 20%;
|
||||
float: right;
|
||||
}
|
||||
|
||||
div.center {
|
||||
width: 60%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>Chat - Room Selection</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12 container">
|
||||
|
||||
|
||||
<div class="left">
|
||||
<div class="box">
|
||||
<h3>Operations</h3>
|
||||
<@s.url id="url" action="logout" namespace="/chat" />
|
||||
<ul>
|
||||
<li><@s.a href="%{#url}">Logout</@s.a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<#if (actionErrors?size gt 0)>
|
||||
<div class="box">
|
||||
<h3>Action Errors</h3>
|
||||
<@s.actionerrors />
|
||||
</div>
|
||||
</#if>
|
||||
<div class="box">
|
||||
<h3>Users Available In Chat</h3>
|
||||
<@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 ...
|
||||
</@sx.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="center">
|
||||
<div class="box">
|
||||
<h3>Rooms Available In Chat</h3>
|
||||
<@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 ...
|
||||
</@sx.div>
|
||||
</div>
|
||||
|
||||
<div id="createRoom" class="box">
|
||||
<h3>Create Room In Chat</h3>
|
||||
|
||||
<div id="createRoomResult"></div>
|
||||
<@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" />
|
||||
</@s.form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
<table class="table">
|
||||
<tr class="tableHeader">
|
||||
<td>Operation</td>
|
||||
<td>Name</td>
|
||||
<td>Description</td>
|
||||
<td>Date Created</td>
|
||||
</tr>
|
||||
<@s.iterator id="room" value="%{availableRooms}" status="stat">
|
||||
<tr class="tableContent">
|
||||
<#if stat.isOdd()>
|
||||
<td class="tableOperationColumnOdd">
|
||||
<#else>
|
||||
<td class="tableOperationColumnEven">
|
||||
</#if>
|
||||
<@s.url id="url" action="enterRoom" namespace="/chat">
|
||||
<@s.param name="roomName" value="%{#room.name}" />
|
||||
</@s.url>
|
||||
<@s.a href="%{url}">Enter</@s.a>
|
||||
</td>
|
||||
<#if stat.odd>
|
||||
<td class="tableNameColumnOdd">
|
||||
<#else>
|
||||
<td class="tableNameColumnEven">
|
||||
</#if>
|
||||
<@s.property value="%{#room.name}" />
|
||||
</td>
|
||||
<#if stat.odd>
|
||||
<td class="tableDescriptionColumnOdd">
|
||||
<#else>
|
||||
<td class="tableDescriptionColumnEven">
|
||||
</#if>
|
||||
<@s.property value="%{#room.description}" />
|
||||
</td>
|
||||
<#if stat.odd>
|
||||
<td class="tableDateCreatedColumnOdd">
|
||||
<#else>
|
||||
<td class="tableDateCreateColumnEven">
|
||||
</#if>
|
||||
<@s.property value="%{#room.creationDate}" />
|
||||
</td>
|
||||
</tr>
|
||||
</@s.iterator>
|
||||
</table>
|
||||
@@ -1,2 +0,0 @@
|
||||
|
||||
<@s.fielderror />
|
||||
@@ -1,167 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - Chat - Show Room </title>
|
||||
<@sx.head />
|
||||
<style type="text/css">
|
||||
div.box {
|
||||
border: 1px solid darkblue;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
div.box h3 {
|
||||
color: white;
|
||||
background: darkblue;
|
||||
margin: 3px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
div.nobox {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
table.table {
|
||||
border: 1px solid darkblue;
|
||||
width: 98%;
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
table.table tr.tableHeader {
|
||||
color: white;
|
||||
background: darkblue;
|
||||
margin: 3px;
|
||||
padding: 2px;
|
||||
font-size: medium;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.table td.tableSenderColumnOdd {
|
||||
background: gray;
|
||||
color: white;
|
||||
width: 20%
|
||||
}
|
||||
|
||||
table.table td.tableDateColumnOdd {
|
||||
background: gray;
|
||||
color: white;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.table td.tableMessageColumnOdd {
|
||||
background: gray;
|
||||
color: white;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
table.table td.tableSenderColumnEven {
|
||||
background: white;
|
||||
color: gray;
|
||||
width: 20%
|
||||
}
|
||||
|
||||
table.table td.tableDateColumnEven {
|
||||
background: white;
|
||||
color: gray;
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.table td.tableMessageColumnEven {
|
||||
background: white;
|
||||
color: gray;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
div.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.left {
|
||||
width: 20%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.right {
|
||||
width: 20%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
div.center {
|
||||
width: 60%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>Chat - Show Room</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12 container">
|
||||
<div class="left">
|
||||
<div class="box">
|
||||
<h3>Operation</h3>
|
||||
<@s.url id="url" action="exitRoom" namespace="/chat">
|
||||
<@s.param name="roomName" value="%{roomName}" />
|
||||
</@s.url>
|
||||
<ul>
|
||||
<li><@s.a href="%{#url}">Exit Room</@s.a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box">
|
||||
<h3>Users Available In Chat</h3>
|
||||
<@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 ...
|
||||
</@sx.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="center">
|
||||
<div class="box">
|
||||
<h3>Messages Posted In Room [${roomName?default('')?html}]</h3>
|
||||
<@s.url id="url" value="/chat/ajax/messagesAvailableInRoom.action" includeContext="true">
|
||||
<@s.param name="roomName" value="%{roomName}" />
|
||||
</@s.url>
|
||||
<@sx.div id="messagesInRoom" href="%{#url}" includeContext="true"
|
||||
updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}"
|
||||
listenTopics="topicMessageSend">
|
||||
Initial Messages In Room ...
|
||||
</@sx.div>
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h3>Send Messages</h3>
|
||||
<@s.form id="sendMessageForm" action="sendMessageToRoom" namespace="/chat/ajax" method="POST">
|
||||
<div id="sendMessageResult"></div>
|
||||
<@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"/>
|
||||
</@s.form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="right">
|
||||
<div class="box">
|
||||
<h3>Users Available In Room [${roomName?default('')?html}]</h3>
|
||||
<@s.url id="url" value="/chat/ajax/usersAvailableInRoom.action" includeContext="true">
|
||||
<@s.param name="roomName" value="%{roomName}" />
|
||||
</@s.url>
|
||||
<@sx.div id="usersAvailableInRoom" href="%{#url}" includeContext="true"
|
||||
delay="1" updateFreq="%{@org.apache.struts2.showcase.chat.Constants@UPDATE_FREQ}">
|
||||
Initial Users Available In Room ...
|
||||
</@sx.div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
<ul>
|
||||
<#list availableUsers as user>
|
||||
<li>${user.name?html}</li>
|
||||
</#list>
|
||||
</ul>
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
<ul>
|
||||
<@s.iterator id="member" value="%{usersAvailableInRoom}">
|
||||
<li><@s.property value="%{#member.name}" /></li>
|
||||
</@s.iterator>
|
||||
</ul>
|
||||
|
||||
|
||||
@@ -7,21 +7,11 @@
|
||||
<pattern>/styles/*</pattern>
|
||||
<pattern>/scripts/*</pattern>
|
||||
<pattern>/images/*</pattern>
|
||||
<pattern>/dojo/*</pattern>
|
||||
<pattern>/struts/*</pattern>
|
||||
<pattern>/ajax/AjaxResult*</pattern>
|
||||
<pattern>/AjaxTest.action</pattern>
|
||||
<pattern>/ajax/remoteforms/AjaxRemoteForm.action</pattern>
|
||||
<pattern>/tags/ui/ajax/*</pattern>
|
||||
<pattern>/chat/ajax/*</pattern>
|
||||
<pattern>/hangman/ajax/*</pattern>
|
||||
<pattern>/nodecorate/*</pattern>
|
||||
</excludes>
|
||||
|
||||
<decorator name="main" page="main.jsp">
|
||||
<pattern>/*</pattern>
|
||||
</decorator>
|
||||
<!--<decorator name="panel" page="panel.jsp"/>-->
|
||||
<!--<decorator name="dashedBox" page="dashedBox.jsp"/>-->
|
||||
<!--<decorator name="printable" page="printable.jsp"/>-->
|
||||
</decorators>
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
<!DOCTYPE html>
|
||||
<%@ page
|
||||
language="java"
|
||||
contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
language="java"
|
||||
contentType="text/html; charset=UTF-8"
|
||||
pageEncoding="UTF-8" %>
|
||||
<%
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
response.setHeader("Pragma", "no-cache");
|
||||
response.setHeader("Cache-Control", "no-cache");
|
||||
response.setDateHeader("Expires", 0);
|
||||
|
||||
// Calculate the view sources url
|
||||
String sourceUrl = request.getContextPath()+"/viewSource.action";
|
||||
com.opensymphony.xwork2.ActionInvocation inv = com.opensymphony.xwork2.ActionContext.getContext().getActionInvocation();
|
||||
org.apache.struts2.dispatcher.mapper.ActionMapping mapping = org.apache.struts2.ServletActionContext.getActionMapping();
|
||||
if (inv != null) {
|
||||
try {
|
||||
com.opensymphony.xwork2.util.location.Location loc = inv.getProxy().getConfig().getLocation();
|
||||
sourceUrl += "?config="+(loc != null ? loc.getURI()+":"+loc.getLineNumber() : "");
|
||||
} catch (Exception e) {
|
||||
sourceUrl += "?config=";
|
||||
}
|
||||
sourceUrl += "&className="+inv.getProxy().getConfig().getClassName();
|
||||
// Calculate the view sources url
|
||||
String sourceUrl = request.getContextPath() + "/viewSource.action";
|
||||
com.opensymphony.xwork2.ActionInvocation inv = com.opensymphony.xwork2.ActionContext.getContext().getActionInvocation();
|
||||
org.apache.struts2.dispatcher.mapper.ActionMapping mapping = org.apache.struts2.ServletActionContext.getActionMapping();
|
||||
if (inv != null) {
|
||||
try {
|
||||
com.opensymphony.xwork2.util.location.Location loc = inv.getProxy().getConfig().getLocation();
|
||||
sourceUrl += "?config=" + (loc != null ? loc.getURI() + ":" + loc.getLineNumber() : "");
|
||||
} catch (Exception e) {
|
||||
sourceUrl += "?config=";
|
||||
}
|
||||
sourceUrl += "&className=" + inv.getProxy().getConfig().getClassName();
|
||||
|
||||
if (inv.getResult() != null && inv.getResult() instanceof org.apache.struts2.dispatcher.StrutsResultSupport) {
|
||||
sourceUrl += "&page="+mapping.getNamespace()+"/"+((org.apache.struts2.dispatcher.StrutsResultSupport)inv.getResult()).getLastFinalLocation();
|
||||
}
|
||||
} else {
|
||||
sourceUrl += "?page="+request.getServletPath();
|
||||
}
|
||||
if (inv.getResult() != null && inv.getResult() instanceof org.apache.struts2.dispatcher.StrutsResultSupport) {
|
||||
sourceUrl += "&page=" + mapping.getNamespace() + "/" + ((org.apache.struts2.dispatcher.StrutsResultSupport) inv.getResult()).getLastFinalLocation();
|
||||
}
|
||||
} else {
|
||||
sourceUrl += "?page=" + request.getServletPath();
|
||||
}
|
||||
%>
|
||||
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
|
||||
<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
|
||||
@@ -34,238 +34,210 @@
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
|
||||
<meta name="description" content="Struts2 Showcase for Apache Struts Project">
|
||||
<meta name="author" content="The Apache Software Foundation">
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
|
||||
<meta name="description" content="Struts2 Showcase for Apache Struts Project">
|
||||
<meta name="author" content="The Apache Software Foundation">
|
||||
|
||||
<title><decorator:title default="Struts2 Showcase"/></title>
|
||||
<title><decorator:title default="Struts2 Showcase"/></title>
|
||||
|
||||
<link href="<s:url value='/styles/bootstrap.css' encode='false' includeParams='none'/>" rel="stylesheet"
|
||||
type="text/css" media="all">
|
||||
<link href="<s:url value='/styles/bootstrap-responsive.css' encode='false' includeParams='none'/>" rel="stylesheet"
|
||||
type="text/css" media="all">
|
||||
<link href="<s:url value='/styles/main.css' encode='false' includeParams='none'/>" rel="stylesheet" type="text/css"
|
||||
media="all"/>
|
||||
<link href="<s:url value='/styles/bootstrap.css' encode='false' includeParams='none'/>" rel="stylesheet"
|
||||
type="text/css" media="all">
|
||||
<link href="<s:url value='/styles/bootstrap-responsive.css' encode='false' includeParams='none'/>" rel="stylesheet"
|
||||
type="text/css" media="all">
|
||||
<link href="<s:url value='/styles/main.css' encode='false' includeParams='none'/>" rel="stylesheet" type="text/css"
|
||||
media="all"/>
|
||||
|
||||
<script src="<s:url value='/js/jquery-1.8.2.min.js' encode='false' includeParams='none'/>"></script>
|
||||
<script src="<s:url value='/js/bootstrap.min.js' encode='false' includeParams='none'/>"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('.dropdown-toggle').dropdown();
|
||||
var alerts = $('ul.alert').wrap('<div />');
|
||||
alerts.prepend('<a class="close" data-dismiss="alert" href="#">×</a>');
|
||||
alerts.alert();
|
||||
});
|
||||
</script>
|
||||
<script src="<s:url value='/js/jquery-1.8.2.min.js' encode='false' includeParams='none'/>"></script>
|
||||
<script src="<s:url value='/js/bootstrap.min.js' encode='false' includeParams='none'/>"></script>
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
$('.dropdown-toggle').dropdown();
|
||||
var alerts = $('ul.alert').wrap('<div />');
|
||||
alerts.prepend('<a class="close" data-dismiss="alert" href="#">×</a>');
|
||||
alerts.alert();
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Prettify -->
|
||||
<link href="<s:url value='/styles/prettify.css' encode='false' includeParams='none'/>" rel="stylesheet">
|
||||
<script src="<s:url value='/js/prettify.js' encode='false' includeParams='none'/>"></script>
|
||||
<!-- Prettify -->
|
||||
<link href="<s:url value='/styles/prettify.css' encode='false' includeParams='none'/>" rel="stylesheet">
|
||||
<script src="<s:url value='/js/prettify.js' encode='false' includeParams='none'/>"></script>
|
||||
|
||||
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<decorator:head/>
|
||||
<decorator:head/>
|
||||
</head>
|
||||
|
||||
<body id="page-home" onload="prettyPrint();">
|
||||
|
||||
<div class="navbar navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<s:a value="/showcase.jsp" cssClass="brand">Struts2 Showcase</s:a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li><s:a value="/showcase.jsp"><i class="icon-home"></i> Home</s:a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Configuration<b
|
||||
class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:a action="actionChain1!input" namespace="/actionchaining"
|
||||
includeParams="none">Action Chaining</s:a></li>
|
||||
<li><s:a action="index" namespace="/config-browser"
|
||||
includeParams="none">Config Browser</s:a></li>
|
||||
<li><s:a value="/conversion/index.jsp">Conversion</s:a></li>
|
||||
<li><s:a value="/person/index.html">Person Manager ( by Conventions )</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tags<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">Non UI Tags</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:url var="url" action="showActionTagDemo" namespace="/tags/non-ui/actionTag"/><s:a
|
||||
href="%{url}">Action Tag</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/non-ui" action="date"/><s:a
|
||||
href="%{url}">Date Tag</s:a></li>
|
||||
<li><s:url var="url" action="debugTagDemo" namespace="/tags/non-ui"/><s:a
|
||||
href="%{url}">Debug Tag</s:a></li>
|
||||
<li><s:url var="url" action="showGeneratorTagDemo"
|
||||
namespace="/tags/non-ui/iteratorGeneratorTag"/><s:a
|
||||
href="%{url}">Iterator Generator Tag</s:a></li>
|
||||
<li>
|
||||
<s:url var="url" action="showAppendTagDemo"
|
||||
namespace="/tags/non-ui/appendIteratorTag"/>
|
||||
<s:a href="%{#url}">Append Iterator Tag</s:a>
|
||||
<li>
|
||||
<s:url var="url" action="showMergeTagDemo"
|
||||
namespace="/tags/non-ui/mergeIteratorTag"/>
|
||||
<s:a href="%{#url}">Merge Iterator Demo</s:a>
|
||||
<li>
|
||||
<s:url var="url" action="showSubsetTagDemo"
|
||||
namespace="/tags/non-ui/subsetIteratorTag"/>
|
||||
<s:a href="%{#url}">Subset Tag</s:a>
|
||||
<li><s:url var="url" action="actionPrefixExampleUsingFreemarker"
|
||||
namespace="/tags/non-ui/actionPrefix"/><s:a
|
||||
href="%{#url}">Action Prefix Example (Freemarker)</s:a></li>
|
||||
<li><s:url var="url" action="testIfTagJsp" namespace="/tags/non-ui/ifTag"/><s:a
|
||||
href="%{#url}">If Tag (JSP)</s:a></li>
|
||||
<li><s:url var="url" action="testIfTagFreemarker"
|
||||
namespace="/tags/non-ui/ifTag"/><s:a
|
||||
href="%{#url}">If Tag (Freemarker)</s:a></li>
|
||||
</ul>
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</a>
|
||||
<s:a value="/showcase.jsp" cssClass="brand">Struts2 Showcase</s:a>
|
||||
<div class="nav-collapse">
|
||||
<ul class="nav">
|
||||
<li><s:a value="/showcase.jsp"><i class="icon-home"></i> Home</s:a></li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Configuration<b
|
||||
class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:a action="actionChain1!input" namespace="/actionchaining"
|
||||
includeParams="none">Action Chaining</s:a></li>
|
||||
<li><s:a action="index" namespace="/config-browser"
|
||||
includeParams="none">Config Browser</s:a></li>
|
||||
<li><s:a value="/conversion/index.jsp">Conversion</s:a></li>
|
||||
<li><s:a value="/person/index.html">Person Manager ( by Conventions )</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Tags<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">Non UI Tags</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:url var="url" action="showActionTagDemo" namespace="/tags/non-ui/actionTag"/><s:a
|
||||
href="%{url}">Action Tag</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/non-ui" action="date"/><s:a
|
||||
href="%{url}">Date Tag</s:a></li>
|
||||
<li><s:url var="url" action="debugTagDemo" namespace="/tags/non-ui"/><s:a
|
||||
href="%{url}">Debug Tag</s:a></li>
|
||||
<li><s:url var="url" action="showGeneratorTagDemo"
|
||||
namespace="/tags/non-ui/iteratorGeneratorTag"/><s:a
|
||||
href="%{url}">Iterator Generator Tag</s:a></li>
|
||||
<li>
|
||||
<s:url var="url" action="showAppendTagDemo"
|
||||
namespace="/tags/non-ui/appendIteratorTag"/>
|
||||
<s:a href="%{#url}">Append Iterator Tag</s:a>
|
||||
<li>
|
||||
<s:url var="url" action="showMergeTagDemo"
|
||||
namespace="/tags/non-ui/mergeIteratorTag"/>
|
||||
<s:a href="%{#url}">Merge Iterator Demo</s:a>
|
||||
<li>
|
||||
<s:url var="url" action="showSubsetTagDemo"
|
||||
namespace="/tags/non-ui/subsetIteratorTag"/>
|
||||
<s:a href="%{#url}">Subset Tag</s:a>
|
||||
<li><s:url var="url" action="actionPrefixExampleUsingFreemarker"
|
||||
namespace="/tags/non-ui/actionPrefix"/><s:a
|
||||
href="%{#url}">Action Prefix Example (Freemarker)</s:a></li>
|
||||
<li><s:url var="url" action="testIfTagJsp" namespace="/tags/non-ui/ifTag"/><s:a
|
||||
href="%{#url}">If Tag (JSP)</s:a></li>
|
||||
<li><s:url var="url" action="testIfTagFreemarker"
|
||||
namespace="/tags/non-ui/ifTag"/><s:a
|
||||
href="%{#url}">If Tag (Freemarker)</s:a></li>
|
||||
</ul>
|
||||
|
||||
</li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">UI Tags</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:url var="url" namespace="/tags/ui" action="example" method="input"/><s:a
|
||||
href="%{url}">UI Example</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="exampleVelocity"
|
||||
method="input"/><s:a href="%{url}">UI Example (Velocity)</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="lotsOfOptiontransferselect"
|
||||
method="input"/><s:a
|
||||
href="%{url}">Option Transfer Select UI Example</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="moreSelects" method="input"/><s:a
|
||||
href="%{url}">More Select Box UI Examples</s:a></li>
|
||||
<li>
|
||||
<s:url var="url" namespace="/tags/ui" action="treeExampleStatic"/>
|
||||
<s:a href="%{url}">Tree Example (static)</s:a>
|
||||
<li>
|
||||
<s:url var="url" namespace="/tags/ui" action="showDynamicTreeAction"/>
|
||||
<s:a href="%{url}">Tree Example (dynamic)</s:a>
|
||||
<li>
|
||||
<s:url var="url" namespace="/tags/ui" action="showDynamicAjaxTreeAction"/>
|
||||
<s:a href="%{url}">Tree Example (dynamic ajax loading)</s:a>
|
||||
<li>
|
||||
<s:url var="url" namespace="/tags/ui" action="componentTagExample"/>
|
||||
<s:a href="%{#url}">Component Tag Example</s:a>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="actionTagExample" method="input"/><s:a
|
||||
href="%{url}">Action Tag Example</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="datepicker"/><s:a
|
||||
href="%{#url}">DateTime picker tag - Pick a date</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="timepicker"/><s:a
|
||||
href="%{#url}">DateTime picker tag - Pick a time</s:a></li>
|
||||
<%--li><s:url var="url" namespace="/tags/ui" action="populateUsingIterator" method="input" /><s:a href="%{url}">UI population using iterator tag</s:a></li--%>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">File<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:a namespace="/filedownload" action="index">File Download</s:a></li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">File Upload</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<s:url var="url" action="upload" namespace="/fileupload"/>
|
||||
<s:a href="%{#url}">Single File Upload</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="multipleUploadUsingList" namespace="/fileupload"/>
|
||||
<s:a href="%{#url}">Multiple File Upload (List)</s:a>
|
||||
</li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">UI Tags</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:url var="url" namespace="/tags/ui" action="example" method="input"/><s:a
|
||||
href="%{url}">UI Example</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="exampleVelocity"
|
||||
method="input"/><s:a href="%{url}">UI Example (Velocity)</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="lotsOfOptiontransferselect"
|
||||
method="input"/><s:a
|
||||
href="%{url}">Option Transfer Select UI Example</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="moreSelects" method="input"/><s:a
|
||||
href="%{url}">More Select Box UI Examples</s:a></li>
|
||||
<li>
|
||||
<s:url var="url" namespace="/tags/ui" action="componentTagExample"/>
|
||||
<s:a href="%{#url}">Component Tag Example</s:a></li>
|
||||
<li><s:url var="url" namespace="/tags/ui" action="actionTagExample" method="input"/><s:a
|
||||
href="%{url}">Action Tag Example</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">File<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:a namespace="/filedownload" action="index">File Download</s:a></li>
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">File Upload</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<s:url var="url" action="upload" namespace="/fileupload"/>
|
||||
<s:a href="%{#url}">Single File Upload</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="multipleUploadUsingList" namespace="/fileupload"/>
|
||||
<s:a href="%{#url}">Multiple File Upload (List)</s:a>
|
||||
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="multipleUploadUsingArray" namespace="/fileupload"/>
|
||||
<s:a href="%{#url}">Multiple File Upload (Array)</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Examples<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">Hangman</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:url var="url" namespace="/hangman" action="hangmanNonAjax"/><s:a
|
||||
href="%{url}">Hangman (Non Ajax)</s:a></li>
|
||||
<li><s:url var="url" namespace="/hangman" action="hangmanAjax"/><s:a
|
||||
href="%{url}">Hangman (Ajax - Experimental)</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><s:a value="/person/index.html">Person Manager</s:a></li>
|
||||
<li><s:a value="/skill/index.html">CRUD</s:a></li>
|
||||
<li><s:a value="/wait/index.html">Execute & Wait</s:a></li>
|
||||
<li><s:a value="/token/index.html">Token</s:a></li>
|
||||
<li><s:a value="/validation/index.action">Validation</s:a></li>
|
||||
<li><s:url var="url" namespace="/modelDriven" action="modelDriven"/><s:a
|
||||
href="%{url}">Model Driven</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Integration<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">Freemarker</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<s:url var="url" action="customFreemarkerManagerDemo" namespace="/freemarker"/>
|
||||
<s:a href="%{#url}">Demo of usage of a Custom Freemarker Manager</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="standardTags" namespace="/freemarker"/>
|
||||
<s:a href="%{#url}">Demo of Standard Struts Freemarker Tags</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><s:a namespace="/jsf" action="index">JavaServer Faces</s:a></li>
|
||||
<li><s:a namespace="/integration" action="editGangster">Struts 1 Integration</s:a></li>
|
||||
<li><s:a value="/tiles/index.action">Tiles</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">AJAX<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:a value="/ajax/index.html">Ajax plugin</s:a></li>
|
||||
<li><s:a value="/chat/index.html">Ajax Chat</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><s:a value="/interactive/index.action">Interactive Demo</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="multipleUploadUsingArray" namespace="/fileupload"/>
|
||||
<s:a href="%{#url}">Multiple File Upload (Array)</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Examples<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-submenu">
|
||||
<li>
|
||||
<s:url var="url" namespace="/hangman" action="hangmanNonAjax"/>
|
||||
<s:a href="%{url}">Hangman</s:a>
|
||||
</li>
|
||||
<li><s:a value="/person/index.html">Person Manager</s:a></li>
|
||||
<li><s:a value="/skill/index.html">CRUD</s:a></li>
|
||||
<li><s:a value="/wait/index.html">Execute & Wait</s:a></li>
|
||||
<li><s:a value="/token/index.html">Token</s:a></li>
|
||||
<li><s:a value="/validation/index.action">Validation</s:a></li>
|
||||
<li><s:url var="url" namespace="/modelDriven" action="modelDriven"/><s:a
|
||||
href="%{url}">Model Driven</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Integration<b class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li class="dropdown-submenu">
|
||||
<a href="#">Freemarker</a>
|
||||
<ul class="dropdown-menu">
|
||||
<li>
|
||||
<s:url var="url" action="customFreemarkerManagerDemo" namespace="/freemarker"/>
|
||||
<s:a href="%{#url}">Demo of usage of a Custom Freemarker Manager</s:a>
|
||||
</li>
|
||||
<li>
|
||||
<s:url var="url" action="standardTags" namespace="/freemarker"/>
|
||||
<s:a href="%{#url}">Demo of Standard Struts Freemarker Tags</s:a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><s:a value="/tiles/index.action">Tiles</s:a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="nav pull-right">
|
||||
<li class="dropdown last">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-flag"></i> Help<b
|
||||
class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:a value="/help.jsp">Help</s:a></li>
|
||||
<li><a href="http://struts.apache.org/mail.html"><i class="icon-share"></i> User Mailing
|
||||
List</a></li>
|
||||
<li><a href="http://struts.apache.org/2.x/"><i class="icon-share"></i> Struts2 Website</a>
|
||||
</li>
|
||||
<li><a href="http://struts.apache.org/2.x/docs/home.html"><i class="icon-share"></i>
|
||||
Documentation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
<ul class="nav pull-right">
|
||||
<li class="dropdown last">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-flag"></i> Help<b
|
||||
class="caret"></b></a>
|
||||
<ul class="dropdown-menu">
|
||||
<li><s:a value="/help.jsp">Help</s:a></li>
|
||||
<li><a href="http://struts.apache.org/mail.html"><i class="icon-share"></i> User Mailing
|
||||
List</a></li>
|
||||
<li><a href="http://struts.apache.org"><i class="icon-share"></i> Struts2 Website</a>
|
||||
</li>
|
||||
<li><a href="http://struts.apache.org/docs/home.html"><i class="icon-share"></i>
|
||||
Documentation</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--/.nav-collapse -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<decorator:body/>
|
||||
@@ -274,34 +246,34 @@
|
||||
<hr>
|
||||
|
||||
<footer id="footer" class="footer">
|
||||
<div>
|
||||
<p style="text-align: center;">
|
||||
<a href="<%=sourceUrl %>" class="btn btn-info">View Sources</a>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<p style="text-align: center;">
|
||||
<a href="<%=sourceUrl %>" class="btn btn-info">View Sources</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="pull-right">
|
||||
<div>
|
||||
<s:action var="dateAction" name="date" namespace="/" executeResult="true"/>
|
||||
</div>
|
||||
<!-- end branding -->
|
||||
<div class="pull-right">
|
||||
<div>
|
||||
<s:action var="dateAction" name="date" namespace="/" executeResult="true"/>
|
||||
</div>
|
||||
<!-- end branding -->
|
||||
|
||||
<div>
|
||||
<a href="http://struts.apache.org/2.x/">
|
||||
<img src="<s:url value='/img/struts-power.gif' encode='false' includeParams='none'/>"
|
||||
alt="Powered by Struts"/>
|
||||
</a>
|
||||
</div>
|
||||
<!-- end search -->
|
||||
</div>
|
||||
<div>
|
||||
<a href="http://struts.apache.org/2.x/">
|
||||
<img src="<s:url value='/img/struts-power.gif' encode='false' includeParams='none'/>"
|
||||
alt="Powered by Struts"/>
|
||||
</a>
|
||||
</div>
|
||||
<!-- end search -->
|
||||
</div>
|
||||
|
||||
<div class="pull-left">
|
||||
Copyright © 2003-<s:property value="#dateAction.now.year + 1900"/>
|
||||
<a href="http://www.apache.org">
|
||||
The Apache Software Foundation.
|
||||
</a>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
Copyright © 2003-<s:property value="#dateAction.now.year + 1900"/>
|
||||
<a href="http://www.apache.org">
|
||||
The Apache Software Foundation.
|
||||
</a>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<s:if test="currentEmployee!=null">
|
||||
@@ -35,7 +34,7 @@
|
||||
<s:textfield label="Employee Id" name="currentEmployee.empId"/>
|
||||
<s:textfield label="%{getText('employee.firstName')}" name="currentEmployee.firstName"/>
|
||||
<s:textfield label="%{getText('employee.lastName')}" name="currentEmployee.lastName"/>
|
||||
<sx:datetimepicker label="Birthdate" name="currentEmployee.birthDate"/>
|
||||
<s:textfield type="date" label="Birthdate" name="currentEmployee.birthDate"/>
|
||||
<s:textfield label="Salary" name="currentEmployee.salary" value="%{getText('format.number',{currentEmployee.salary})}" />
|
||||
<s:checkbox fieldValue="true" label="Married" name="currentEmployee.married"/>
|
||||
<s:combobox list="availablePositions" label="Position" name="currentEmployee.position"/>
|
||||
|
||||
@@ -1,247 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - Hangman (AJAX)</title>
|
||||
<@sx.head />
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>Hangman</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<script>
|
||||
function destroyWidgets() {
|
||||
var div = dojo.byId("updateCharacterAvailableDiv");
|
||||
var anchors = div.getElementsByTagName("a");
|
||||
dojo.lang.forEach(anchors, function (anchor) {
|
||||
var widget = dojo.widget.byId(anchor);
|
||||
widget.destroy();
|
||||
});
|
||||
}
|
||||
|
||||
var _listeners = {
|
||||
guessMade:function (request, widget) {
|
||||
var sourceId = widget.widgetId;
|
||||
this.guessMadeFunc(sourceId);
|
||||
this.updateCharacterAvailable(sourceId);
|
||||
this.updateVocab(sourceId);
|
||||
this.updateScaffold(sourceId);
|
||||
this.updateGuessLeft(sourceId);
|
||||
},
|
||||
guessMadeFunc:function (sourceId) {
|
||||
var requestAttr = { character:sourceId };
|
||||
dojo.io.bind({
|
||||
url:"<@s.url action="guessCharacter" namespace="/hangman" />",
|
||||
load:function (type, data, event) {
|
||||
|
||||
},
|
||||
mimetype:"text/html",
|
||||
content:requestAttr
|
||||
});
|
||||
},
|
||||
updateCharacterAvailable:function (sourceId) {
|
||||
dojo.io.bind({
|
||||
url:"<@s.url action="updateCharacterAvailable" namespace="/hangman/ajax" />",
|
||||
load:function (type, data, event) {
|
||||
var div = dojo.byId("updateCharacterAvailableDiv");
|
||||
destroyWidgets();
|
||||
div.innerHTML = data;
|
||||
|
||||
try {
|
||||
var xmlParser = new dojo.xml.Parse();
|
||||
var frag = xmlParser.parseElement(div, null, true);
|
||||
dojo.widget.getParser().createComponents(frag);
|
||||
// eval any scripts being returned
|
||||
var scripts = div.getElementsByTagName('script');
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
eval(scripts[i].innerHTML);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
alert('dojo error ' + e);
|
||||
dojo.debug("auto-build-widgets error: " + e);
|
||||
}
|
||||
},
|
||||
mimetype:"text/html"
|
||||
});
|
||||
},
|
||||
updateVocab:function (sourceId) {
|
||||
dojo.io.bind({
|
||||
url:"<@s.url action="updateVocabCharacters" namespace="/hangman/ajax" />",
|
||||
load:function (type, data, event) {
|
||||
var div = dojo.byId("updateVocabDiv");
|
||||
div.innerHTML = data;
|
||||
|
||||
try {
|
||||
var xmlParser = new dojo.xml.Parse();
|
||||
var frag = xmlParser.parseElement(div, null, true);
|
||||
|
||||
var scripts = div.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
eval(scripts[i].innerHTML);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
alert("dojo error" + e);
|
||||
dojo.debug("auto-build-widgets error: " + e);
|
||||
}
|
||||
},
|
||||
mimetype:"text/html"
|
||||
});
|
||||
},
|
||||
updateScaffold:function (sourceId) {
|
||||
dojo.io.bind({
|
||||
url:"<@s.url action="updateScaffold" namespace="/hangman/ajax" />",
|
||||
load:function (type, data, event) {
|
||||
var div = dojo.byId("updateScaffoldDiv");
|
||||
div.innerHTML = data;
|
||||
|
||||
try {
|
||||
var xmlParser = new dojo.xml.Parse();
|
||||
var frag = xmlParser.parseElement(div, null, true);
|
||||
|
||||
var scripts = div.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
eval(scripts[i].innerHTML);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
alert("dojo error" + e);
|
||||
dojo.debug("auto-build-widgets error: " + e);
|
||||
}
|
||||
},
|
||||
mimetype:"text/html"
|
||||
});
|
||||
},
|
||||
updateGuessLeft:function (sourceId) {
|
||||
dojo.io.bind({
|
||||
url:"<@s.url action="updateGuessLeft" namespace="/hangman/ajax" />",
|
||||
load:function (type, data, event) {
|
||||
var div = dojo.byId("updateGuessLeftDiv");
|
||||
div.innerHTML = data;
|
||||
|
||||
try {
|
||||
var xmlParser = new dojo.xml.Parse();
|
||||
var frag = xmlParser.parseElement(div, null, true);
|
||||
|
||||
var scripts = div.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
eval(scripts[i].innerHTML);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
alert("dojo error" + e);
|
||||
dojo.debug("auto-build-widgets error: " + e);
|
||||
}
|
||||
},
|
||||
mimetype:"text/html"
|
||||
});
|
||||
}
|
||||
};
|
||||
dojo.event.topic.subscribe("topicGuessMade", _listeners, "guessMade");
|
||||
</script>
|
||||
|
||||
<table bgcolor="green">
|
||||
<tr>
|
||||
<td>
|
||||
<@s.url id="url" value="/hangman/images/hangman.png" />
|
||||
<img alt="Hangman" src="<@s.property value="%{#url}" />"
|
||||
width="197" height="50" border="0"/>
|
||||
</td>
|
||||
<td width="70" align="right">
|
||||
<#-- Guesses Left -->
|
||||
<div id="updateGuessLeftDiv">
|
||||
<@s.set name="guessLeftImageName" value="%{'Chalkboard_'+hangman.guessLeft()+'.png'}" />
|
||||
<@s.url id="url" value="%{'/hangman/images/'+#guessLeftImageName}" />
|
||||
<img alt="No. Guesses Left"
|
||||
src="<@s.property value="%{#url}"/>" width="20" height="20" border="0"/>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<@s.url id="url" value="/hangman/images/guesses-left.png" />
|
||||
<img alt="Guesses Left"
|
||||
src="<@s.property value="%{#url}" />" width="164" height="11" border="0"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td align="left">
|
||||
<#-- Display Scaffold -->
|
||||
<div id="updateScaffoldDiv">
|
||||
<@s.set name="scaffoldImageName" value="%{'scaffold_'+hangman.guessLeft()+'.png'}" />
|
||||
<@s.url id="url" value="%{'/hangman/images/'+#scaffoldImageName}" />
|
||||
<img src="<@s.property value="%{#url}" />" border="0"/>
|
||||
</div>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width="160">
|
||||
<p align="right">
|
||||
<@s.url id="url" value="/hangman/images/guess.png" />
|
||||
<img alt="Current Guess" src="<@s.property value="%{#url}" />"
|
||||
align="MIDDLE" width="127" height="20" border="0"/></p>
|
||||
</td>
|
||||
<td>
|
||||
<#-- Display Vacab -->
|
||||
<div id="updateVocabDiv">
|
||||
<@s.iterator id="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat">
|
||||
<#if hangman.characterGuessedBefore(currentCharacter)>
|
||||
<@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter.toString()+'.png'}" />
|
||||
<@s.url id="url" value="%{'/hangman/images/'+#chalkboardImageName}" />
|
||||
<img height="36" alt="<@s.property value="%{#currentCharacter}" />"
|
||||
src="<@s.property value="%{#url}" />" width="36" border="0"/>
|
||||
<#else>
|
||||
<@s.url id="url" value="/hangman/images/Chalkboard_underscroll.png" />
|
||||
<img height="36" alt="_"
|
||||
src="<@s.property value="%{#url}" />" width="36" border="0"/>
|
||||
</#if>
|
||||
</@s.iterator>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<p align="right">
|
||||
<@s.url id="url" value="/hangman/images/choose.png" />
|
||||
<img alt="Choose" src="<@s.property value="%{#url}" />"
|
||||
height="20" width="151" border="0"/>
|
||||
</p>
|
||||
</td>
|
||||
<td width="330">
|
||||
|
||||
<#-- Show Characters Available -->
|
||||
<div id="updateCharacterAvailableDiv">
|
||||
<@s.iterator id="currentCharacter" value="%{hangman.charactersAvailable}" status="stat">
|
||||
<@s.set name="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter+'.png'}" />
|
||||
<@s.url id="chalkboardImageUrl" value="%{'/hangman/images/'+#chalkboardImageName}" />
|
||||
<@s.url id="spacerUrl" value="/hangman/images/letter-spacer.png" />
|
||||
|
||||
<@s.url id="blankUrl" value="ajax/blank.action" includeContext="false" />
|
||||
<@sx.a id="%{#currentCharacter}"
|
||||
beforeNotifyTopics="topicGuessMade"
|
||||
showErrorTransportText="true">
|
||||
<img height="36" alt="" src="<@s.property value="%{#chalkboardImageUrl}" />" width="36" border="0"/>
|
||||
</@sx.a>
|
||||
</@s.iterator>
|
||||
</div>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - Struts1 Integration</title>
|
||||
<s:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Struts1 Integration</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
|
||||
<s:form action="saveGangster" namespace="/integration">
|
||||
|
||||
<s:textfield
|
||||
label="Gangster Name"
|
||||
name="name"/>
|
||||
<s:textfield
|
||||
label="Gangster Age"
|
||||
name="age"/>
|
||||
<s:checkbox
|
||||
label="Gangster Busted Before"
|
||||
name="bustedBefore"/>
|
||||
<s:textarea
|
||||
cols="30"
|
||||
rows="5"
|
||||
label="Gangster Description"
|
||||
name="description"/>
|
||||
<s:submit cssClass="btn btn-primary"/>
|
||||
|
||||
</s:form>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,43 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - Struts1 Integration - Result</title>
|
||||
<style type="text/css">
|
||||
.label {
|
||||
background-color: #ffffff;
|
||||
color: #000000;
|
||||
text-shadow: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Struts1 Integration - Result</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<s:actionmessage cssClass="alert alert-info"/>
|
||||
<s:label
|
||||
label="Gangster Name"
|
||||
name="name" /><br/>
|
||||
<s:label
|
||||
label="Gangster Age"
|
||||
name="age" /><br/>
|
||||
<s:label
|
||||
label="Busted Before"
|
||||
name="bustedBefore" /><br/>
|
||||
<s:label
|
||||
label="Gangster Description"
|
||||
name="description" /><br/>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,76 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<pre style="font-style: normal;">
|
||||
<span class="kw">package</span> org.apache.struts2.showcase.action;
|
||||
|
||||
<span class="kw">import</span> java.util.Arrays;
|
||||
<span class="kw">import</span> java.util.Date;
|
||||
<span class="kw">import</span> java.util.HashMap;
|
||||
<span class="kw">import</span> java.util.List;
|
||||
<span class="kw">import</span> java.util.Map;
|
||||
|
||||
<span class="kw">import</span> com.opensymphony.xwork2.ActionSupport;
|
||||
|
||||
<span class="kw">public class</span> ExampleAction <span class="kw">extends</span> ActionSupport {
|
||||
<span class="kw">public static final</span> String CONSTANT = "Struts Rocks!";
|
||||
|
||||
<span class="kw">public static</span> Date getCurrentDate() {
|
||||
return new Date();
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String getName() {
|
||||
return "John Galt";
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String[] getBands() {
|
||||
return new String[] { "Pink Floyd", "Metallica", "Guns & Roses" };
|
||||
}
|
||||
|
||||
<span class="kw">public</span> List<String> getMovies() {
|
||||
return Arrays.asList("Lord of the Rings", "Matrix");
|
||||
}
|
||||
|
||||
<span class="kw">public</span> Book getBook() {
|
||||
<span class="kw">return</span> new Book("Iliad", "Homer");
|
||||
}
|
||||
|
||||
<span class="kw">public</span> Map<String, Book> getBooks() {
|
||||
Map<String, Book> books = new HashMap<String, Book>();
|
||||
books.put("Iliad", new Book("Iliad", "Homer"));
|
||||
books.put("The Republic", new Book("The Replublic", "Plato"));
|
||||
books.put("Thus Spake Zarathustra", new Book("Thus Spake Zarathustra",
|
||||
"Friedrich Nietzsche"));
|
||||
return books;
|
||||
}
|
||||
}
|
||||
|
||||
<span class="kw">class</span> Book {
|
||||
<span class="kw">private</span> String title;
|
||||
<span class="kw">private</span> String author;
|
||||
|
||||
<span class="kw">public</span> Book(String title, String author) {
|
||||
this.title = title;
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String getTitle() {
|
||||
<span class="kw">return</span> title;
|
||||
}
|
||||
|
||||
<span class="kw">public void</span> setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
<span class="kw">public</span> String getAuthor() {
|
||||
return author;
|
||||
}
|
||||
|
||||
<span class="kw">public void</span> setAuthor(String author) {
|
||||
this.author = author;
|
||||
}
|
||||
}
|
||||
</pre>
|
||||
@@ -1,241 +0,0 @@
|
||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>OGNL and tags demo</title>
|
||||
<s:url var="struts" value="/struts" includeParams="none"/>
|
||||
<s:url var="jspEval" action="jspEval" namespace="/nodecorate" includeParams="none"/>
|
||||
<s:url var="viewClass" value="/interactive/example-action.jsp" includeParams="none"/>
|
||||
<s:url var="ognlBase" value="/interactive/ognl_" includeParams="none"/>
|
||||
<s:url var="jspBase" value="/interactive/jsp_" includeParams="none"/>
|
||||
|
||||
<script src="${struts}/webconsole.js"></script>
|
||||
<sx:head/>
|
||||
<script>
|
||||
var index = -1;
|
||||
var runningOgnl = true;
|
||||
var ognlBase = "${ognlBase}";
|
||||
var jspBase = "${jspBase}";
|
||||
var ognlCount = 9;
|
||||
var jspCount = 5;
|
||||
|
||||
dojo.addOnLoad(function() {
|
||||
var classSrc = dojo.byId("classSrc");
|
||||
dojo.io.updateNode(classSrc, "${viewClass}");
|
||||
dojo.html.hide("previous");
|
||||
dojo.html.hide("next");
|
||||
});
|
||||
|
||||
dojo.event.topic.subscribe("/reloadGuide", function() {
|
||||
next();
|
||||
});
|
||||
|
||||
function startOgnl() {
|
||||
selectOGNLTab();
|
||||
index = -1;
|
||||
runningOgnl = true;
|
||||
change(1);
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
function startJSP() {
|
||||
selectJSPTab();
|
||||
index = -1;
|
||||
runningOgnl = false;
|
||||
change(1);
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
function execOgnl(id) {
|
||||
var exp = dojo.string.trim(dojo.byId(id ? id : "example").innerHTML);
|
||||
dojo.byId("wc-command").value = exp;
|
||||
|
||||
keyEvent({keyCode : 13}, '${jspEval}');
|
||||
}
|
||||
|
||||
function execJSP(id) {
|
||||
var exp = dojo.string.trim(dojo.byId(id ? id : "example").innerHTML);
|
||||
dojo.byId("jsp").value = unscape(exp);
|
||||
|
||||
dojo.event.topic.publish("/evalJSP")
|
||||
}
|
||||
|
||||
function unscape(str) {
|
||||
return str.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, '"');
|
||||
}
|
||||
|
||||
function selectClassSrcTab() {
|
||||
dojo.widget.byId("mainTabContainer").selectTab("classTab");
|
||||
}
|
||||
|
||||
function selectJSPTab() {
|
||||
dojo.widget.byId("mainTabContainer").selectTab("jspTab");
|
||||
}
|
||||
|
||||
function selectOGNLTab() {
|
||||
dojo.widget.byId("mainTabContainer").selectTab("ognlTab");
|
||||
}
|
||||
|
||||
function change(delta) {
|
||||
index+=delta;
|
||||
|
||||
var url = (runningOgnl ? ognlBase : jspBase) + index + ".jsp";
|
||||
var bind = dojo.widget.byId("guideBind");
|
||||
bind.href = url;
|
||||
dojo.event.topic.publish("/loadContent");
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
function updateNavigation() {
|
||||
if(index <= 0) {
|
||||
dojo.html.hide("previous");
|
||||
} else {
|
||||
dojo.html.show("previous");
|
||||
}
|
||||
|
||||
var top = runningOgnl ? ognlCount : jspCount;
|
||||
|
||||
if(index == top - 1) {
|
||||
dojo.html.hide("next");
|
||||
} else {
|
||||
dojo.html.show("next");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style type="">
|
||||
.wc-results {
|
||||
overflow: auto;
|
||||
margin: 0px;
|
||||
padding: 5px;
|
||||
font-family: courier;
|
||||
color: white;
|
||||
background-color: black;
|
||||
height: 200px;
|
||||
}
|
||||
.wc-results pre {
|
||||
display: inline;
|
||||
}
|
||||
.wc-command {
|
||||
margin: 1px 0 0 0;
|
||||
}
|
||||
.shell {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.jsp {
|
||||
border-style: solid;
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
}
|
||||
.jspResult {
|
||||
border-style: none;
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
padding: 5px;
|
||||
}
|
||||
.jspResultHeader {
|
||||
background-color: #818EBD;
|
||||
color: white;
|
||||
width: 100%;
|
||||
height: 15px;
|
||||
}
|
||||
.jspResultHeader span {
|
||||
padding: 5px;
|
||||
}
|
||||
.classSrc {
|
||||
font-family:Courier;
|
||||
font-size:11px;
|
||||
line-height:13px;
|
||||
overflow: auto;
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
}
|
||||
.tabContainer {
|
||||
width: 1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.guideContainer {
|
||||
width: 600px;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.guide {
|
||||
padding: 5px;
|
||||
}
|
||||
pre {
|
||||
font-family:Verdana,Geneva,Arial,Helvetica,sans-serif;
|
||||
font-style: italic;
|
||||
}
|
||||
span.kw {
|
||||
color: rgb(127, 0, 85);
|
||||
font-weight: bold;;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<sx:bind id="guideBind" targets="guide" listenTopics="/loadContent"/>
|
||||
|
||||
<body>
|
||||
<sx:tabbedpanel id="mainTabContainer" cssClass="tabContainer">
|
||||
<sx:div label="OGNL Console" id="ognlTab">
|
||||
<div id="shell" class="shell">
|
||||
<form onsubmit="return false" id="wc-form">
|
||||
<div class="wc-results" id="wc-result">
|
||||
Welcome to the OGNL console!
|
||||
<br />
|
||||
:->
|
||||
</div>
|
||||
<input type="hidden" name="debug" value="command" />
|
||||
OGNL Expression <input name="expression" onkeyup="keyEvent(event, '${jspEval}')" class="input-xxlarge wc-command" id="wc-command" type="text" />
|
||||
</form>
|
||||
</div>
|
||||
</sx:div>
|
||||
<sx:div label="JSP Console" id="jspTab">
|
||||
<table style="width: 100%" cellpadding="1">
|
||||
<tr valign="top">
|
||||
<td width="50%">
|
||||
<form theme="simple" namespace="/nodecorate" action="jspEval" method="post">
|
||||
<s:textarea cssClass="jsp" theme="simple" name="jsp" />
|
||||
<sx:submit
|
||||
value="Eval JSP Fragment"
|
||||
href="%{#jspEval}"
|
||||
targets="jspResult"
|
||||
listenTopics="/evalJSP"/>
|
||||
</form>
|
||||
</td>
|
||||
<td width="50%">
|
||||
<div class="jspResultHeader">
|
||||
<span>JSP Eval Result</span>
|
||||
</div>
|
||||
<div id="jspResult" class="jspResult">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</sx:div>
|
||||
<sx:div label="Class on top of the Value Stack" id="classTab">
|
||||
<div id="classSrc" class="classSrc">
|
||||
</div>
|
||||
</sx:div>
|
||||
</sx:tabbedpanel>
|
||||
<br/><br/>
|
||||
<div class="guideContainer">
|
||||
<div class="jspResultHeader">
|
||||
<span>Interactive Guide</span>
|
||||
</div>
|
||||
<sx:div id="guide" listenTopics="/reloadGuide" cssClass="guide">
|
||||
<p><a href="#" onclick="startOgnl()">Start OGNL Interactive Demo</a></p>
|
||||
<p><a href="#" onclick="startJSP()">Start JSP Interactive Demo</a></p>
|
||||
</sx:div>
|
||||
<div>
|
||||
<a href="#" id="previous" onclick="change(-1)" style="float: left"><< Previous</a>
|
||||
<a href="#" id="next" onclick="change(1)" style="float: right">Next >></a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,62 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>String Attributes</b>
|
||||
</p>
|
||||
<p>
|
||||
Some tag attributes are expected to be Strings in which case String literals
|
||||
can be passed as the value, like the <i>href</i> attribute in the <i>a</i> tag.
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:a href="http://struts.apache.org/" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
If the value that you want to use in one of these string literal attributes is stored on the Value Stack,
|
||||
then the <i>%{#name}</i> syntax (alternative syntax) needs to be used. Assuming there is a value
|
||||
with the name "url" stored on the stack:
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:a href="%{#url}" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
will create an anchor and use the value of "url" for the <i>href</i> attribute.
|
||||
</p>
|
||||
<p>
|
||||
<b>Value Attributes</b>
|
||||
</p>
|
||||
<p>
|
||||
Other attributes expect an object as their value(not an string literal). In these attributes you can specify
|
||||
the name of a variable stored on the Value Stack, and the tag will look it up and use it. Like the
|
||||
<i>value</i> attribute in the <i>property</i> tag. Assuming there is an object stored on the Value Stack with
|
||||
the name "movie", then:
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:property value="movie" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
will print the value to the page. To pass an String literal to an attribute that expects a value use the <i>%{'string'}</i>
|
||||
notation.
|
||||
</p>
|
||||
<p>
|
||||
If you don't remember if an attribute expects an string literal or a value, you can always use the <i>%{value}</i> notation:
|
||||
</p>
|
||||
<p>
|
||||
<i>
|
||||
<s:a href="%{'http://struts.apache.org/'}" />
|
||||
<br />
|
||||
<s:property value="%{#movie}" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/tag-syntax.html')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,52 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Print property value, using the <i>property tag</i></b>
|
||||
</p>
|
||||
<p>
|
||||
On the OGNL demo you learned how to access values from the Value Stack using OGNL expressions.
|
||||
The <i>property</i> tag is used to print to the page the result of an OGNL expression. The expression
|
||||
is specified in the <i>value</i> attribute.
|
||||
</p>
|
||||
<p>To print the value of the expression <i>name</i> to the page type:
|
||||
<p>
|
||||
<i id="example0">
|
||||
<s:property value="name" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
As you saw in the OGNL demo, to print a property of an object that is not on top of the stack,
|
||||
use the <i>#object.property</i> notation.
|
||||
</p>
|
||||
<p>To print the value for the key "struts.view_uri" in <i>request</i> to the page type:
|
||||
<p>
|
||||
<i id="example1">
|
||||
<s:property value="#request['struts.view_uri']" />
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<b>Print property value, using the <i>$</i> operator</b>
|
||||
</p>
|
||||
<p>Use the <i>${name}</i> notation to print values from the Value Stack to the page.
|
||||
<p>To print the value of the expression <i>name</i> to the page type:
|
||||
<p>
|
||||
<i id="example2">
|
||||
${name}
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example2')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/property.html')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,54 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b><i>if</i> tag</b>
|
||||
</p>
|
||||
<p>
|
||||
The <i>if</i> tag allows you to optionally execute a JSP section. Multiple <i>elseif</i> tags
|
||||
and one <i>else</i> tag can be associated to an <i>if tag</i>.
|
||||
</p>
|
||||
<p>
|
||||
To say hello to John Galt type:
|
||||
</p>
|
||||
<p>
|
||||
<pre id="example0">
|
||||
<s:if test="name == 'John Galt'">
|
||||
Hi John
|
||||
</s:if>
|
||||
<s:else>
|
||||
I don't know you!
|
||||
</s:else>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<b><i>iterator</i> tag</b>
|
||||
</p>
|
||||
<p>
|
||||
The <i>iterator</i> tag loops over an <i>Iterable</i> object one object at a time into
|
||||
the Value Stack (the value will be on top of the stack).
|
||||
</p>
|
||||
<p>
|
||||
To print the all the elements in the "bands" property type:
|
||||
</p>
|
||||
<p>
|
||||
<pre id="example1">
|
||||
<s:iterator value="bands">
|
||||
<s:property />
|
||||
<br />
|
||||
</s:iterator>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
on the JSP console and hit enter. <a href="#" onclick="execJSP('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/property.html')">[More on the <i>if</i> tag]</a>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/iterator.html')">[More on the <i>iterator</i> tag]</a>
|
||||
</p>
|
||||
@@ -1,65 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b><i>set</i> tag</b>
|
||||
</p>
|
||||
<p>
|
||||
The <i>set</i> tag sets the variable with the name specified in the <i>name</i> attribute to
|
||||
the value specified in the <i>value</i> attribute in the scope
|
||||
entered in the <i>scope</i> attribute. The available scopes are:
|
||||
<ul>
|
||||
<li>application - application scope according to servlet spec</li>
|
||||
<li>session - session scope according to servlet spec</li>
|
||||
<li>request - request scope according to servlet spec</li>
|
||||
<li>page - page scope according to servlet sepc</li>
|
||||
<li>action - the value will be set in the request scope and Struts' action context</li>
|
||||
|
||||
</ul>
|
||||
</p>
|
||||
<p>
|
||||
This example sets <i>favouriteBand</i> in the request scope to the first element of the <i>bands</i> property:
|
||||
</p>
|
||||
<p>
|
||||
<pre id="example0">
|
||||
<s:set name="favouriteBand" value="bands[0]" />
|
||||
<s:property value="#favouriteBand" />
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="execJSP('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<b><i>url</i> tag</b>
|
||||
</p>
|
||||
<p>
|
||||
The <i>url</i> tag is used to build urls (who would have guessed!). To build an url mapping to
|
||||
an action, set the <i>namespace</i> and <i>action</i> attributes. The url will be stored under
|
||||
the name specified in the <i>id</i> attribute. <b>url tag uses the <i>id</i> attribute while
|
||||
the <i>set</i> tag uses name</b>. To specify a value (no action lookup), just use the <i>value</i>
|
||||
attribute. <i>param</i> tags can be nested inside the <i>url</i> tag to add parameters to the url.
|
||||
</p>
|
||||
<p>
|
||||
First link creates a url that maps to an action, second one creates a url to google, passing one parameter:
|
||||
</p>
|
||||
<p>
|
||||
<pre id="example1">
|
||||
<s:url id="evalAction" namespace="/nodecorate" action="jspEval" />
|
||||
<s:a href="%{#evalAction}" >Eval</s:a>
|
||||
|
||||
<s:url id="google" value="http://www.google.com" >
|
||||
<s:param name="q" value="%{'Struts 2'}" />
|
||||
</s:url>
|
||||
<s:a href="%{#google}" >Eval</s:a>
|
||||
</pre>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="execJSP('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/set.html')">[More on the <i>set</i> tag]</a>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/url.html')">[More on the <i>url</i> tag]</a>
|
||||
</p>
|
||||
@@ -1,16 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>More on JSP tags</b>
|
||||
</p>
|
||||
<p>
|
||||
Struts 2 provides many more tags which you can learn about
|
||||
<a href="#" onclick="window.open('http://cwiki.apache.org/confluence/display/WW/Tag+Reference')">here</a>
|
||||
</p>
|
||||
<br/>
|
||||
You can keep playing with the JSP console or
|
||||
<a href="#" onclick="startOgnl()">Start OGNL Interactive Demo</a>
|
||||
@@ -1,30 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Accessing properties</b>
|
||||
</p>
|
||||
<p>
|
||||
The framework uses a standard naming context to evaluate OGNL expressions.
|
||||
The top level object dealing with OGNL is a Map (usually referred as a context map or context).
|
||||
OGNL has a notion of there being a root (or default) object within the context.
|
||||
In OGNL expressions, the properties of the root object can be referenced without any special "marker" notion.
|
||||
References to other objects are marked with a pound sign (#).
|
||||
|
||||
In this example (and in your JSP pages) the last action executed will be on the top of the stack.
|
||||
</p>
|
||||
<p>
|
||||
<a href="#" onclick="selectClassSrcTab()">This action</a> is available on the third tab above.
|
||||
To access the <i>name</i> field type:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example">
|
||||
name
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl()">Do it for me</a>
|
||||
</p>
|
||||
@@ -1,28 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Accessing nested properties</b>
|
||||
</p>
|
||||
<p>
|
||||
To access nested properties, use the dot "." operator to concatenate the property names. The action
|
||||
class has a <i>book</i> field, with <i>title</i> and <i>author</i> fields.
|
||||
</p>
|
||||
<p>
|
||||
To access the name of the book type:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example">
|
||||
book.title
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl()">Do it for me</a>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/properties.html')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,43 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Accessing properties inside Arrays</b>
|
||||
</p>
|
||||
<p>
|
||||
To access properties inside arrays, use the brackets "[]" operators with the desired index(starting from 0). The action
|
||||
class has an array of String in the field <i>bands</i>.
|
||||
</p>
|
||||
<p>
|
||||
To access the second element in the <i>bands</i> array type:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example0">
|
||||
bands[1]
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
<b>Accessing properties inside Lists</b>
|
||||
</p>
|
||||
<p>Lists can be accessed on the same way. The action class has a List of String on the field <i>movies</i>.</p>
|
||||
<p>
|
||||
To access the first element in the <i>movies</i> list type:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example1">
|
||||
movies[0]
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example1')">Do it for me</a>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/indexing.html#N10184')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,54 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Accessing properties inside Maps</b>
|
||||
</p>
|
||||
<p>
|
||||
To access properties inside maps, use the brackets "[]" operators with the desired key. The action
|
||||
class has a map of Book objects in the field <i>books</i>.
|
||||
</p>
|
||||
<p>
|
||||
To access the book with key "Iliad" in the <i>books</i> map type:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example0">
|
||||
books['Iliad']
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>If the key does not have spaces in it, you can access an element in the map, using the dot "." operator.</p>
|
||||
<p>
|
||||
To access the book with key "Iliad" in the <i>books</i> map type:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example1">
|
||||
books.Iliad
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
Note that the object returned is of type Book. If you want to access one of its properties, you can do so using the dot
|
||||
"." operator as you did before.</p>
|
||||
<p>
|
||||
To access the <i>author</i> property of the book with key "Iliad" in the <i>books</i> map type:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example2">
|
||||
books['Iliad'].author
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example2')">Do it for me</a>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/indexing.html#N10184')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,32 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Accessing properties on the stack</b>
|
||||
</p>
|
||||
<p>
|
||||
Object that are not on the top of the Value Stack are accessed using the "#name" notation.
|
||||
Some objects are always pushed into the stack by Struts, like:
|
||||
</p>
|
||||
<ul>
|
||||
<li>#application</li>
|
||||
<li>#session</li>
|
||||
<li>#request</li>
|
||||
<li>#parameters</li>
|
||||
</ul>
|
||||
<p>To see the value of the first parameter type:</p>
|
||||
<p>
|
||||
<i id="example">
|
||||
#parameters['debug'][0]
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl()">Do it for me</a>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://struts.apache.org/2.x/docs/ognl.html')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,25 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Calling methods</b>
|
||||
</p>
|
||||
<p>
|
||||
OGNL follows Java's syntax to execute a method.
|
||||
</p>
|
||||
<p>To execute the <i>getTitle()</i> method on the <i>book</i> object type:</p>
|
||||
<p>
|
||||
<i id="example">
|
||||
book.getTitle()
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl()">Do it for me</a>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/methods.html')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,43 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>Expressions</b>
|
||||
</p>
|
||||
<p>
|
||||
OGNL supports expressions using primitive values.
|
||||
</p>
|
||||
<p>Arithmetic:</p>
|
||||
<p>
|
||||
<i id="example0">
|
||||
(6 - 2)/2
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p>Logical:</p>
|
||||
<p>
|
||||
<i id="example1">
|
||||
(true || false) and true
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p>Equality:</p>
|
||||
<p>
|
||||
<i id="example2">
|
||||
'a' == 'a'
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example2')">Do it for me</a>
|
||||
</p>
|
||||
<p>
|
||||
OGNL supports many more operators and expressions, see <a href="#" onclick="window.open('http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/apa.html#operators')">[Operators Reference]</a>
|
||||
for more details.
|
||||
</p>
|
||||
@@ -1,55 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p><b>Creating arrays</b></p>
|
||||
<p>
|
||||
OGNL follows Java syntax to create arrys.
|
||||
</p>
|
||||
<p>
|
||||
Create an array of integers:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example0">
|
||||
new int[] {0, 1, 2}
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example0')">Do it for me</a>
|
||||
</p>
|
||||
<p><b>Creating lists</b></p>
|
||||
<p>
|
||||
To create a list, enclose a list of comma separated expression in a pair of braces.
|
||||
</p>
|
||||
<p>
|
||||
Create a list of Strings:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example1">
|
||||
{'Is', 'there', 'any', 'body', 'out', 'there?'}
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example1')">Do it for me</a>
|
||||
</p>
|
||||
<p><b>Creating maps</b></p>
|
||||
<p>
|
||||
To create a map, use the syntax #@MAP_TYPE@{key:value}.
|
||||
</p>
|
||||
<p>
|
||||
Create a LinkedHashMap:
|
||||
</p>
|
||||
<p>
|
||||
<i id="example2">
|
||||
#@java.util.LinkedHashMap@{'name': 'John Galt', 'job' : 'Engineer'}
|
||||
</i>
|
||||
</p>
|
||||
<p>
|
||||
on the OGNL console and hit enter. <a href="#" onclick="execOgnl('example2')">Do it for me</a>
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
<a href="#" onclick="window.open('http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/collectionConstruction.html#listConstruction')">[More details]</a>
|
||||
</p>
|
||||
@@ -1,18 +0,0 @@
|
||||
<%
|
||||
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
|
||||
%>
|
||||
<p>
|
||||
<b>More on OGNL</b>
|
||||
</p>
|
||||
<p>
|
||||
There are a lot of OGNL features that we have not covered on this short tutorial.
|
||||
</p>
|
||||
<br/>
|
||||
<p>
|
||||
To learn more see the <a href="#" onclick="window.open('http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/index.html')">[OGNL Documentation]</a>
|
||||
</p>
|
||||
You can keep playing with the OGNL console or
|
||||
<a href="#" onclick="startJSP()">Start JSP Interactive Demo</a>
|
||||
@@ -1,113 +0,0 @@
|
||||
<%--
|
||||
|
||||
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.
|
||||
|
||||
$Id$
|
||||
|
||||
--%>
|
||||
|
||||
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
|
||||
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
|
||||
|
||||
<f:view>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - JSF Integration - Modify Employee</title>
|
||||
<s:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Modify Employee</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<h:form>
|
||||
<h:inputHidden value="#{action.currentEmployee.empId}"/>
|
||||
<h:panelGrid columns="3">
|
||||
<h:outputText value="Employee Id:"/>
|
||||
<h:inputText id="id" size="5" value="#{action.currentEmployee.empId}" required="true"/>
|
||||
<h:message for="id"/>
|
||||
|
||||
<h:outputText value="First Name:"/>
|
||||
<h:inputText id="firstName" size="30" value="#{action.currentEmployee.firstName}"
|
||||
required="true">
|
||||
<f:validateLength minimum="2" maximum="30"/>
|
||||
</h:inputText>
|
||||
<h:message for="firstName"/>
|
||||
|
||||
<h:outputText value="Last Name:"/>
|
||||
<h:inputText id="lastName" size="30" value="#{action.currentEmployee.lastName}" required="true">
|
||||
<f:validateLength minimum="2" maximum="30"/>
|
||||
</h:inputText>
|
||||
<h:message for="lastName"/>
|
||||
|
||||
<h:outputText value="Salary:"/>
|
||||
<h:inputText id="salary" size="10" value="#{action.currentEmployee.salary}"/>
|
||||
<h:message for="salary"/>
|
||||
|
||||
<h:outputText value="Married:"/>
|
||||
<h:selectBooleanCheckbox id="married" value="#{action.currentEmployee.married}"/>
|
||||
<h:message for="married"/>
|
||||
|
||||
<h:outputText value="Position:"/>
|
||||
<h:selectOneMenu id="position" value="#{action.currentEmployee.position}">
|
||||
<f:selectItems value="#{action.availablePositionsAsMap}"/>
|
||||
</h:selectOneMenu>
|
||||
<h:message for="position"/>
|
||||
|
||||
<h:outputText value="Main Skill:"/>
|
||||
<h:selectOneMenu id="mainSkill" value="#{action.currentEmployee.mainSkill.name}">
|
||||
<f:selectItems value="#{action.availableSkills}"/>
|
||||
</h:selectOneMenu>
|
||||
<h:message for="mainSkill"/>
|
||||
|
||||
<h:outputText value="Other Skills:"/>
|
||||
<h:selectManyListbox id="otherSkills" value="#{action.selectedSkills}">
|
||||
<f:selectItems value="#{action.availableSkills}"/>
|
||||
</h:selectManyListbox>
|
||||
<h:message for="otherSkills"/>
|
||||
|
||||
<h:outputText value="Password:"/>
|
||||
<h:inputSecret id="password" value="#{action.currentEmployee.password}"/>
|
||||
<h:message for="password"/>
|
||||
|
||||
<h:outputText value="Level:"/>
|
||||
<h:selectOneRadio id="level" value="#{action.currentEmployee.level}">
|
||||
<f:selectItems value="#{action.availableLevelsAsMap}"/>
|
||||
</h:selectOneRadio>
|
||||
<h:message for="level"/>
|
||||
|
||||
<h:outputText value="Comment:"/>
|
||||
<h:inputTextarea id="comment" value="#{action.currentEmployee.comment}" cols="50" rows="3"/>
|
||||
<h:message for="comment"/>
|
||||
</h:panelGrid>
|
||||
|
||||
<h:commandButton value="Save" action="#{action.save}" styleClass="btn btn-primary"/>
|
||||
<br/><br/>
|
||||
<h:outputLink value="list.action" styleClass="btn btn-info">
|
||||
<h:outputText value="Back"/>
|
||||
</h:outputLink>
|
||||
</h:form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</f:view>
|
||||
@@ -1,75 +0,0 @@
|
||||
<%--
|
||||
|
||||
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.
|
||||
|
||||
$Id$
|
||||
|
||||
--%>
|
||||
|
||||
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
|
||||
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
|
||||
|
||||
<f:view>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - JSF Integration - Available Employees</title>
|
||||
<s:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>Available Employees</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<h:dataTable value="#{action.availableItems}" var="e" styleClass="table table-striped table-bordered table-hover table-condensed">
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Id"/>
|
||||
</f:facet>
|
||||
<h:outputLink value="edit.action">
|
||||
<f:param name="empId" value="#{e.empId}"/>
|
||||
<h:outputText value="#{e.empId}"/>
|
||||
</h:outputLink>
|
||||
</h:column>
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="First Name"/>
|
||||
</f:facet>
|
||||
<h:outputText value="#{e.firstName}"/>
|
||||
</h:column>
|
||||
<h:column>
|
||||
<f:facet name="header">
|
||||
<h:outputText value="Last Name"/>
|
||||
</f:facet>
|
||||
<h:outputText value="#{e.lastName}"/>
|
||||
</h:column>
|
||||
</h:dataTable>
|
||||
|
||||
<p>
|
||||
<h:outputLink value="edit.action" styleClass="btn btn-primary">
|
||||
<h:outputText value="Create new Employee"/>
|
||||
</h:outputLink>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</f:view>
|
||||
@@ -1,35 +0,0 @@
|
||||
<%@ taglib prefix="s" uri="/struts-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - JSF Integration</title>
|
||||
<s:head/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="page-header">
|
||||
<h1>JavaServer Faces Integration</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<p>
|
||||
The following pages show how Struts and JSF components can work together,
|
||||
each doing what they do best.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li><s:url var="url" namespace="/jsf/employee" action="list"/><s:a
|
||||
href="%{url}">List available Employees</s:a></li>
|
||||
<li><s:url var="url" namespace="/jsf/employee" action="edit"/><s:a
|
||||
href="%{url}">Create/Edit Employee</s:a></li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,33 +0,0 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - UI Tags - Datepicker Tag</title>
|
||||
<sx:head extraLocales="en-us,nl-nl,de-de" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>UI Tags - Datepicker Tag</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<table>
|
||||
<sx:datetimepicker label="toggleType='wipe'" value="%{'2006-10-31'}" toggleType="wipe" toggleDuration="300" name="test"/>
|
||||
<sx:datetimepicker label="toggleType='explode'" value="%{'2006-07-22'}" toggleType="explode" toggleDuration="500" id="dp2"/>
|
||||
<sx:datetimepicker label="toggleType='fade'" value="%{'2006-06-30'}" toggleType="fade" toggleDuration="500"/>
|
||||
<sx:datetimepicker label="With value='today'" name="dddp1" value="%{'today'}" />
|
||||
<sx:datetimepicker label="US format, empty" name="dddp2" language="en-us" />
|
||||
<sx:datetimepicker label="US format with initial date of 2006-06-26" name="dddp3" value="%{'2006-06-26'}" language="en-us" />
|
||||
<sx:datetimepicker label="With initial date of 1969-04-25 and a custom format dd/MM/yyyy" name="dddp5" value="%{'25/04/1969'}" displayFormat="dd/MM/yyyy" />
|
||||
<sx:datetimepicker label="In German" name="dddp7" value="%{'2006-06-28'}" language="de-de" />
|
||||
<sx:datetimepicker label="In Dutch" name="dddp8" value="%{'2006-06-28'}" language="nl-nl" />
|
||||
<sx:datetimepicker label="US format with initial date of 2006-06-26 and long formatting (parse not supported)" name="dddp12" value="%{'2006-06-26'}" formatLength="long" language="en-us" />
|
||||
<sx:datetimepicker label="German format with initial date of 2006-06-26 and long formatting (parse not supported)" name="dddp13" value="%{'2006-06-26'}" formatLength="long" language="de" />
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +1,4 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - UI Tags Example</title>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
<head>
|
||||
<title>Struts2 Showcase - UI Tags Example (Velocity)</title>
|
||||
#shead()
|
||||
#sxhead()
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
@@ -15,8 +14,6 @@
|
||||
|
||||
#sform ("action=exampleSubmitVelocity" "method=post" "enctype=multipart/form-data")
|
||||
#stextfield ("label=Name" "name=name")
|
||||
#sxdatetimepicker ("label=Birthday" "name=birthday")
|
||||
#sxdatetimepicker ("label=Wake up time" "name=wakeup" "type=time")
|
||||
#stextarea ("label=Biography" "name=bio" "cols=20" "rows=3")
|
||||
#sselect ("label=Favourite Color" "list={'Red', 'Blue', 'Green'}" "name=favouriteColor" "emptyOption=true" "headerKey=None" "headerValue=None")
|
||||
#sselect ("label=Favourite Language" "list=favouriteLanguages" "name=favouriteLanguage" "listKey=key" "listValue=description" "emptyOption=true" "headerKey=None" "headerValue=None")
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
|
||||
<%
|
||||
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
|
||||
%>
|
||||
|
||||
${parameters.nodeId[0]}
|
||||
@@ -1,31 +0,0 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - UI Tags - Timepicker Tag</title>
|
||||
<sx:head extraLocales="en-us,nl-nl,de-de" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>UI Tags - Timepicker Tag</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<table>
|
||||
<sx:datetimepicker label="toggleType='wipe'" type="time" value="%{'10:30'}" toggleType="wipe" toggleDuration="300"/>
|
||||
<sx:datetimepicker label="toggleType='explode'" type="time" value="%{'13:00'}" toggleType="explode" toggleDuration="500"/>
|
||||
<sx:datetimepicker label="toggleType='fade'" type="time" value="%{'13:00'}" toggleType="fade" toggleDuration="500"/>
|
||||
<sx:datetimepicker label="With value='today'" name="dddp4" type="time" value="%{'today'}" />
|
||||
<sx:datetimepicker label="US format, empty" name="dddp5" type="time" language="en-us" />
|
||||
<sx:datetimepicker label="US format, 13:00 hours" name="dddp6" type="time" value="%{'13:00'}" language="en-us" />
|
||||
<sx:datetimepicker label="In German" name="dddp7" type="time" value="%{'13:00'}" language="de" />
|
||||
<sx:datetimepicker label="In Dutch" name="dddp8" type="time" value="%{'13:00'}" language="nl" />
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +0,0 @@
|
||||
[
|
||||
<#list category.children as node>
|
||||
{
|
||||
label: '${node.name}',
|
||||
id: '${node.id}',
|
||||
hasChildren: ${(node.children.size() > 0)?string}
|
||||
},
|
||||
</#list>
|
||||
]
|
||||
@@ -1,25 +0,0 @@
|
||||
<%@taglib prefix="s" uri="/struts-tags" %>
|
||||
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>
|
||||
<html>
|
||||
<head>
|
||||
<title>Struts2 Showcase - UI Tags - Tree Example AJAX (Dynamic)</title>
|
||||
<sx:head />
|
||||
</head>
|
||||
<body>
|
||||
<div class="page-header">
|
||||
<h1>UI Tags - Tree Example AJAX (Dynamic)</h1>
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
|
||||
<s:url var="nodesUrl" namespace="/nodecorate" action="getNodes" />
|
||||
<div style="float:left; margin-right: 50px;">
|
||||
<sx:tree id="tree" href="%{#nodesUrl}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user