Results 1 to 3 of 3
  1. #1
    koricha is offline Member
    Join Date
    Feb 2012
    Rep Power

    Default Sum Of 2 Numbers Jsp

    i am trying to get the sum of 2 number it should give me a message if the sum is correct. i get an error "org.apache.jasper.JasperException: An exception occurred processing JSP page /index.jsp at line 21" .any suggestions whats wrong with the program.

    Java Code:
    <%@ page import="*"%><%@
    page import="java.util.*"%><?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <html xmlns="">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
            String sum = (String) session.getAttribute("sum");
            if (sum==null) {
                    sum = "0";
            int isum = Integer.parseInt(sum);
            String fib1 = "8";
            int ifib1 = Integer.parseInt(fib1);
            String fib2 = "13";
            int ifib2 = Integer.parseInt(fib2);
            String sm=request.getParameter("number");
            int num =Integer.parseInt(sm);
            <%=fib1%> + <%=fib2%> = <input type="text" name="number">
            <input type="button" value="go" onclick="doTheGObutton();">
            <form action="index.jsp" method="POST">
     <input type='submit' name='submit' id='add' value='add'>

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Sum Of 2 Numbers Jsp

    Moved from New to Java

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Sum Of 2 Numbers Jsp

    Is 'sm' a number?
    You really need to put this into a servlet.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Odd and Even Numbers
    By pinkdreammsss in forum New To Java
    Replies: 16
    Last Post: 04-19-2012, 05:57 AM
  2. how to change numbers into word numbers?
    By akeni in forum New To Java
    Replies: 13
    Last Post: 11-18-2011, 09:46 AM
  3. Replies: 11
    Last Post: 01-14-2011, 07:36 PM
  4. Sum of 4 numbers...!?
    By xmenus in forum New To Java
    Replies: 7
    Last Post: 02-14-2010, 04:36 PM
  5. printing two smallest numbers from a series of numbers
    By trofyscarz in forum New To Java
    Replies: 2
    Last Post: 10-14-2008, 11:46 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts