16th Lesson: servlet Implementation of product user reviews

Source: Internet
Author: User

First, the principle

User view, click to view the evaluation, can see the evaluation of the product

Based on the evaluation information, we determine that comments contains id,gid,uname,comment,add_time (evaluation ID, product ID, publisher, rating information, added time)

1, Database Establishment comments Table

2. Design Comment.java (Bean)

3. Design Commodity Evaluation DAO (Commentdao.java)

(1) list<comment>searcher (int gid) query the evaluation of a product

(2) list<comment>searcher (int gid,pageinfo PageInfo) page Inquiry Product evaluation

(3) Add (COMMENTC) comments

.... You can add change reviews, delete reviews, etc. as needed

Update (int id,string uname,string msg)//ID is the evaluation information ID, it is recommended to change the content of the evaluation, other can not be changed, leave a message to delete

Delete (int uname,int ID)//Remove evaluation, you can consider only post evaluation users can delete

Second, the evaluation of bean design

Iii. Evaluation of DAO Design

Iv. viewing and publishing a product evaluation design

1. detail.jsp page, add "review" hyperlink <a href= "Comment.jsp?gid<%=g.getgid ()%>" > Reviews </a>

2. comment.jsp Page view evaluation and post evaluation

Initial static page: comment.jsp


<title> Post Review page </title>
<link rel= "stylesheet" type= "Text/css" href= "Css/style.css" >

<body>

<div class= "Wrap" >
<div class= "Icon_center" >

<ul>
<li> Ref.:10002</li>
<li> Name: Xiaomi M4 </li>
<li> Description: Dual SIM double Quad core Intelligence, 5.0 large screen </li>
<li> Price:2117</li>
<li> Quantity:20</li>

</ul>
<div class= "Clear" ></div>
</div>
<div class= "Icon_center" >

<ul class= "Left" >
<li> Reviewers: admin </li>
<li> Evaluation Time:2013-10-1</li>
<li style= "width:200px" > Information:ceshi</li>
</ul>

<ul class= "Left" >
<li> Reviewers: admin </li>
<li> Evaluation Time:2013-10-1</li>
<li style= "width:200px" > Information: Leave a message </li>
</ul>

<ul class= "Left" >
<li> Reviewers: admin </li>
<li> Evaluation Time:2013-10-1</li>
<li style= "width:200px" > Message: Post a message 2</li>
</ul>

<ul class= "Left" >
<li> Reviewers: admin </li>
<li> Evaluation Time:2014-03-1</li>
<li style= "width:200px" > Message: Post a message fkkffk</li>
</ul>

<ul class= "Left" >
<li> reviewers: John Doe </li>
<li> Evaluation Time:2014-03-1</li>
<li style= "width:200px" > Info: I test </li>
</ul>

<div class= "Clear" ></div>
</div>
<div class= "Icon_center" >
<form method=post action= "/shop/commentaddservlet" >
<textarea name= "Content" rows= "4" cols= "> Leave a message </TEXTAREA>
<br/>
<input type= "hidden" name= "gid" value= "10002" >
<input type= "hidden" name= "AddUser" value= "Anonymous" >

<input type= "Submit" value= "POST" >
</FORM>
</div>
</div>
</body>


3, Controller servlet processing add post evaluation


V. Self-Realization Delete evaluation, user modification message


This article is from the "Learn Without thinking" blog, please be sure to keep this source http://dyzyxy.blog.51cto.com/944775/1637447

16th Lesson: servlet Implementation of product user reviews

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.