Reputation: 8067
I am using Play 1.2.4 framework for my application.
I am setting the hidden variable in the .html file using this:
<input type="hidden" name="test" value="test">
For retrieving the value of the hidden variable in controller, I used this:
String str = request.params.get("test");
But unfortunately the value of the String str is coming as null
which means its not working.
Kindly let me know how to retrieve the hidden variables value in the controller.
EDIT
<center>
<table>
<tr style="height: 100px">
<td><h1>
<b>Title</b>
</h1></td>
</tr>
<tr>
<td>#{a @Application.userList()} Click Me#{/a}</td>
<input type="hidden" name="test" value="test">
</tr>
</table>
Upvotes: 0
Views: 213
Reputation: 190
You should put your <input>
tag enclosed by a <form>
tag. Then, make a form request with your <a>
tag. The code would look like this:
<center>
<table>
<tr style="height: 100px">
<td><h1>
<b>Title</b>
</h1></td>
</tr>
<tr>
<td>
<form action="@{Application.userList()}" id="myform" method="get">
<a onclick="document.getElementById('myform').submit();">Click Me</a>
<input type="hidden" name="test" value="test">
</form>
</td>
</tr>
</table>
Upvotes: 1