南昌大学WEB实验报告.docx

上传人:b****0 文档编号:17548115 上传时间:2023-07-26 格式:DOCX 页数:43 大小:409.19KB
下载 相关 举报
南昌大学WEB实验报告.docx_第1页
第1页 / 共43页
南昌大学WEB实验报告.docx_第2页
第2页 / 共43页
南昌大学WEB实验报告.docx_第3页
第3页 / 共43页
南昌大学WEB实验报告.docx_第4页
第4页 / 共43页
南昌大学WEB实验报告.docx_第5页
第5页 / 共43页
南昌大学WEB实验报告.docx_第6页
第6页 / 共43页
南昌大学WEB实验报告.docx_第7页
第7页 / 共43页
南昌大学WEB实验报告.docx_第8页
第8页 / 共43页
南昌大学WEB实验报告.docx_第9页
第9页 / 共43页
南昌大学WEB实验报告.docx_第10页
第10页 / 共43页
南昌大学WEB实验报告.docx_第11页
第11页 / 共43页
南昌大学WEB实验报告.docx_第12页
第12页 / 共43页
南昌大学WEB实验报告.docx_第13页
第13页 / 共43页
南昌大学WEB实验报告.docx_第14页
第14页 / 共43页
南昌大学WEB实验报告.docx_第15页
第15页 / 共43页
南昌大学WEB实验报告.docx_第16页
第16页 / 共43页
南昌大学WEB实验报告.docx_第17页
第17页 / 共43页
南昌大学WEB实验报告.docx_第18页
第18页 / 共43页
南昌大学WEB实验报告.docx_第19页
第19页 / 共43页
南昌大学WEB实验报告.docx_第20页
第20页 / 共43页
亲,该文档总共43页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

南昌大学WEB实验报告.docx

《南昌大学WEB实验报告.docx》由会员分享,可在线阅读,更多相关《南昌大学WEB实验报告.docx(43页珍藏版)》请在冰点文库上搜索。

南昌大学WEB实验报告.docx

南昌大学WEB实验报告

 

实验报告

 

实验课程:

《WEB编程》

学生姓名:

学号:

专业班级:

 

2010年12月20日

●实验一..............................................

●实验二.............................................

●实验三.............................................

●实验四.............................................

●实验五.............................................

●实验六.............................................

●实验七..............................................

 

南昌大学实验报告

学生姓名:

学号:

专业班级:

实验类型:

□验证□综合■设计□创新实验日期:

2010年9月15日实验成绩:

实验一Web编程环境

一、实验目的

1.搭建Web编程环境,能正确安装配置java运行环境、WEB服务器和数据库服务器

2.熟悉WEB编程集成环境MYEclipse.

3.熟练掌握WEB工程的创建、发布、运行流程。

二、实验内容

1.安装并配置java运行环境JDK和JRE

2.安装Web服务器tomcat,配置Tomcat服务器

3.安装并配置数据库MySQL.

4.安装MyEclispe,熟悉各项菜单项

5.为MyEclispe集成配置JDK和Tomcat

6.创建、发布、运行一个WEB工程。

三、实验仪器及耗材

计算机,JDK,TOMCAT,MySQL,MyEclipse等软件。

四、实验步骤

1、安装并配置JDK和JRE

2、设置好classpath和path路径

3、安装Tomcat5.5

4、设置Tomcat的配置属性

5、安装并配置MySQL数据库

6、安装MySqLAdministrator工具

7、安装MyEclipse

8、新建并配置一个工程,运行发布一个新的工程。

五、实验结果

1、JDK、JRE安装结果:

2、Classpath和path设置

3、安装并配置Tomcat

4、安装并配置MySqL和MySqLAdministrator工具

5、安装MyEclipse

6、发布一个Web工程。

六、实验心得

 

南昌大学实验报告

学生姓名:

学号:

专业班级:

实验类型:

□验证□综合■设计□创新实验日期:

2010年9月22日实验成绩:

实验二HTML和CSS编程技术

一、实验目的

1.熟悉HTML静态网页编程技术,熟悉HTML各种标记,特别是表单标记

2.熟悉CSS编程技术,掌握CSS来格式化网页、掌握CSS盒式模型

3.掌握DIV+CSS布局和设计网页,掌握CSS设计网页的一般流程

4.熟悉Dreamweaver的CSS设计器

二、实验内容

1.构思一个新闻发布网站,主题自选,设计好新闻类别

2.制作主页PSD图

3.用DIV+CSS布局主页框架。

(如可分成top,mid,foot,其中mid再分两大块left和main)

4.分别细化设计每一大块。

5.要中间部分的左边或右边要设计一个小登录表单,并用CSS美化。

三、实验仪器及耗材

计算机,Dreamweaver8,Photoshop,MyEclipse等软件。

四、实验步骤

1、制作PSD图

2、使用DIV+CSS布局

3、细化每一块

4、美化表单部分

五、实验结果

1、制作PSD图

2、使用DIV+CSS布局

3、细化每一块

4、美化表单部分

六、实验心得

南昌大学实验报告

学生姓名:

学号:

专业班级:

实验类型:

□验证□综合■设计□创新实验日期:

2010年9月15日实验成绩:

实验三JavaScript编程技术

一、实验目的

1.熟悉JavaScript语法

2.掌握JavaScript函数的创建和调用

3.熟悉JavaScript对象,特别是浏览器对象,了解DOM模型,知道文档对象的访问方法。

4.会用JavaScript来对表单进行验证。

二、实验内容

1.用JavaScript完成对登录表单的验证

2.设计一个新闻发布的页面,并用JavaScript对新闻发布表单进行验证。

三、实验仪器及耗材

计算机,Dreamweaver8,Photoshop,MyEclipse等软件。

四、实验步骤

1、设计和实现对表单验证的过程

代码如下:

functionchecklogin()

{

varuser=document.getElementsByName("username")[0].value;

varpass=document.getElementsByName("password")[0].value;

if(user=="")

{

alert('请输入用户名');

returnfalse;

}

elseif(pass=="")

{

alert("请输入密码");

returnfalse;

}

else

{

returntrue;

}

}

2、设计和实现对新闻发布的验证过程

代码如下:

functioncheckarticle()

{

vara=document.getElementsByName("author")[0].value;

vart=document.getElementsByName("title")[0].value;

varc=document.getElementsByName("content")[0].value;

if(a=="")

{

alert('请输入的作者');

returnfalse;

}

if(t=="")

{

alert('请输入的标题');

returnfalse;

}

elseif(c=="")

{

alert('请输入的内容');

returnfalse;

}

else

{

returntrue;

}

}

五、实验结果

1、表单验证结果

2、文章发布页面验证

六、实验心得

南昌大学实验报告

学生姓名:

学号:

专业班级:

实验类型:

□验证□综合■设计□创新实验日期:

2010年9月29日实验成绩:

实验四Servlet编程技术

一、实验目的

1.熟悉Servlet技术的创建和运行流程。

2.会在web.xml配置Servlet的URL

3.熟悉请求request和响应response接口

4.熟悉请求转发接口requestDispatcher接口

5.熟悉会话Session接口,掌握基于Session登录权限控制。

二、实验内容

完成一个基于Session的登录权限控制模块。

要求:

a)主页登录表单提交后转到Servlet进行处理,根据用户类型转到不同的页面。

如果在用户名或密码不正确把登录表单包含进来

b)对于某些页面必须登录才能访问,如新闻发布页面。

如果没有登录则禁止访问,并重定向到登录页面。

三、实验仪器及耗材

计算机,MyEclipse等软件。

四、实验步骤

1、设计和实现一个登录表单

2、设计和实现实现验证的Servlet,然后进行验证

五、实验结果

1、表单验证效果

2、验证Servlet源代码

publicclassLoginServletextendsHttpServlet{

/**

*Constructoroftheobject.

*/

publicLoginServlet(){

super();

}

/**

*Destructionoftheservlet.

*/

publicvoiddestroy(){

super.destroy();//Justputs"destroy"stringinlog

//Putyourcodehere

}

/**

*ThedoGetmethodoftheservlet.

*

*Thismethodiscalledwhenaformhasitstagvaluemethodequalstoget.

*

*@paramrequesttherequestsendbytheclienttotheserver

*@paramresponsetheresponsesendbytheservertotheclient

*@throwsServletExceptionifanerroroccurred

*@throwsIOExceptionifanerroroccurred

*/

publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)

throwsServletException,IOException{

response.setContentType("text/html");

PrintWriterout=response.getWriter();

out

.println("

DOCTYPEHTMLPUBLIC\"-//W3C//DTDHTML4.01Transitional//EN\">");

out.println("");

out.println("AServlet");

out.println("");

out.print("Thisis");

out.print(this.getClass());

out.println(",usingtheGETmethod");

out.println("");

out.println("");

out.flush();

out.close();

}

/**

*ThedoPostmethodoftheservlet.

*

*Thismethodiscalledwhenaformhasitstagvaluemethodequalstopost.

*

*@paramrequesttherequestsendbytheclienttotheserver

*@paramresponsetheresponsesendbytheservertotheclient

*@throwsServletExceptionifanerroroccurred

*@throwsIOExceptionifanerroroccurred

*/

publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)

throwsServletException,IOException{

request.setCharacterEncoding("GBK");

response.setContentType("text/html;charset=GBK");

response.setCharacterEncoding("GBK");

Stringusername=request.getParameter("username");

System.out.println("用户名:

"+username);

MemberProcessmp=newMemberProcess();

if((mp.isExisted(username)))

{

Stringpassword=request.getParameter("password");

System.out.println("输入的密码:

"+password);

if(mp.validate(username,password))

{

HttpSessionsession=request.getSession(true);

Memberm=mp.getMemberByName(username);

session.setAttribute("userinfo",m);

session.setAttribute("login","true");

session.setAttribute("memberId",username);

session.setAttribute("loginusername",username);

if(request.getParameter("backpage")==null)

{

request.getRequestDispatcher("index.jsp").forward(request,response);

}

else

{

request.getRequestDispatcher(request.getParameter("backpage")).forward(request,response);

}

}

else

{

request.setAttribute("loginresult","密码错误");

request.getRequestDispatcher("member.jsp").forward(request,response);

}

}

else

{

request.setAttribute("loginresult","用户名不存在");

request.getRequestDispatcher("login.jsp").forward(request,response);

}

}

/**

*Initializationoftheservlet.

*

*@throwsServletExceptionifanerroroccurs

*/

publicvoidinit()throwsServletException{

//Putyourcodehere

}

}

六、实验心得

南昌大学实验报告

学生姓名:

学号:

专业班级:

实验类型:

□验证□综合■设计□创新实验日期2010年10月13日实验成绩:

实验五JSP编程技术

一、实验目的

6.熟悉JSP编译指令,动作标记。

7.熟悉JSP的隐含对象

8.正确理解request、session、application三个对象的作用域

9.能正确处理汉字乱码问题

10.能熟练使用JSP技术来编写网页

二、实验内容

1.编写一个文章类,用Myeclipse的工作自动产生getter和settet函数

2.修改前面编写过的管理员的新闻发布页面,改成JSP页面

要求如下:

1)撰写界面至少包括文件标题,所属栏目、作者、内容几项

2)界面用CSS进行美化

3)每个输入框均应有name属性。

4)权限控制,必须是管理员用户才能访问,跟前面实验的登录权限控制关联起来。

3.编写一个Servlet来处理新闻发布页面提交的表单

要求:

1)读取表单各项内容,并把存入一个文章对象中。

2)把文章对象绑定在request对象中,并转发到新闻显示页面。

3.编写一个新闻显示页面。

要求:

1)编写静态页面模板,页面用div+css设计

2)设定文章对象已存在request对象中,取出文章对象

3)把静态页面的内容改成动态内容,如标题,作者,内容等。

三、实验仪器及耗材

计算机,Dreamweaver8,Photoshop,MyEclipse等软件。

四、实验步骤

1、设计和实现新闻发布系统的页面

2、、设计和实现后台的Servlet

五、实验结果

1、页面的实现

2、Servlet的实现

publicclassArticleServletextendsHttpServlet{

privatestaticfinallongserialVersionUID=1L;

publicArticleServlet(){

super();

}

publicvoiddestroy(){

super.destroy();//Justputs"destroy"stringinlog

//Putyourcodehere

}

/**

*ThedoGetmethodoftheservlet.

*

*Thismethodiscalledwhenaformhasitstagvaluemethodequalstoget.

*

*@paramrequesttherequestsendbytheclienttotheserver

*@paramresponsetheresponsesendbytheservertotheclient

*@throwsServletExceptionifanerroroccurred

*@throwsIOExceptionifanerroroccurred

*/

publicvoiddoGet(HttpServletRequestrequest,HttpServletResponseresponse)

throwsServletException,IOException{

request.setCharacterEncoding("GBK");

response.setCharacterEncoding("GBK");

response.setContentType("text/html;charset=GBK");

ArticleBllab=newArticleBll();

StringopType=request.getParameter("opType");

if(opType==null)

{

request.getRequestDispatcher("articlelist.jsp").forward(request,response);

}

elseif(opType.equals("see"))

{

Stringaid=request.getParameter("articleId");

intid=0;

try

{

id=Integer.parseInt(aid);

}catch(NumberFormatExceptione)

{

id=1;

}

Articlea=ab.getArticle(id);

request.setAttribute("article",a);

request.getRequestDispatcher("article.jsp").forward(request,response);

}

elseif(opType.equals("seecmts"))

{

Stringaid=request.getParameter("articleId");

intid=0;

try

{

id=Integer.parseInt(aid);

}catch(NumberFormatExceptione)

{

id=1;

}

Vectorcmts=ab.getComments(id);

request.setAttribute("comments",cmts);

request.getRequestDispatcher("allcomments.jsp?

articleId="+id).forward(request,response);

}

elseif(opType.equals("remove"))

{

Stringaid=request.getParameter("articleId");

intid=0;

try

{

id=Integer.parseInt(aid);

}catch(NumberFormatExceptione)

{

id=1;

}

newArticleBll().remove(id);

request.getRequestDispatcher("article.jsp?

articleId="+id).forward(request,response);

}

}

/**

*ThedoPostmethodoftheservlet.

*

*Thismethodiscalledwhenaformhasitstagvaluemethodequalstopost.

*

*@paramrequesttherequestsendbytheclienttotheserver

*@paramresponsetheresponsesendbytheservertotheclient

*@throwsServletExceptionifanerroroccurred

*@throwsIOExceptionifanerroroccurred

*/

publicvoiddoPost(HttpServletRequestrequest,HttpServletResponseresponse)

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

当前位置:首页 > 农林牧渔 > 林学

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

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