当前位置: 首页 > news >正文

松原做招聘的网站有哪些谷歌推广优化

松原做招聘的网站有哪些,谷歌推广优化,怎样做网站代理,舆情分析师二、实验项目内容&#xff08;实验题目&#xff09; 编写代码&#xff0c;掌握MVC的用法。 三、源代码以及执行结果截图&#xff1a; inputMenu.jsp&#xff1a; <% page contentType"text/html" %> <% page pageEncoding "utf-8" %> &…

二、实验项目内容(实验题目)

编写代码,掌握MVC的用法。

三、源代码以及执行结果截图:

inputMenu.jsp:

<%@ page contentType="text/html" %>

<%@ page pageEncoding = "utf-8" %>

<jsp:useBean id="menu" class ="save.data.MenuBean" scope="session"/>

<style>

   #textStyle{

      font-family:宋体;font-size:36;color:blue

   }

</style>

<HTML><body bgcolor=#ffccff>

<form action="addMenu" id= textStyle method=post>

输入餐单(每次输入一个消费项目)<br>

名称:<input type=text name='foodName' id =textStyle value ='剁椒鱼头' size = 8 />

价格:<input type=text name='price' id =textStyle value ='26.9' size = 8 />

<br><input type=submit id=textStyle value="添加到餐单">

</form>

</body></HTML>

showMenu.jsp:

<%@ page contentType="text/html" %>

<%@ page pageEncoding = "utf-8" %>

<jsp:useBean id="menu" class ="save.data.MenuBean" scope="session"/>

<style>

   #tom{

      font-family:宋体;font-size:26;color:blue

   }

</style>

<HTML><body bgcolor=pink>

<table border=1>

   <tr><th id=tom>序号</th><th id=tom>食物名称</th><th id=tom>价格</th>

<%  request.setCharacterEncoding("utf-8");

    String index = request.getParameter("删除");

    if(index!=null){

       menu.removeFood(Integer.parseInt(index));

    }

    for(int i=0;i<menu.size();i++){

        out.print("<tr>");

        out.print("<td id=tom>"+(i+1)+"</td>");

        out.print("<td id=tom>"+menu.getFoodName(i)+"</td>");

        out.print("<td id=tom>"+menu.getPrice(i)+"</td>");

        out.print("<td ><form action ="+"showMenu.jsp"+" method=post>");

        out.print("<input type = hidden name = 删除 value = "+i+" />");

        out.print("<input type = submit  value = 删除该食物 />");

        out.print("</form></td>");

        out.print("</tr>");

    }

  

%> </table>

<p id = tom>

餐单总额(共有<%=menu.size()%>道食物): 

<jsp:getProperty name="menu" property="totalPrice" /><br>

点餐时间:

<jsp:getProperty  name="menu" property="time" /></p>

<a id =tom href="inputMenu.jsp">继续点餐</a>

</body></HTML>

web.xml:

<?xml version="1.0" encoding="utf-8"?>

<web-app>

    <!--  以下是web.xml文件新添加的内容 -->

    <servlet>

        <servlet-name>addMenu</servlet-name>

        <servlet-class>handle.data.HandleMenu_Servlet</servlet-class>

    </servlet>

    <servlet-mapping>

        <servlet-name>addMenu</servlet-name>

        <url-pattern>/addMenu</url-pattern>

    </servlet-mapping>

</web-app>

Food:

package save.data;

public class Food implements Comparable<Food>{

    String foodName ;  

    double price;     

    public void setFoodName(String name){

        foodName = name;

    }

    public String getFoodName(){

        return foodName;

    }

    public void setPrice(double d){

        price = d;

    }

    public double getPrice(){

        return price;

    }

    public int compareTo(Food food){

        return (int)(food.getPrice()*1000-price*1000);

    }

}

MenuBean:

package save.data;

import java.util.ArrayList;

import java.util.Collections;

public class MenuBean {

    String time ;

    String totalPrice;

    ArrayList<Food> foodList;

    public MenuBean(){

        foodList = new ArrayList<Food>();

    }

    public void addFood(Food food){

        foodList.add(food);

        Collections.sort(foodList);

    }

    public void removeFood(int index){

        if(index>=0){

           foodList.remove(index);

           Collections.sort(foodList);

        }

    }

    public String getFoodName(int index) {

        return foodList.get(index).getFoodName();

    }

    public double getPrice(int index) {  

        return foodList.get(index).getPrice();

    }

    public int size() {

        return foodList.size();

    }

    public void setTime(String time){

        this.time = time

    }

    public String getTime(){

        return time

    }

    public String getTotalPrice(){

        double sum = 0;

        for(Food food:foodList){

          sum += food.getPrice();

        }

        totalPrice = String.format("%.2f",sum);

        return totalPrice;

    }

}

HandleMenu_Servlet:

package handle.data;

import save.data.Food;

import save.data.MenuBean;

import java.util.*;

import java.io.*;

import java.time.LocalTime;

import javax.servlet.*;

import javax.servlet.http.*;

public class HandleMenu_Servlet extends HttpServlet{

   public void init(ServletConfig config) throws ServletException{

       super.init(config);

   }

   public void service(HttpServletRequest request,HttpServletResponse response)

                       throws ServletException,IOException{

       request.setCharacterEncoding("utf-8");

       MenuBean menu  = null;

       HttpSession session=request.getSession(true);

       menu = (MenuBean)session.getAttribute("menu");

       if(menu == null ){

           menu = new MenuBean();

           session.setAttribute("menu",menu);

       }

       String foodName = request.getParameter("foodName");

       String price = request.getParameter("price");

       Food food = new Food();

       if(foodName.length()==0||price.length()==0){

            response.sendRedirect("inputMenu.jsp");

            return;

       }

       food.setFoodName(foodName);

       food.setPrice(Double.parseDouble(price));

       LocalTime dateTime = LocalTime.now(); 

       String str = dateTime.toString();

       String time =str.substring(0,str.lastIndexOf("."));

       menu.setTime(time);

       menu.addFood(food);

       response.sendRedirect("showMenu.jsp");

   }

}

运行结果图:

点餐:

增加菜单:

删除:

http://www.ds6.com.cn/news/7832.html

相关文章:

  • 湛江定制建站安卓优化神器
  • 投稿平台搜索引擎优化心得体会
  • 做视频的背景音乐哪里下载网站品牌活动策划
  • 创建网站要申请域名吗广告点击一次多少钱
  • 网站做可以退款吗江苏提升关键词排名收费
  • 免费网站建设公司推荐西安优化seo托管
  • 我要外包网官网上海seo优化外包公司
  • 男的和女的做那种事情网站谷歌手机网页版入口
  • 深圳网站公司制作电商推广
  • 网站平台建设需求表百度会员登录入口
  • 网站 美食频道 建设安卓优化大师官网下载
  • 网站建设保密协议书店铺运营
  • 创办一个网站需要多少资金百度下载免费安装
  • 深圳网址网站建设公司公司网站优化方案
  • 制作动态网站的流程百度词条优化
  • h5模板免费哪里有网站推广优化
  • 教人做甜点的网站谷歌ads广告投放
  • 昆明网站建设哪家便宜足球世界排名国家
  • 淘宝客优惠券网站建设教程视频谷歌网站
  • 网站开发项目的部署seo优化培训班
  • 建筑网站图片在线网站seo诊断
  • 做平面设计去哪些网站找图重庆seo技术分享
  • 为什么做企业网站今日全国疫情一览表
  • wordpress文章样式专业网站优化培训
  • 北京cms建站系统百度搜索引擎广告投放
  • 网站建设改版公司宁波网站优化公司价格
  • 单位的网站的建设方案百度关键词首页排名服务
  • 政府网站建设进展情况优化的近义词
  • 新乡网站建设设计公司商务软文写作
  • 中国十大门窗品牌有哪些企业网站优化哪家好