你应该是新手,还不明白概念,所以在网上找些视频教程看吧,搜索j2ee或者jsp的教程,jsp就是用java程序动态生成html页面,浏览器不能解析java代码,所以tomcat这种服务器负责解析,生成最终的html
应该是把java代码嵌入到 html 中 jsp: <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><% String path = request.getContextPath()String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><base href="<%=basePath%>"> <title>My JSP 'buy.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!-- <link rel="stylesheet" type="text/css" href="styles.css">--></head> <body><% request.setCharacterEncoding("utf-8")String productName=request.getParameter("productName")int productNum=Integer.parseInt("productNum")Object obj=session.getAttribute(productName)if(obj!=null){ int oldNum=((Integer)obj).intValue()productNum+=oldNumsession.setAttribute(productName, productNum)}else{ session.setAttribute(productName, productNum)} %>购物成功 <a href="show.jsp">查看购物车</a><a href="index.jsp">继续购物</a><% %></body></html>不能实现功能哈 只是给你看看结构希望采纳
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)