开发者

url parameter set by label value in Spring MVC

Is there any way to make form url parameter submit by value of label?

I mean, I want to do simple sear开发者_StackOverflow中文版ch form like this:

<form:form action="usersearch.do?searchName=....">
<input type="text" id="search" name="search"> <input type="submit" value="Search">
</form:form>

How to set url parameter "searchName" by value that was put in my form, like: usersearch.do?searchName=JohnSmith


If you change your form method to "GET" then the field names will be submitted on the query string. For example:

<form:form action="usersearch.do" method="GET">
    <input type="text" id="search" name="searchName"/>
    <input type="submit" value="Search"/>
</form:form>

Will do result in a GET on a URL that looks like:

.../usersearch.do?searchName={formValue} e.g. JohnSmith

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜