java - deciphering an array of objects in JSP -


i have array of objects passing servlet jsp

i have own class called object located @ com.example

class object {  string param1;  //getters , setters  } 

my servlet code:

object[] sampleobject = new object[5];  // code populate object   requestdispatcher dispatch = request.getrequestdispatcher("/inc/example.jsp");  request.setattribute("object", sampleobject); dispatch.forward(request, response); 

my example.jsp

    <%@ page language="java" contenttype="text/html; charset=iso-8859-1" pageencoding="iso-8859-1" %>     <%@ page import="java.util.*" %>  <%@ page import="com.example.object" %>     <jsp:usebean id="object" scope="request" class="java.util.arrays" />       <%      int l = object.length;     %> 

this fails error the value usebean class attribute java.lang.arrays invalid

when tried

<jsp:usebean id="object" scope="request" class="com.example.object" /> 

the error

the type of expression must array type resolved object 

it still fails . how should configuring jsp use .

what should class defined in jsp:usebean object . shouts @ me choosing java.util.arrays invalid shouts @ me when use com.example.object

try this:

<jsp:usebean id="object" scope="request" class="java.lang.object" /> 

at least able array, use explicit casting specific attributes. better use el tags iterate through array.


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -