精品毕业论文、毕业设计,优质的论文服务:www.51jplw.com 精品论文网
提供毕业设计(论文)和图文教程、视频教程等一揽子解决方案
private int currentpage=1; //当前页 private int pages; //总共页数
private int max=10; //一页最多显示的条数
public int getCurrentpage() { return currentpage; }
public void setCurrentpage(int currentpage) { this.currentpage = currentpage; }
public int getPages() { return pages; }
public void setPages(int pages) { this.pages = pages; }
public int getMax() { return max; }
public void setMax(int max) { this.max = max; }
public String getTopic() { return topic; }
public void setTopic(String topic) { this.topic = topic; }
public String getType() { return type; }
21
www.51jplw.com
精品毕业论文、毕业设计,优质的论文服务:www.51jplw.com 精品论文网
提供毕业设计(论文)和图文教程、视频教程等一揽子解决方案
public void setType(String type) { this.type = type; }
public String getAuthor() { return author; }
public void setAuthor(String author) { this.author = author; }
public Date getStartDate() { return startDate; }
public void setStartDate(Date startDate) { this.startDate = startDate; }
public Date getEndDate() { return endDate; }
public void setEndDate(Date endDate) { this.endDate = endDate; }
public int getHits() { return hits; }
public void setHits(int hits) { this.hits = hits; }
public String execute(){
Map map=ActionContext.getContext().getSession(); IArticleService service=(IArticleService) BeanFactory.getBean(\
List list=null;
List list2=(List) map.get(\ try {
if(author!=null&&topic!=null){
22
www.51jplw.com
精品毕业论文、毕业设计,优质的论文服务:www.51jplw.com 精品论文网
提供毕业设计(论文)和图文教程、视频教程等一揽子解决方案
//按条件搜索文档
list2=service.selectArticle(author.trim(),type,startDate,endDate,hits,topic.trim());
map.put(\ }
//判断并获得将要转到的JSP页面所要的文档
if(list2!=null){
pages=(int)((list2.size()+max-1)/max); if(currentpage<=pages){
if(list2.size()<=max*currentpage&¤tpage==pages){
list=list2.subList(max*(currentpage-1),list2.size());
}
if(list2.size()>max*currentpage){
list=list2.subList(max*(currentpage-1),max*currentpage);
} } }
//将JSP需要的变量放入session范围里
map.put(\ map.put(\
map.put(\} catch (Exception e) { e.printStackTrace();
//搜索失败时的提示信息
map.put(\搜索失败!请检查条件是否正
确!\
return \ }
return \}
23
www.51jplw.com
精品毕业论文、毕业设计,优质的论文服务:www.51jplw.com 精品论文网
提供毕业设计(论文)和图文教程、视频教程等一揽子解决方案
}
? 主界面的设计
应用程序的主界面在满足程序功能的前提下,一般遵循界面简洁、美观大方和人机交互友好的原则来设计。会员主页面控制面板菜单中所包含的功能选项如下所示:
修改个人信息:进入修改个人信息页面修改个人信息并保存。 查看所有文章:查看此系统中的所有资料。 按条件查询:按用户要求搜索资料。
查看热门文章:按系统里各资料的点击率查看文档(大于100则算是热门文档)。
发表文档:上发表文章。
查看自己的文档: 查找出自己发表的文档并能进行删除。 ? 发表文档的界面及实现过程
当用户点击发表文章时将会进入如下图5-5的界面:
图 5-5 发表文章界面
实现其功能的部分代码如下:
24
www.51jplw.com
精品毕业论文、毕业设计,优质的论文服务:www.51jplw.com 精品论文网
提供毕业设计(论文)和图文教程、视频教程等一揽子解决方案
package web.action;
import common.BeanFactory;
import bean.*; import service.*;
import java.io.BufferedOutputStream; import java.io.File;
import java.io.FileOutputStream; import java.util.*;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionContext;
import javax.servlet.ServletContext;
public class SendArticleAction { private String topic; private String type; private String author; private int hits;
private String content;
public String getTopic() { return topic; }
public void setTopic(String topic) { this.topic = topic; }
public String getType() { return type; }
public void setType(String type) { this.type = type; }
public String getAuthor() { return author;
25
www.51jplw.com