Results 1 to 1 of 1
- 12-21-2009, 11:43 PM #1
problem Creating Calculator with java and jsp
this is my java coding
this is my jsp page coding.Java Code:package user; /** * Created by abansari * User: Administrator * Date: Nov 30, 2009 * Time: 2:59:48 PM */ public class UserData { private long value1; private long value2; private char op; private long result; UserData() { value1 = 0; value2 = 0; op = '+'; result = 0; } void setFirstValue(long newValue) { value1 = value1 + newValue; } void setSecValue(long newValue) { value2 = value2 + newValue; } long getFirstValue() { return value1; } long getSecValue() { return value2; } }
my problem is now how to call java class is in jsp file?Java Code:<%@ page import="user.UserData" %> <%-- Created by IntelliJ IDEA. User: abansari Date: Dec 5, 2009 Time: 2:39:02 PM --%> <%@ page contentType="text/html;charset=UTF-8" language="java" %> <html> <head> <title>Calculator</title> </head> <body> <% // these lines for test purpose only // long value1; long value2; char op; long result; value1 = 1; value2 = 2; result = value1 + value2; // test purpose lines end // %> <table border="1px"> <form name="Calc" method="post" action=""> <tr> <td colspan="4"> <input type="text" name="textbox" value="<%=result%>"> </td> </tr> <tr> <td> <input type="button" name="1" value="1" onclick="var value1 = this.value"> </td> <td> <input type="button" name="2" value="2"> </td> <td> <input type="button" name="3" value="3"> </td> <td> <input type="button" name="divide" value="/"> </td> </tr> <tr> <td> <input type="button" name="4" value="4"> </td> <td> <input type="button" name="5" value="5"> </td> <td> <input type="button" name="6" value="6"> </td> <td> <input type="button" name="minus" value="-"> </td> </tr> <tr> <td> <input type="button" name="7" value="7"> </td> <td> <input type="button" name="8" value="8"> </td> <td> <input type="button" name="9" value="9"> </td> <td> <input type="button" name="multiply" value="*"> </td> </tr> <tr> <td> <input type="button" name="dot" value="."> </td> <td> <input type="button" name="0" value="0"> </td> <td> <input type="submit" name="equal" value="="> </td> <td> <input type="button" name="plus" value="+"> </td> </tr> </form> </table> </body> </html>
thanksAny fool can write code that a computer can understand. Good programmers write code that humans can understand.
Similar Threads
-
creating a simple calculator
By hobo in forum New To JavaReplies: 4Last Post: 11-09-2009, 03:09 AM -
Time Calculator Problem
By ktisallred in forum New To JavaReplies: 3Last Post: 09-22-2009, 07:15 PM -
Simple Calculator Display Problem :(
By jimbob in forum Java AppletsReplies: 4Last Post: 07-18-2009, 04:13 AM -
Problem in Calculator implementation using Stack
By realahmed8 in forum New To JavaReplies: 1Last Post: 12-19-2008, 11:58 PM -
Calculator Problem. Thanks for helping! ^^
By clark_sandy in forum New To JavaReplies: 3Last Post: 07-06-2008, 04:01 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks