title: Problem with jsp/servlet page
body: <p>I want to create a simple JSP page. I have an EJB, in this there is a session bean.
  I have a JSP page and a Servlet, but I have a strange situation.</p>
  
  <p>When I click execute on my page, this turns in a white page and don't give me the result.
  I post here my code, can you help me please.</p>
  
  <p>Servlet: </p>
  
  <pre><code>package web;
  
  import java.io.IOException;
  import javax.servlet.ServletException;
  import javax.servlet.http.HttpServlet;
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
  
  import java.io.IOException;
  import javax.naming.*;
  import javax.servlet.*;
  import javax.servlet.*;
  import javax.servlet.http.*;
  
  import ejb.calc;
  /**
   * Servlet implementation class calcServlet
   */
  public class calcServlet extends HttpServlet {
   private static final long serialVersionUID = 1L;
  
      /**
       * @see HttpServlet#HttpServlet()
       */
      public calcServlet() {
          super();
          // TODO Auto-generated constructor stub
      }
  
   /**
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    */
   protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  
    HttpSession session=request.getSession(true); 
    RequestDispatcher rd=this.getServletContext().getRequestDispatcher("/index.jsp"); 
  
    float a=Float.parseFloat(request.getParameter("n1"));
    float b=Float.parseFloat(request.getParameter("n2"));
    char oper=request.getParameter("oper").charAt(0);
    float result=0;
  
    try {
     Context ctx=new InitialContext();
    // call the calcImpl class of the SimpleCalculator EJB with the mappedName
     calc cl=(calc) ctx.lookup("Firstcalc");
     switch(oper){
  
     case '+': result=cl.sum(a, b); break;
  
     case '-': result =cl.minus(a, b); break;
  
     case '*': result =cl.mult(a, b); break;
  
     case '/': result =cl.div(a, b); break;
    }
     session.setAttribute("result",result);
     request.setAttribute("a", a);
  
     request.setAttribute("b", b);
    }
    catch(NamingException e)
    {session.setAttribute("erreur: ",e.getMessage());
    }rd.forward(request,response);
   }
  
   /**
    * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
    */
   protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
   }
  
  }
  </code></pre>
  
  <p>JSP:</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
          pageEncoding="ISO-8859-1"%&gt;
      &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
      &lt;html&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;h2&gt; &lt;b&gt; Hello World To The Simple Calculator &lt;/b&gt; &lt;/h2&gt; &lt;% float a=2,b=1; if (request.getAttribute("a")!=null) a=Float.parseFloat(request.getAttribute("a").toString()); if( request.getAttribute("b")!=null) b=Float.parseFloat(request.getAttribute("b").toString()); %&gt; &lt;form method="post" action="calcServlet"&gt; &lt;b&gt;Number 1:&lt;/b&gt;&lt;input type='text' name='n1' value="&lt;%=a%&gt;" /&gt; &lt;br/&gt;
      &lt;b&gt;Number 2:&lt;/b&gt;&lt;input type='text' name='n2' value="&lt;%=b%&gt;" /&gt; &lt;br/&gt;
      &lt;u&gt;&lt;b&gt;Options:&lt;/b&gt;&lt;/u&gt; &lt;br/&gt;
      &lt;ul&gt;
      &lt;li&gt;&lt;b&gt;+&lt;/b&gt;&lt;input type='radio' name="oper" value='+' checked /&gt;&lt;/li&gt;
      &lt;li&gt;&lt;b&gt;&amp;nbsp;-&lt;/b&gt;&lt;input type='radio' name="oper" value='-' /&gt;&lt;/li&gt;
      &lt;li&gt;&lt;b&gt;*&lt;/b&gt;&lt;input type='radio' name="oper" value='*' /&gt;&lt;/li&gt;
      &lt;li&gt;&amp;nbsp; &lt;b&gt;/&lt;/b&gt;&lt;input type='radio' name="oper" value='/' /&gt;&lt;/li&gt; &lt;/ul&gt;
      &lt;b&gt;-------------------------------------------&lt;/b&gt; &lt;br/&gt;
      &lt;input type="submit" value="Executer" /&gt; &lt;/form&gt;
      &lt;font color='blue'&gt;&lt;b&gt;Result is: &lt;/b&gt; &lt;%=session.getAttribute("result")%&gt; &lt;/font&gt; &lt;br/&gt; &lt;font color='red' &gt;Error: &lt;%=session.getAttribute("error")%&gt;&lt;/font&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>