制作简易计算器处理结果Servlet

ResultServlet.java:

package com.you.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 *
 * 类功能说明
 * 类修改者 修改日期
 * 修改说明
 * <p>Title:ResultServlet.java</p>
 * <p>Description:游海东个人开发</p>
 * <p>Copyright:Copyright(c)2013</p>
 * @author:游海东
 * @date:2014-6-15 下午11:20:56
 * @version V1.0
 */
public class ResultServlet extends HttpServlet
{
	/**
	 * @Fields  serialVersionUID:序列化
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Constructor of the object.
	 */
	public ResultServlet()
	{
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy()
	{
		super.destroy(); // Just puts "destroy" string in log
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
		this.doPost(request, response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 *
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
		response.setContentType("text/html;charset=utf-8");
		PrintWriter out = response.getWriter();

		double calResult=(Double)request.getAttribute("calResult");
		out.println("calResult="+calResult);
	}

	/**
	 * Initialization of the servlet. <br>
	 *
	 * @throws ServletException if an error occurs
	 */
	public void init() throws ServletException
	{

	}

}

制作简易计算器处理结果Servlet

时间: 2024-10-07 18:27:30

制作简易计算器处理结果Servlet的相关文章

制作简易计算器处理过程Servlet

CalculationServlet.java: package com.you.servlet; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet

制作简易计算器封装类

Calculator.java: /** * @Title:Calculator.java * @Package:com.you.model * @Description:封装计算的数值类 * @author:Youhaidong(游海东) * @date:2014-6-15 下午10:40:34 * @version V1.0 */ package com.you.model; import java.io.Serializable; /** * 类功能说明 * 类修改者 修改日期 * 修改说

Xcode 制作简易计算器

#import "ViewController.h" #import "jsq.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UILabel *label; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; jsqq = [[jsq alloc] init]; //初始

用VS制作简易计算器(WPF)

在VS中实现简易计算器的制作,最终实现计算器如下图所示: 窗口代码如下: <Window x:Class="我的简易计算器.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schema

js制作简易计算器(-)

前言:初学js,老师要求做一个简易计算器,目前只实现了能够计算,很多约束没有有做,待完善.仅作为自己的学习记录. <!doctype html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>简易计算器<

js代码借助函数eval制作简易计算器

之前我们实现一些简易的计算器功能,是通过判断运算符来实现简单的一元运算,但是eval这个函数可以将包含数字和运算符的字符串进行计算,得出运算结果. 1.先写html+css代码,做出一个计算器样子. CSS样式代码: <style>//计算器样式 table { border-collapse: collapse; font-size: 20px; margin: 50px auto; } td { text-align: center; width: 60px; height: 40px;

C# Windows form制作简易计算器

在经过一段时间的C#学习后,试着做了一个计算器的小工程. 计算器的界面如上图,包含基本的+.-.*./运算以及1/x运算和清零功能.代码如下: 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.Linq; 7 using System.Text; 8 using

简易计算器页面

Calculator.jsp: <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":&qu

C++.NET的简易计算器的制作

计算器的制作需要实现一下几个功能:加减乘除,连续计算,重复计算. 加减乘除就是简单的二元运算,连续计算就是不使用等号连续进行几次二元运算,重复计算就是进行一次二元运算之后再次单击等号可以将之前的运算再次进行一次. 由于是C++的窗体程序,所以先设计出窗体的界面.界面如下. 需要注意的是,上面的两个显示框用的是TextBox,其余的均是Button. 窗体的FormBorderStyle属性应改成FixedSingle或其他,不能用None,这个样子计算器窗体框的大小就是固定不可变的. Maxim