1.可以根据关键字搜索商品
2.可以根据商品的分类和价格过滤搜索结果
3.可以根据价格排序
4.可以实现基本的分页功能
2 界面效果
3 项目环境搭建
1.创建一个动态的web工程
2.导入springmvc相关的jar包
3.导入solrJ的jar包和依赖包
4.导入solr/example/lib/ext下的jar包
5.配置springmvc.xml配置文件
6.配置web.xml配置文件
7.配置图片文件的虚拟路径
8.拷贝样式文件到项目中
springmvc.xml配置文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd"> <!-- 配置扫描组件 ,扫描@Controller,@Service等--> <context:component-scan base-package="com.query.jd"></context:component-scan> <!-- 配置注解驱动,如果配置此标签可以不用配置处理器映射器和适配器 --> <mvc:annotation-driven /> <!-- 配置视图解析器 --> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean> <!-- 配置solrserver --> <bean name="solrServer" class="org.apache.solr.client.solrj.impl.HttpSolrServer"> <constructor-arg index="0" value="http://localhost:8080/solr/collection1"></constructor-arg> </bean> </beans>