i am relatively new to Grails so excuse me if my Problem is an easy to solve one or not.
Im developing a small WepApplication and have a problem with variables i create in my gsp.
Im creating my variable with <% ArrayList kategorie= new ArrayList() %> to use in a later method like this:
<g:set var="iterate2" value="${0}" />
<g:while test="${iterate2<kategorie.size }">
<h3>
<% println kategorie.get(iterate2) %>
</h3>
<div>
<p>
<% println kategoriebesch.get(iterate2) %>
</p>
<form>
<g:actionSubmit value="weiter" action="weiter" />
</form>
</div>
<% iterate2++ %>
</g:while>
Now i do want to pass the variable kategorie to my controller but i can't seem to figure out how to do that.
I also tried creating a static variable within the controller and then changing the value of this variable within the view but that doesn't seem to work either.
I would appreciate any help.
Store the value in an input hidden
<g:each in="${kategorie}" var="kat" status="i">
<h3>
${kat}
</h3>
<div>
<p>
${kategoriebesch[i]}
</p>
<form action="weiter">
<input type="hidden" name="kategorie" value="${kat}" />
<input type="submit" value="weiter" />
</form>
</div>
</g:each>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.