ciao a tutti
ho fatto la seguente pagina jsp che fa da interfaccia con una servlet:
codice:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="it.netmon.OutputBean"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form method="post" name="myForm" action="/NetMon/AdminServlet">
<table>
<tr>
<td>Tipo Richiesta</td>
<td>
<select name="opRich">
<option value="1" <%=request.getParameter("opRich").equals("1")?"selected":"" %>>Lista Client[1]</option>
<option value="2" <%=request.getParameter("opRich").equals("2")?"selected":"" %>>Info pc [2]</option>
<option value="3" <%=request.getParameter("opRich").equals("3")?"selected":"" %>>Test TCP [3]</option>
<option value="4" <%=request.getParameter("opRich").equals("4")?"selected":"" %>>Test UDP [4]</option>
<option value="5" <%=request.getParameter("opRich").equals("5")?"selected":"" %>>Carico Centralizzato [5]</option>
<option value="6" <%=request.getParameter("opRich").equals("6")?"selected":"" %>>Carico anello[6]</option>
<option value="7" <%=request.getParameter("opRich").equals("7")?"selected":"" %>>Carico anello server[7]</option>
</select>
</td>
</tr>
<tr>
<td><input type="submit" name="Invio" value="Invio" /></td>
<td><input type="submit" onclick="document.myForm.action='/NetMon/index.jsp'" name="Reset" value="Reset"/></td>
</tr>
</table>
</form>
<%
if (request.getParameter("Reset") != null) {
session.setAttribute("outputBean",null);
}
if (request.getSession().getAttribute("outputBean") != null) {
OutputBean ob = (OutputBean)request.getSession().getAttribute("outputBean");
if (request.getParameter("opRich").equals("1")) {/* stampa solo le opzioni 1*/}
for(int a = 0;a < ob.getNomeClient().size();a++) { %>
Nome Client: <%= ob.getNomeClient().elementAt(a)%> attraverso la porta: <%= ob.getPortClient().elementAt(a)%>
<% } %>
<% if (ob.getNote() != null) {%>
Si è verificato un'errore: <%= ob.getNote()%>
<% }
}
%>
</body>
</html>
ma quando la eseguo mi da il seguente errore:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.NullPointerException
org.apache.jasper.servlet.JspServletWrapper.handle JspException(JspServletWrapper.java:491)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
root cause
java.lang.NullPointerException
org.apache.jsp.index_jsp._jspService(index_jsp.jav a:72)
org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:377)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
non riesco a capire a cosa sia dovuto...voi avete in mente qualcosa??