# Struts2 Showcase - Hangman

# Hangman

<@s.url var="url" value="/hangman/images/hangman.png" /> " width="197" height="50" border="0"/>

<#-- Guesses Left -->
<#if (hangman.guessLeft() >= 0)> <@s.set var="guessLeftImageName" value="%{'Chalkboard_'+hangman.guessLeft()+'.png'}" /> <@s.url var="url" value="%{'/hangman/images/'+#guessLeftImageName}" /> " width="20" height="20" border="0" />

<@s.url var="url" value="/hangman/images/guesses-left.png" /> " width="164" height="11" border="0"/>

| <#-- Display Scaffold --> <@s.set var="scaffoldImageName" value="%{'scaffold_'+hangman.guessLeft()+'.png'}" /> <@s.url var="url" value="%{'/hangman/images/'+#scaffoldImageName}" /> " border="0"/> |

<@s.url var="url" value="/hangman/images/guess.png" /> " align="MIDDLE" width="127" height="20" border="0"/>

<#-- Display Vacab -->
<#if hangman.gameEnded()> <@s.iterator var="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat"> <@s.url var="url" value="%{'/hangman/images/Chalkboard_'+#currentCharacter.toString()+'.png'}" /> " src="<@s.property value="%{#url}" />" width="36" border="0" /> <#else> <@s.iterator var="currentCharacter" value="%{hangman.vocab.inCharacters()}" stat="stat"> <#if hangman.characterGuessedBefore(currentCharacter)> <@s.set var="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter.toString()+'.png'}" /> <@s.url var="url" value="%{'/hangman/images/'+#chalkboardImageName}" /> " src="<@s.property value="%{#url}" />" width="36" border="0"/> <#else> <@s.url var="url" value="/hangman/images/Chalkboard_underscroll.png" /> " width="36" border="0"/>

<@s.url var="url" value="/hangman/images/choose.png" /> " height="20" width="151" border="0"/>

<#-- Show Characters Available -->
<#if hangman.gameEnded()> <@s.set var="winImageName" value="%{'you-win.png'}" /> <@s.set var="looseImageName" value="%{'you-lose.png'}" /> <@s.set var="startImageName" value="%{'start.png'}" /> <@s.url var="winImageUrl" value="%{'/hangman/images/'+#winImageName}" /> <@s.url var="looseImageUrl" value="%{'/hangman/images/'+#looseImageName}" /> <@s.url var="startImageUrl" value="%{'/hangman/images/'+#startImageName}" /> <@s.url var="startHref" action="hangmanNonAjax" namespace="/hangman" /> <#if hangman.isWin()> " width="341" height="44" /> <#else> " width="381" height="44" /> <@s.a href="%{#startHref}"> " width="250" height="43" /> <#else> <@s.iterator var="currentCharacter" value="%{hangman.charactersAvailable}" status="stat"> <@s.set var="chalkboardImageName" value="%{'Chalkboard_'+#currentCharacter+'.png'}" /> <@s.url var="chalkboardImageUrl" value="%{'/hangman/images/'+#chalkboardImageName}" /> <@s.url var="spacerUrl" value="/hangman/images/letter-spacer.png" /> <@s.url var="url" action="guessCharacterNonAjax" namespace="/hangman"> <@s.param name="character" value="%{#currentCharacter}" /> <@s.a href="%{#url}" id="%{#currentCharacter}" > " width="36" border="0" />