J2EE电子商务平台课内实验报告书文档格式.docx

上传人:b****2 文档编号:1563936 上传时间:2023-05-01 格式:DOCX 页数:71 大小:2.10MB
下载 相关 举报
J2EE电子商务平台课内实验报告书文档格式.docx_第1页
第1页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第2页
第2页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第3页
第3页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第4页
第4页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第5页
第5页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第6页
第6页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第7页
第7页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第8页
第8页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第9页
第9页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第10页
第10页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第11页
第11页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第12页
第12页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第13页
第13页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第14页
第14页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第15页
第15页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第16页
第16页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第17页
第17页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第18页
第18页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第19页
第19页 / 共71页
J2EE电子商务平台课内实验报告书文档格式.docx_第20页
第20页 / 共71页
亲,该文档总共71页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

J2EE电子商务平台课内实验报告书文档格式.docx

《J2EE电子商务平台课内实验报告书文档格式.docx》由会员分享,可在线阅读,更多相关《J2EE电子商务平台课内实验报告书文档格式.docx(71页珍藏版)》请在冰点文库上搜索。

J2EE电子商务平台课内实验报告书文档格式.docx

2.本次实验分为3个任务:

根据实验任务1~任务3要求,编写网页程序,并调试运行。

三、实验内容:

任务1JSP页面的基本结构

inputName.jsp

<

%@pagelanguage="

java"

contentType="

text/html;

charset=GB2312"

pageEncoding="

UTF-8"

%>

!

DOCTYPEhtmlPUBLIC"

-//W3C//DTDHTML4.01Transitional//EN"

"

http:

//www.w3.org/TR/html4/loose.dtd"

>

html>

head>

metahttp-equiv="

Content-Type"

content="

title>

Inserttitlehere<

/title>

/head>

BODYbgcolor=cyan>

FONTsize=3>

<

FORMaction="

people.jsp"

method=getname=form>

请输入姓名:

INPUTtype="

text"

name="

name"

BR>

INPUTTYPE="

submit"

value="

送出"

name=submit>

/FORM>

/BODY>

/html>

people.jsp

charset=ISO-8859-1"

BODYBGCOLOR=yellow>

FONTSize=3>

%!

intcount;

StringBufferperson;

publicvoidjudge()

{

if(count==0)

person=newStringBuffer();

}

publicvoidaddPerson(Stringp)

{

person.append(p);

}

else

person.append("

"

+p);

count++;

%>

%

Stringname=request.getParameter("

);

bytebb[]=name.getBytes("

iso-8859-1"

name=newString(bb);

if(name.length()==0||name.length()>

10)

jsp:

forwardpage="

inputName.jsp"

/>

%}

judge();

addPerson(name);

目前共有<

%=count%>

人浏览了该页面,他们的名字是:

%=person%>

/FONT>

任务2JSP指令标记

first.jsp

%@pagecontentType="

text/plain"

HTML>

BODY>

FONTsize=5color=blue>

%@includefile="

sc/fudanmei.txt"

/HTML>

second.jsp

application/vnd.ms-powerpoint"

third.jsp

application/msword"

DOCTYPEhtml>

FONTsize=5color=red>

fudanmei.txt

Itisnothowmuchwehave,buthowmuchweenjoy,thatmakeshappiness.

br>

Behappyforthismoment.Thismomentisyourlife.

Happinessiswhenwhatyouthink,whatyousay,andwhatyoudoareinharmony.

Thebestwaytopayforalovelymomentistoenjoyit.

任务3JSP动作标记

One.jsp

includepage="

sc/head062.txt"

/>

BODYbgcolor=green>

"

请输入1至100之间的整数:

number"

%

Stringnum=request.getParameter("

if(num==null)

{num="

0"

;

try

intn=Integer.parseInt(num);

if(n>

=1&

&

n<

=50)

two.jsp"

>

paramname="

%=n%>

/jsp:

forward>

%}

elseif(n>

50&

=100)

three.jsp"

catch(Exceptione)

error.jsp"

mess"

%=e.toString()%>

Two.jsp

charset=GB2312"

HEAD>

/HEAD>

P>

Fontsize=5color=white>

Thisistwo.jsp.

/Font>

Fontsize=5>

Strings=request.getParameter("

out.println("

传递过来的值是"

+s);

imgsrc="

sc/a.jpg"

width="

%=s%>

height="

/img>

Three.jsp

Fontsize=5color=red>

Thisisthree.jsp.

sc/b.jpg"

Error.jsp

Thisiserror.jsp.

传递过来的错误信息"

sc/c.jpg"

120"

head062.txt

tablecellSpacing="

1"

cellPadding="

60%"

align="

center"

border="

trvalign="

bottom"

td>

Ahref="

one.jsp"

fontsize=5>

one.jsp页面<

/font>

/A>

/td>

two.jsp页面<

three.jsp页面<

/tr>

/table>

实验三JSP内置对象

1.了解JSP中9个内置对象个内置对象request、response、out、session、application、config、pagecontext、page、exception的基本概念。

2.理解JSP内置对象的常用方法功能。

3.掌握JSP内置对象的应用。

二、实验原理:

在JSP页面的转换阶段,JSP引擎在_jspService()方法中声明并初始化了9个隐含对象,它们主要是为了方便在JSP页面对这些象的访问。

隐含对象包括:

application、session、request、response、out、page、pageContext、config、exception。

在上述9个隐含对象中,有下面4个作用域对象,它们是:

application、session、request、pageContext。

它们主要用来在不同作域中共享数据。

1.request对象:

import="

java.util.*"

GBK"

Stringpath=request.getContextPath();

StringbasePath=request.getScheme()+"

:

//"

+request.getServerName()+"

+request.getServerPort()

+path+"

/"

DOCTYPEHTMLPUBLIC"

basehref="

%=basePath%>

MyJSP'

index.jsp'

startingpage<

pragma"

no-cache"

cache-control"

expires"

keywords"

keyword1,keyword2,keyword3"

description"

Thisismypage"

--

linkrel="

stylesheet"

type="

text/css"

href="

styles.css"

-->

bodybgcolor="

#FFFFF0"

formaction="

method="

post"

inputtype="

提交"

/form>

请求方式:

%=request.getMethod()%>

请求的资源:

%=request.getRequestURI()%>

请求用的协议:

%=request.getProtocol()%>

请求的文件名:

%=request.getServletPath()%>

请求的服务器的IP:

%=request.getServerName()%>

请求服务器的端口:

%=request.getServerPort()%>

客户端IP地址:

%=request.getRemoteAddr()%>

客户端主机名:

%=request.getRemoteHost()%>

表单提交来的值:

%=request.getParameter("

)%>

Stringstr="

if(request.getParameter("

)!

=null){

Enumerationenumt=request.getParameterNames();

while(enumt.hasMoreElements()){

str=enumt.nextElement().toString();

out.println(str+"

+request.getParameter(str)+"

}

/body>

2.response对象:

Index.jsp

gbk"

你想重定向去哪个网站?

body>

Stringaddress=request.getParameter("

where"

if(address!

if(address.equals("

sohu"

))

response.sendRedirect("

elseif(address.equals("

avceit"

mypage"

mypage.jsp"

b>

Pleaseselect:

/b>

GET"

selectname="

optionvalue="

selected>

gotosohu

gotoavceit

gotomypage

/select>

go"

Mypage.jsp

BODYbgcolor="

green"

FONTsize=13>

WelcomeToMypage!

3.session对象:

met

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 法律文书 > 调解书

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2