Erro com Web Flow
03/04/2009 00:00
0
Bom pessoal vamos la ver se alguêm consegue me dar um help com web flow!!

Vejam o seguinte código:

QuotatonController.groovy

class QuotationController {

def index = { redirect(action: "webQuotation", params: params) }

// the delete, save and update actions only accept POST requests
static allowedMethods = [save: "POST", update: "POST", delete: "POST"]

// webflow
def webQuotationFlow = {
displayStudentSearch {
render(view:"displaySearchStudent")
on("toCity").to "displayCitySearch"
}
displayCitySearch {
render(view:"displaySearchCity")
on("toCourse").to "displayCourseSearch"
}
displayCourseSearch {
render(view:"displaySearchCourse")
}

}

}


Esse controller chama as seguintes gsp

displaySearchStudent.gsp

<html>
<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; />
<meta name=&quot;layout&quot; content=&quot;main&quot; />
<title><g&#58;message code=&quot;quotation.searchStudent&quot;
default=&quot;Busca Estudante&quot; />
</title>
<resource&#58;autoComplete skin=&quot;default&quot; />
</head>
<body>
<div class=&quot;navMenu&quot;>
<span class=&quot;menuButton&quot;><a class=&quot;home&quot;
href=&quot;$&#123;createLinkTo(dir&#58; '')&#125;&quot;><g&#58;message code=&quot;home&quot;
default=&quot;Home&quot; /> </a> </span>
<span class=&quot;menuButton&quot;><g&#58;link class=&quot;list&quot; action=&quot;list&quot;>
<g&#58;message code=&quot;quotation.searchStudent&quot; default=&quot;Busca Estudante&quot; />
</g&#58;link> </span>
</div>
<div class=&quot;body&quot;>
<h1>
<g&#58;message code=&quot;quotation.searchStudent&quot; default=&quot;Busca Estudante&quot; />
</h1>
<g&#58;if test=&quot;$&#123;flash.message&#125;&quot;>
<div class=&quot;message&quot;>
<g&#58;message code=&quot;$&#123;flash.message&#125;&quot; args=&quot;$&#123;flash.args&#125;&quot;
default=&quot;$&#123;flash.defaultMessage&#125;&quot; />
</div>
</g&#58;if>
<g&#58;hasErrors bean=&quot;$&#123;quotationInstance&#125;&quot;>
<div class=&quot;errors&quot;>
<g&#58;renderErrors bean=&quot;$&#123;quotationInstance&#125;&quot; as=&quot;list&quot; />
</div>
</g&#58;hasErrors>
<div class=&quot;dialog&quot;>
<g&#58;form name=&quot;searchStudent&quot;
url=&quot;[action&#58;'webQuotation',controller&#58;'quotation']&quot;>
<richui&#58;autoComplete name=&quot;name&quot;
action=&quot;$&#123;createLinkTo('dir'&#58; 'student/findAllByNameLikeAjax')&#125;&quot; />

<div class=&quot;buttons&quot;>
<span class=&quot;button&quot;><g&#58;submitButton name=&quot;toCity&quot;
class=&quot;save&quot;
value=&quot;$&#123;message(code&#58; 'proximo', 'default'&#58; 'Proximo')&#125;&quot; />
</span>
</div>
</g&#58;form>
</div>
</div>
</body>
</html>



displaySearchCity


<html>
<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; />
<meta name=&quot;layout&quot; content=&quot;main&quot; />
<title><g&#58;message code=&quot;quotation.searchCity&quot;
default=&quot;Busca Cidade&quot; />
</title>
<g&#58;javascript library=&quot;prototype&quot; />
</head>
<body>
<div class=&quot;navMenu&quot;>
<span class=&quot;menuButton&quot;><a class=&quot;home&quot;
href=&quot;$&#123;createLinkTo(dir&#58; '')&#125;&quot;><g&#58;message code=&quot;home&quot;
default=&quot;Home&quot; /> </a> </span>
</div>
<div class=&quot;body&quot;>
<h1>
<g&#58;message code=&quot;quotation.searchCity&quot; default=&quot;Busca Cidade&quot; />
</h1>
<g&#58;if test=&quot;$&#123;flash.message&#125;&quot;>
<div class=&quot;message&quot;>
<g&#58;message code=&quot;$&#123;flash.message&#125;&quot; args=&quot;$&#123;flash.args&#125;&quot;
default=&quot;$&#123;flash.defaultMessage&#125;&quot; />
</div>
</g&#58;if>
<div class=&quot;list&quot;>
<form name=&quot;searchCity&quot;
url=&quot;[action&#58;'webQuotation',controller&#58;'quotation']&quot;>

<g&#58;select optionKey=&quot;id&quot; optionValue=&quot;name&quot; name=&quot;country&quot;
id=&quot;country&quot; from=&quot;$&#123;Country.list()&#125;&quot;
onchange=&quot;$&#123;remoteFunction(controller&#58;'country', action&#58;'ajaxGetStates', params&#58;'\'id=\' + escape(this.value)', onComplete&#58;'updateState(e)')&#125;&quot;>
</g&#58;select>

<g&#58;select optionKey=&quot;id&quot; optionValue=&quot;name&quot; name=&quot;state&quot; id=&quot;state&quot;
onchange=&quot;$&#123;remoteFunction(controller&#58;'state', action&#58;'ajaxGetCities', params&#58;'\'id=\' + escape(this.value)', onComplete&#58;'updateCity(e)')&#125;&quot;>
</g&#58;select>
<g&#58;select name=&quot;city&quot; id=&quot;city&quot;></g&#58;select>

<g&#58;javascript>

function updateState(e) &#123;
// The response comes back as a bunch-o-JSON
var states = eval(&quot;(&quot; + e.responseText + &quot;)&quot;) // evaluate JSON

if (states) &#123;
var rselect = document.getElementById('state')

// Clear all previous options
var l = rselect.length

while (l > 0) &#123;
l--
rselect.remove(l)
&#125;

// Rebuild the select
for (var i=0; i < states.length; i++) &#123;
var state = states[i]
var opt = document.createElement('option');
opt.text = state.name
opt.value = state.id
try &#123;
rselect.add(opt, null) // standards compliant; doesn't work in IE
&#125;
catch(ex) &#123;
rselect.add(opt) // IE only
&#125;
&#125;
&#125;
&#125;

function updateCity(e) &#123;
// The response comes back as a bunch-o-JSON
var cities = eval(&quot;(&quot; + e.responseText + &quot;)&quot;) // evaluate JSON

if (cities) &#123;
var rselect = document.getElementById('city')

// Clear all previous options
var l = rselect.length

while (l > 0) &#123;
l--
rselect.remove(l)
&#125;

// Rebuild the select
for (var i=0; i < cities.length; i++) &#123;
var city = cities[i]
var opt = document.createElement('option');
opt.text = city.name
opt.value = city.id
try &#123;
rselect.add(opt, null) // standards compliant; doesn't work in IE
&#125;
catch(ex) &#123;
rselect.add(opt) // IE only
&#125;
&#125;
&#125;
&#125;


// This is called when the page loads to initialize city
var zselect = document.getElementById('country')
var zopt = zselect.options[zselect.selectedIndex]
$&#123;remoteFunction(controller&#58;'country', action&#58;'ajaxGetStates', params&#58;'\'id=\' + zopt.value', onComplete&#58;'updateState(e)')&#125;

</g&#58;javascript>
<div class=&quot;buttons&quot;>
<span class=&quot;button&quot;>
<g&#58;submitButton name=&quot;toCourse&quot; class=&quot;save&quot; value=&quot;$&#123;message(code&#58; 'proximo', 'default'&#58; 'Proximo')&#125;&quot; />
</span>
</div>
</form>
</div>
</div>
</body>
</html>



displaySearchCourse


<html>
<head>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; />
<meta name=&quot;layout&quot; content=&quot;main&quot; />
<title><g&#58;message code=&quot;quotation.searchCourse&quot;
default=&quot;Busca Cursos&quot; /></title>
<resource&#58;autoComplete skin=&quot;default&quot; />
</head>
<body>
<div class=&quot;navMenu&quot;>
<span class=&quot;menuButton&quot;><a class=&quot;home&quot;
href=&quot;$&#123;createLinkTo(dir&#58; '')&#125;&quot;><g&#58;message code=&quot;home&quot;
default=&quot;Home&quot; /> </a> </span>
</div>
<div class=&quot;body&quot;>
<h1>
<g&#58;message code=&quot;quotation.searchCourset&quot; default=&quot;Busca Cursos&quot; />
</h1>
<g&#58;if test=&quot;$&#123;flash.message&#125;&quot;>
<div class=&quot;message&quot;>
<g&#58;message code=&quot;$&#123;flash.message&#125;&quot; args=&quot;$&#123;flash.args&#125;&quot;
default=&quot;$&#123;flash.defaultMessage&#125;&quot; />
</div>
</g&#58;if>
<g&#58;hasErrors bean=&quot;$&#123;quotationInstance&#125;&quot;>
<div class=&quot;errors&quot;>
<g&#58;renderErrors bean=&quot;$&#123;quotationInstance&#125;&quot; as=&quot;list&quot; />
</div>
</g&#58;hasErrors>
<div class=&quot;dialog&quot;>
<g&#58;form name=&quot;searchCourse&quot; url=&quot;[action&#58;'webQuotation',controller&#58;'quotation']&quot;>
<richui&#58;autoComplete name=&quot;schoolName&quot;
action=&quot;$&#123;createLinkTo('dir'&#58; 'school/findAllByNameLikeAjax')&#125;&quot; />

<richui&#58;autoComplete name=&quot;courseName&quot;
action=&quot;$&#123;createLinkTo('dir'&#58; 'course/findAllByNameLikeAjax')&#125;&quot; />

<div class=&quot;buttons&quot;>
<span class=&quot;button&quot;><g&#58;submitButton name=&quot;submitToCity&quot;
class=&quot;save&quot;
value=&quot;$&#123;message(code&#58; 'proximo', 'default'&#58; 'Proximo')&#125;&quot; />
</span>
</div>
</g&#58;form>
</div>
</div>
</body>
</html>




Agora o que esta realmente acontecendo .... seguindo o fluxo quando chamo a action:index da QuotationController ele me manda corretamente para a displaySearchStudent.gsp, depois seguindo o proximo passo do fluxo ele me manda corretamente para displaySearchCity.gsp porem depois disso ele nao esta me mandando para a displaySearchCourse.gsp

Alguem sabe me dizer o que tem de errado no meu codigo ?

Obrigado,
Tags: Grails


0
alguem tem alguma ideia ::?
09/04/2009 00:00


0
No display displaySearchCity você usou a tag form em vez do g:form.

[]'s

Rodrigo Auler
10/04/2009 00:00



Ainda não faz parte da comunidade???

Para se registrar, clique aqui.


Aprenda Groovy e Grails com a Formação itexto!

Newsletter Semana Groovy

Assinar

Envie seu link!


Livro de Grails


/dev/All

Os melhores blogs de TI (e em português) em um único lugar!

 
Creative Commons
RSS Grails Brasil é mantido por itexto Consultoria.
Em caso de problemas contacte Henrique Lobo Weissmann (Kico) por e-mail: kico@itexto.com.br
Todo o conteúdo presente neste site adota o Creative Commons como licença padrão.
Ver: 4.14.0
itexto