mirror of
https://github.com/apache/struts.git
synced 2026-08-07 07:37:20 +00:00
WW-5057 Showcase cleanup for 2.6 branch:
- Added missing elements to the UI Velocity example (for consistency with JSP example). - Fix some spelling typos in labels/tooltips (both JSP and Velocity UI examples). - Fixed some html/css issues with results pages for JSP and Velocity UI examples (consistency). - Made JSP UI example s:form use POST method to avoid warning in console when opening page. - Enhanced ViewSourceAction to allow View Sources "configuration" tab to work when running Showcase as an "exploded" WARfile. - Added escapeHtmlBody="false" to multiple tags in .ftl Showcase files (fix broken display elements - submit and anchor mostly). - Added missing favouriteCities getter/setter to MoreSelectsAction action. - Upgrade htmlunit from 2.27 to 2.37.0 - Upgrade maven failsafe plugin from 2.22.1 to 2.22.2
This commit is contained in:
@@ -155,7 +155,7 @@
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.htmlunit</groupId>
|
||||
<artifactId>htmlunit</artifactId>
|
||||
<version>2.27</version>
|
||||
<version>2.37.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>2.22.1</version>
|
||||
<version>2.22.2</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>it.org.apache.struts2.showcase.*Test</include>
|
||||
|
||||
@@ -36,6 +36,7 @@ public class MoreSelectsAction extends ActionSupport {
|
||||
private List _prioritisedFavouriteCars;
|
||||
private List _prioritisedFavouriteCountries;
|
||||
private List favouriteNumbers;
|
||||
private List favouriteCities;
|
||||
|
||||
|
||||
// Cartoon Characters
|
||||
@@ -124,6 +125,14 @@ public class MoreSelectsAction extends ActionSupport {
|
||||
return list;
|
||||
}
|
||||
|
||||
public List getFavouriteCities() {
|
||||
return favouriteCities;
|
||||
}
|
||||
|
||||
public void setFavouriteCities(List favouriteCities) {
|
||||
this.favouriteCities = favouriteCities;
|
||||
}
|
||||
|
||||
// actions
|
||||
|
||||
public String input() throws Exception {
|
||||
|
||||
+11
-3
@@ -27,6 +27,7 @@ import org.apache.struts2.action.ServletContextAware;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -88,9 +89,16 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
}
|
||||
}
|
||||
|
||||
String rootPath = ServletActionContext.getServletContext().getRealPath("/");
|
||||
final String rootPath = ServletActionContext.getServletContext().getRealPath("/");
|
||||
final String rootPathUnix = (rootPath != null ? rootPath.replace(File.separator, "/") : null); // Make path Unix-like for comparison (e.g. on Windows)
|
||||
final String rootPathFileURI = "file://" + rootPathUnix;
|
||||
final String collapsedRootPathFileURI = rootPathFileURI.replace("//", "/"); // Config string may have been transformed
|
||||
final String rootPathWarFileURI = "war:file://" + rootPathUnix;
|
||||
final String collapsedRootPathWarFileURI = rootPathWarFileURI.replace("//", "/"); // Config string may have been transformed
|
||||
|
||||
if (config != null && (rootPath == null || config.startsWith(rootPath))) {
|
||||
if (config != null && (rootPath == null || config.startsWith(rootPath) ||
|
||||
config.startsWith(rootPathFileURI) || config.startsWith(collapsedRootPathFileURI) ||
|
||||
config.startsWith(rootPathWarFileURI) || config.startsWith(collapsedRootPathWarFileURI))) {
|
||||
int pos = config.lastIndexOf(':');
|
||||
configLine = Integer.parseInt(config.substring(pos + 1));
|
||||
config = config.substring(0, pos).replace("//", "/");
|
||||
@@ -192,7 +200,7 @@ public class ViewSourceAction extends ActionSupport implements ServletContextAwa
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads in a strea, optionally only including the target line number
|
||||
* Reads in a stream, optionally only including the target line number
|
||||
* and its padding
|
||||
*
|
||||
* @param in The input stream
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
<#else>
|
||||
<img src="<@s.property value="%{#looseImageUrl}" />" width="381" height="44" />
|
||||
</#if>
|
||||
<@s.a href="%{#startHref}">
|
||||
<@s.a href="%{#startHref}" escapeHtmlBody="false">
|
||||
<img src="<@s.property value="%{#startImageUrl}" />" width="250" height="43" />
|
||||
</@s.a>
|
||||
<#else>
|
||||
@@ -139,6 +139,7 @@
|
||||
|
||||
<@s.a href="%{#url}"
|
||||
id="%{#currentCharacter}"
|
||||
escapeHtmlBody="false"
|
||||
>
|
||||
<img height="36" alt="" src="<@s.property value="%{#chalkboardImageUrl}" />" width="36" border="0" />
|
||||
</@s.a>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<@s.submit value="Create person" cssClass="btn btn-primary"/>
|
||||
<@s.submit value="Create person" cssClass="btn btn-primary" escapeHtmlBody="false"/>
|
||||
</div>
|
||||
</@s.form>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<p>The text you've entered is ${text!''}<p/>
|
||||
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info" escapeHtmlBody="false"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+4
-4
@@ -57,13 +57,13 @@
|
||||
|
||||
<@s.textfield label="Enter Some Text" name="text" />
|
||||
|
||||
<@s.submit action="actionPrefix" value="%{'action prefix'}" cssClass="btn" />
|
||||
<@s.submit action="actionPrefix" value="%{'action prefix'}" cssClass="btn" escapeHtmlBody="false" />
|
||||
|
||||
<@s.submit method="alternateMethod" value="%{'method prefix'}" cssClass="btn" />
|
||||
<@s.submit method="alternateMethod" value="%{'method prefix'}" cssClass="btn" escapeHtmlBody="false" />
|
||||
|
||||
<@s.submit value="Normal Submit" cssClass="btn" />
|
||||
<@s.submit value="Normal Submit" cssClass="btn" escapeHtmlBody="false" />
|
||||
|
||||
<@s.submit action="redirectActionPrefixAction" value="%{'redirectAction without prefix'}" cssClass="btn" />
|
||||
<@s.submit action="redirectActionPrefixAction" value="%{'redirectAction without prefix'}" cssClass="btn" escapeHtmlBody="false" />
|
||||
|
||||
</@s.form>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<p>The text you've enter is ${text!''}<p/>
|
||||
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info" escapeHtmlBody="false"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
<p>The text you've enter is %{text}<p/>
|
||||
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info" escapeHtmlBody="false"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@
|
||||
|
||||
The text you've enter is ${text!''}<p/>
|
||||
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
<@s.a href="javascript:history.back();" cssClass="btn btn-info" escapeHtmlBody="false"><i class="icon icon-arrow-left"></i> Back</@s.a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<s:fielderror cssClass="alert alert-error"/>
|
||||
|
||||
|
||||
<s:form action="exampleSubmit" enctype="multipart/form-data" javascriptTooltip="true">
|
||||
<s:form action="exampleSubmit" enctype="multipart/form-data" method="POST" javascriptTooltip="true">
|
||||
<s:textfield
|
||||
label="Name"
|
||||
name="name"
|
||||
@@ -97,7 +97,7 @@
|
||||
cssErrorClass="foo" />
|
||||
|
||||
<s:checkbox
|
||||
tooltip="Confirmed that your are Over 18"
|
||||
tooltip="Confirm that you are Over 18"
|
||||
label="Age 18+"
|
||||
name="legalAge"/>
|
||||
|
||||
@@ -114,8 +114,8 @@
|
||||
emptyOption="true" />
|
||||
|
||||
<s:doubleselect
|
||||
tooltip="Choose your Vehical"
|
||||
label="Favourite Vehical"
|
||||
tooltip="Choose your Vehicle"
|
||||
label="Favourite Vehicle"
|
||||
name="favouriteVehicalType"
|
||||
list="vehicalTypeList"
|
||||
listKey="key"
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
<s:optiontransferselect
|
||||
tooltip="Select Your Favourite Cartoon Characters"
|
||||
label="Favourite Cartoons Characters"
|
||||
label="Favourite Cartoon Characters"
|
||||
name="leftSideCartoonCharacters"
|
||||
leftTitle="Left Title"
|
||||
rightTitle="Right Title"
|
||||
@@ -153,7 +153,7 @@
|
||||
doubleMultiple="true" />
|
||||
|
||||
<s:textarea
|
||||
label="Your Thougths"
|
||||
label="Your Thoughts"
|
||||
name="thoughts"
|
||||
tooltip="Enter your thoughts here" />
|
||||
|
||||
|
||||
@@ -31,16 +31,20 @@
|
||||
<div class="col-md-12">
|
||||
|
||||
#sform ("action=exampleSubmitVelocity" "method=post" "enctype=multipart/form-data")
|
||||
#stextfield ("label=Name" "name=name")
|
||||
#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")
|
||||
#scheckboxlist ("label=Friends" "list={'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}" "name=friends")
|
||||
#scheckbox ("label=Age 18+" "name=legalAge")
|
||||
#sdoubleselect ("label=State" "name=region" "list={'North', 'South'}" "value='North'" "doubleValue='Florida'" "doubleList=top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}" "doubleName=state" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
|
||||
#sdoubleselect ("label=Favourite Vehical" "name=favouriteVehicalType" "list=vehicalTypeList" "listKey=key" "listValue=description" "value='MotorcycleKey'" "doubleValue='YamahaKey'" "doubleList=vehicalSpecificList" "doubleListKey=key" "doubleListValue=description" "doubleName=favouriteVehicalSpecific" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
|
||||
#sfile ("label=Picture" "name=picture")
|
||||
#soptiontransferselect ("label=Favourite Cartoons Characters" "name=leftSideCartoonCharacters" "leftTitle=Left Title" "rightTitle=Right Title" "list={'Popeye', 'He-Man', 'Spiderman'}" "multiple=true" "headerKey=headerKey" "headerValue=--- Please Select ---" "emptyOption=true" "doubleList={'Superman', 'Mickey Mouse', 'Donald Duck'}" "doubleName=rightSideCartoonCharacters" "doubleHeaderKey=doubleHeaderKey" "doubleHeaderValue=--- Please Select ---" "doubleEmptyOption=true" "doubleMultiple=true" )
|
||||
#stextfield ("label=Name" "name=name" "tooltip=Enter your Name here")
|
||||
#stextfield ("label=Birthday" "name=birthday" "tooltip=Select Your Birthday")
|
||||
#stextfield ("label=Wake up time" "name=wakeup" "tooltip=Enter the time you wake up")
|
||||
#stextarea ("label=Biography" "name=bio" "tooltip=Enter your Biography" "cols=20" "rows=3")
|
||||
#sselect ("label=Favourite Color" "tooltip=Choose Your Favourite Color" "list={'Red', 'Blue', 'Green'}" "name=favouriteColor" "emptyOption=true" "headerKey=None" "headerValue=None")
|
||||
#sselect ("label=Favourite Language" "tooltip=Choose Your Favourite Language" "list=favouriteLanguages" "name=favouriteLanguage" "listKey=key" "listValue=description" "emptyOption=true" "headerKey=None" "headerValue=None")
|
||||
#scheckboxlist ("label=Friends" "tooltip=Choose your Friends" "list={'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}" "name=friends")
|
||||
#sradio ("label=Best Friend" "tooltip=Choose your Best Friend" "list={'Wes', 'Patrick', 'Jason', 'Jay', 'Toby', 'Rene'}" "name=bestFriend" "cssErrorClass=foo")
|
||||
#scheckbox ("label=Age 18+" "name=legalAge" "tooltip=Confirm that you are Over 18")
|
||||
#sdoubleselect ("label=State" "name=region" "tooltip=Choose Your State" "list={'North', 'South'}" "value='North'" "doubleValue='Florida'" "doubleList=top == 'North' ? {'Oregon', 'Washington'} : {'Texas', 'Florida'}" "doubleName=state" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
|
||||
#sdoubleselect ("label=Favourite Vehicle" "name=favouriteVehicalType" "tooltip=Choose your Vehicle" "list=vehicalTypeList" "listKey=key" "listValue=description" "value='MotorcycleKey'" "doubleValue='YamahaKey'" "doubleList=vehicalSpecificList" "doubleListKey=key" "doubleListValue=description" "doubleName=favouriteVehicalSpecific" "headerKey=-1" "headerValue=---------- Please Select ----------" "emptyOption=true" )
|
||||
#sfile ("label=Picture" "name=picture" "tooltip=Upload Your Picture")
|
||||
#soptiontransferselect ("label=Favourite Cartoon Characters" "name=leftSideCartoonCharacters" "tooltip=Select Your Favourite Cartoon Characters" "leftTitle=Left Title" "rightTitle=Right Title" "list={'Popeye', 'He-Man', 'Spiderman'}" "multiple=true" "headerKey=headerKey" "headerValue=--- Please Select ---" "emptyOption=true" "doubleList={'Superman', 'Mickey Mouse', 'Donald Duck'}" "doubleName=rightSideCartoonCharacters" "doubleHeaderKey=doubleHeaderKey" "doubleHeaderValue=--- Please Select ---" "doubleEmptyOption=true" "doubleMultiple=true" )
|
||||
#stextarea ("label=Your Thoughts" "name=thoughts" "tooltip=Enter your thoughts here" "cols=20" "rows=3")
|
||||
#ssubmit("cssClass=btn btn-primary")
|
||||
#sreset("cssClass=btn btn-danger")
|
||||
#end
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
<s:label label="Name" name="name" />
|
||||
<s:label label="Birthday" name="birthday" />
|
||||
<tr>
|
||||
<td><label class="label">Wake up time:</label></td>
|
||||
<td>
|
||||
<td class="tdLabel"><label class="label">Wake up time:</label></td>
|
||||
<td class="tdInput">
|
||||
<s:date name="wakeup" format="hh:mm aa" />
|
||||
</td>
|
||||
</tr>
|
||||
@@ -50,22 +50,24 @@
|
||||
<s:label label="State" name="state" />
|
||||
<s:label label="Picture" name="picture" />
|
||||
<s:label label="Favourite Language" name="favouriteLanguage" />
|
||||
<s:label label="Favourite Vehical Type" name="favouriteVehicalType" />
|
||||
<s:label label="Favourite Vehical Specific" name="favouriteVehicalSpecific" />
|
||||
<s:label label="Favourite Vehicle Type" name="favouriteVehicalType" />
|
||||
<s:label label="Favourite Vehicle Specific" name="favouriteVehicalSpecific" />
|
||||
<tr>
|
||||
<td><label class="label">Favourite Cartoon Characters (Left):</label></td>
|
||||
<td>
|
||||
<td class="tdLabel"><label class="label">Favourite Cartoon Characters (Left):</label></td>
|
||||
<td class="tdInput"><label>
|
||||
<s:iterator value="leftSideCartoonCharacters" status="stat">
|
||||
<s:property value="%{#stat.count}" />.<s:property value="top" />
|
||||
</s:iterator>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label class="label">Favourite Cartoon Characters (Right):</label></td>
|
||||
<td>
|
||||
<td class="tdLabel"><label class="label">Favourite Cartoon Characters (Right):</label></td>
|
||||
<td class="tdInput"><label>
|
||||
<s:iterator value="rightSideCartoonCharacters" status="stat">
|
||||
<s:property value="%{#stat.count}" />.<s:property value="top" />
|
||||
</s:iterator>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<s:label label="Thoughts" name="thoughts" />
|
||||
|
||||
@@ -33,41 +33,45 @@
|
||||
#slabel ("label=Name" "name=name")
|
||||
#slabel ("label=Birthday" "name=birthday")
|
||||
<tr>
|
||||
<td><label class="label">Wake up time:</label></td>
|
||||
<td>
|
||||
<td class="tdLabel"><label class="label">Wake up time:</label></td>
|
||||
<td class="tdInput">
|
||||
#sdate ("name=wakeup" "format=hh:mm aa")
|
||||
</td>
|
||||
</tr>
|
||||
#slabel ("label=Biography" "name=bio")
|
||||
#slabel ("label=Favourite Color" "name=favouriteColor")
|
||||
#slabel ("label=Friends" "name=friends")
|
||||
#slabel ("label=Best Friend" "name=bestFriend")
|
||||
#slabel ("label=Legal Age" "name=legalAge")
|
||||
#slabel ("label=Region" "name=region")
|
||||
#slabel ("label=State" "name=state")
|
||||
#slabel ("label=Picture" "name=picture")
|
||||
#slabel ("label=Favourite Language" "name=favouriteLanguage")
|
||||
#slabel ("label=Favourite Vehical Type" "name=favouriteVehicalType")
|
||||
#slabel ("label=Favourite Vehical Specific" "name=favouriteVehicalSpecific")
|
||||
#slabel ("label=Favourite Vehicle Type" "name=favouriteVehicalType")
|
||||
#slabel ("label=Favourite Vehicle Specific" "name=favouriteVehicalSpecific")
|
||||
<tr>
|
||||
<td>Favourite Cartoon Characters (Left):</td>
|
||||
<td>
|
||||
<td class="tdLabel"><label class="label">Favourite Cartoon Characters (Left):</label></td>
|
||||
<td class="tdInput"><label>
|
||||
#set ( $startCount = 1)
|
||||
#foreach( $item in $leftSideCartoonCharacters)
|
||||
$startCount.${item}
|
||||
#set ( $startCount = $startCount + 1)
|
||||
#end
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Favourite Cartoon Characters (Right):</td>
|
||||
<td>
|
||||
<td class="tdLabel"><label class="label">Favourite Cartoon Characters (Right):</label></td>
|
||||
<td class="tdInput"><label>
|
||||
#set ( $startCount = 1)
|
||||
#foreach( $item in $rightSideCartoonCharacters)
|
||||
$startCount.${item}
|
||||
#set ( $startCount = $startCount + 1)
|
||||
#end
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
#slabel ("label=Thoughts" "name=thoughts")
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
<tr>
|
||||
<td>Non Favourite Sports:</td>
|
||||
<td>
|
||||
<s:iterator value="nonfavouriteSports" status="stat">
|
||||
<s:iterator value="nonFavouriteSports" status="stat">
|
||||
<s:property value="%{#stat.count}" />.<s:property />
|
||||
</s:iterator>
|
||||
</td>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<@s.form action="transfer4">
|
||||
<@s.token/>
|
||||
<@s.textfield label="Amount" name="amount" required=true value="400"/>
|
||||
<@s.submit value="Transfer money" cssClass="btn btn-primary"/>
|
||||
<@s.submit value="Transfer money" cssClass="btn btn-primary" escapeHtmlBody="false"/>
|
||||
</@s.form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user