在字符串数组中传递查询字符串值

问题描述:

在传递字符串数组中的查询字符串值时出现问题。 声明如下。在字符串数组中传递查询字符串值

words[0]=request.getParameter("word1"); 
words[1]=request.getParameter("word2"); 

以上陈述给了我一个异常,并给予值0 请帮我在这方面。

在此先感谢。

+3

发布堆栈跟踪。 – 2013-04-25 09:13:02

+3

什么例外?共享错误堆栈跟踪。 – Apurv 2013-04-25 09:13:12

+3

请在你的代码中发布行,你声明'words' – 2013-04-25 09:13:20

可能的解决方案/原因:

  1. 确保您数组初始化String[] words = new String[2]
  2. 请确保您的input元素在提交的form之内。