gpt4 book ai didi

java.lang.IllegalArgumentException : argument type mismatch

转载 作者:太空宇宙 更新时间:2023-11-04 07:38:39 25 4
gpt4 key购买 nike

我想从表单中填充字符串列表。

我的表单bean:

public class TaskForm extends ActionForm{
List<String> task = new ArrayList<String>();
public List<String> getTask() {
return task;
}
public void setTask(List<String> task) {
this.task=task;

}
}

我的jsp:

while (it.hasNext()) {
<textarea class="SubTaskTextArea_Style" id="task" name="task"></textarea></td>
}

struts配置:

<form-beans>
<form-bean name="TaskForm" type="controller.form.TaskForm" />

</form-beans>
<action-mappings>
<action path="/TaskAction" type="task.action.TaskAction" name="TaskForm">
</action-mappings>

情况是textarea可以是任意数字,我想将textarea中的字符串填充到formbean中。

但它给出了以下错误:

javax.servlet.ServletException: BeanUtils.populate
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1099)
org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause

java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:924)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:729)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

有人有什么想法吗?

最佳答案

您尝试显示值的方式可能不正确。尝试这样的事情:

<s:iterator value="task">
<textarea><s:property /></textarea>
</s:iterator>

想知道如何显示列表项?

编辑:

这里是:

<%int i = 0; %>
<s:iterator value="task">
<input type = "text" name = "t<%=i++%>" value="<s:property/>">
</s:iterator>

无论在如此创建的文本字段中输入什么值,都将自动填充在列表中任务

关于java.lang.IllegalArgumentException : argument type mismatch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16414858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com