Good day!
I tried using JSTL in java but there's an error:
exception
javax.servlet.ServletException: java.lang.InstantiationException: class session.Item : java.lang.InstantiationException: session.Item
root cause
java.lang.InstantiationException: class session.Item : java.lang.InstantiationException: session.Item
My code is as follows:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>DISPLAY ITEM</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<jsp:useBean id="invenItem" class="session.Item" scope="request"/>
<c:choose>
<c:when test="${invenItem != null}">
<h1>Inventory Item Details: JSP Tester</h1>
Stock ID : <jsp:getProperty name="invenItem" property="stockID" /><br/>
Name : <jsp:getProperty name="invenItem" property="itemName" /><br/>
Unit Price: <jsp:getProperty name="invenItem" property="unitPrice" /><br/>
On Stock : <jsp:getProperty name="invenItem" property="onStock" />
<h1> Inventory Item Details Tester: EL Method </h1>
Stock ID : ${invenItem.stockID} <br/>
Name : ${invenItem.itemName}<br/>
Unit Price: ${invenItem.unitPrice}<br/>
On Stock : ${invenItem.onStock}
</c:when>
<c:otherwise>
<%@ include file ="DataForm.html" %><br>
Item not existing!<br>
<%@ include file ="ItemEntry.html" %>
</c:otherwise>
</c:choose>
</body>
</html>
I've read this JLPT already and followed all the instructions there. Please help. Thank you.
EDIT...
I resolved the error as suggested, but still the JSTL (if else logic) is not working. HELP PLEASE!!!!