简体   繁体   中英

How can I enter a param for grails-gsp-link Tag in a gsp Page

I have a link via link tag, to a controller where a list function is coded. I want to execute the list function with a selection, eg a Year. I would like the user to have the possibility to enter the Year or any other selection criteria on the gsp-page and to route that user input to the params entry in the link tag. Link tag only offers:

<g:link action="list" params="[year: '2018']">myList</g:link>

with 2018 hard coded. I need it as a user entry.

How can I manage it?

As Mike W suggested, you should use a form for this. (If that is entirely not possible, there are alternatives, but form is the best option.)

To provide a simple example:

<g:form controller="myController">
    <label for="year">Year:</label>
    <input type="text" id="year" name="year" />
    <g:actionSubmit action="list" value="List" />
</g:form>

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM