I am really confused about this question. I have tried everything and nothing works.

I want to be able to get the volume and display it as param.volume. However it will return zero if I do it as a scriptlet.

I want to be able to create the getter method named getVolume that returns the volume of the cube when called (side \* side \* side).

My getter method is:

```
package servlets;

public class Cube {

    private int side;

    private int volume;

    public void setVolume(int volume){
        this.volume=volume;
    }

    public int getVolume() {
        volume=side*side*side;
        return volume;
    }

    public int getSide() {
        return side;
    }

    public void setSide(int side) {
        this.side = side;
    }

}

```

In the CalcServlet:

```
package servlets;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class CalcServlet
 */
@WebServlet("/calc")
public class CalcServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

        protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        }

        protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

                String scube=request.getParameter("cube");

                Cube obj=new Cube();

                try{
            int cube=Integer.parseInt(scube);
            obj.setSide(cube);
            obj.getVolume();

            request.setAttribute("cube", obj);

            }catch(NumberFormatException e){

            }
                ServletContext sc = this.getServletContext();
            //RequestDispatcher rd = request.getRequestDispatcher("/WEB-INF/pages/result.jsp"); 
                RequestDispatcher rd = sc.getRequestDispatcher ("/WEB-INF/pages/result.jsp");
            rd.forward(request, response);

        }

    }

```

In result.jsp:

```
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
 <%@ taglib prefix="c" 
           uri="http://java.sun.com/jsp/jstl/core" %>  

<%@ taglib tagdir="/WEB-INF/tags" prefix="myjsp" %>
<%@ page import="servlets.Cube, servlets.CalcServlet " %>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

<body>

<h2>Cube Info Using JSP 2.0 </h2><br>
<b>Side of a Cube: ${param.side} </b><br>
<b>Volume of a Cube: ${param.side*param.side*param.side}</b><br>

 <br></br><br>
 Using Custom Tag:
<myjsp:displayform color="red"></myjsp:displayform>

 <br></br><br>
<h2>Using JSTL:</h2>
<h2>Cube Info Using JSP 2.0 </h2><br>
<b>Side of a Cube: ${param.side} </b><br>
<b>Volume of a Cube: </b>
<c:choose>
    <c:when test="${param.side*param.side*param.side>10}">
    <li><span style="color: red;">Volume: ${param.side*param.side*param.side}</span></li>
    </c:when>
    <c:otherwise>
    <li><span style="color: black;">Volume: ${param.side*param.side*param.side}</span></li>
    </c:otherwise>
    </c:choose>

</body>
</html>

```

The result displays because param.side is being read. However I want to do this with param.volume. Please help!! I have tried everything.