简体   繁体   English

java 的奇怪行为

[英]strange behaviour of java

I have a form named abc with multiple dropdown elements named as splitOption .html of this element is something like this-我有一个名为abc的表单,其中包含多个名为splitOption的下拉元素。该元素的 html 是这样的 -

<select title="Split Delivery for EO2135VX" name="splitOption"  onchange="splitDelivery('2','trId2',this.value,'5000','N',this,0,'DIST');"> 
    <option value="" selected=""></option>
    <option value="2">Split 2 deliveries</option>
    <option value="3">Split 3 deliveries</option>
    <option value="4">Split 4 deliveries</option>
    <option value="5">Split 5 deliveries</option>
</select>

When I submit the form and try to get this value in my controller by this code当我提交表单并尝试通过此代码在我的 controller 中获取此值时

String[] arrSplitOption = request.getParameterValues("splitOption");

It gives me arrSplitOption = null in my logs, this issue is only in mozila , it's working fine in IE.它在我的日志中给了我arrSplitOption = null这个问题仅在 mozila 中,它在 IE 中运行良好。 I tried to alert the splitOption length just before submitting the form, it gave me correct value.我试图在提交表单之前提醒splitOption length ,它给了我正确的值。
I don't know what's going wrong.我不知道出了什么问题。 can any body tell me what could be the reason behind this.任何人都可以告诉我这背后的原因是什么。

String[] arrSplitOption = request.getParameterValues("splitOption");

That shouldn't work unless you have multiple="multiple" in the <select/> .除非您在<select/>中有multiple="multiple" ,否则这应该不起作用。 There'd be no reason for it return more than a single string without multiselect enabled on the select.在 select 上没有启用多选的情况下,它没有理由返回多个字符串。

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

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