JSP getting null values from Java servlet -


i trying pass values servlet jsp file. confirmed data going jsp servlet, not other way around. here java snippet

//here list<string> of column names list<string> columns = dataaccess.getcolumns(query);  //turn list<string> 1d array of strings for(int = 0 ; < numarrays ; i++)     request.setattribute("rows["+i+"]", rows[i]);  //set attribute key "columns" request.setattribute("columns", arcolumns);  //launch result.jsp request.getrequestdispatcher("result.jsp").forward(request, response); 

there expecting have 1d array of strings linked key "columns". when jsp file, null. here how retrieve , confirm null:

<%  string[] columns = (string[])request.getparametervalues("columns");      if(columns == null){         system.out.print("columns null\n");     }     int colnum = columns.length; //how many columns have %> 

in eclipse, when run code string "columns null" ont console, followed nullpointerexception when tried length of columns.

i confirmed arcolumns not null in java file, print column headers when try print them console.

what doing wrong here?

thank help.

i believe should instead try:

string[] columns = (string[]) request.getattribute("columns");  

Comments

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

css - SVG using textPath a symbol not rendering in Firefox -

c - gcc compile error: unknown type name 'File' -