简体   繁体   English

通过jsp将参数发送到@ModelAttribute注释的方法

[英]Send parameter to @ModelAttribute annotated method from jsp

I have the following method annotated with @ModelAttribute 我有以下用@ModelAttribute注释的方法

@ModelAttribute(value = "getRelatedNames")
public Map<String, String> getRelatedFormNames(String value) {
    // Logic to get and return the related names
}

How can I send the value String from the jsp? 如何从jsp发送value String? I have tried 我努力了

<c:forEach var="nameMap" items="${getRelatedNames('testString')}">
    <option value="${nameMap.key}">${nameMap.value}</option>
</c:forEach>

and

<c:forEach var="nameMap" items="${getRelatedNames(value = 'testString')}">
    <option value="${nameMap.key}">${nameMap.value}</option>
</c:forEach>

but I get the following error: 但我收到以下错误:

The function getRelatedNames must be used with a prefix when a default namespace is not specified

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @ModelAttribute在方法签名中使用@ModelAttribute注释方法 - @ModelAttribute annotated method WITH @ModelAttribute in method signature 在@ModelAttribute注释方法中返回Spring模型 - Returning a Spring Model in a @ModelAttribute annotated method 何时精确调用@ModelAttribute带注释的方法? - When is a @ModelAttribute annotated method called precisely? 通过带注释的@ModelAttribute方法将Spring Controller方法从模型绑定中排除 - Exclude Spring Controller method from model binding through annotated @ModelAttribute method 可以将ModelAttribute用作RequestMapping方法的方法参数吗? - Is it ok to use a ModelAttribute as a method parameter for RequestMapping method? Spring MVC @ModelAttribute @SessionAttributes-为什么模型属性需要带@ModelAttribute注释的方法? - Spring MVC @ModelAttribute @SessionAttributes - Why does a model attribute need a @ModelAttribute annotated method? 切入点表达式,将@ModelAttribute解析为方法参数 - pointcut expression to parse @ModelAttribute as method parameter Spring MVC @ModelAttribute 作为方法参数注解 - Spring MVC @ModelAttribute as a method parameter annotation 如何将参数从servlet发送到jsp页面 - how to send parameter from servlet to jsp page 如何从JSP向servlet发送label参数? - How to send label parameter from JSP to servlet?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM