2013-04-16 80 views
0

我想在我的項目中使用顯示標籤庫。春天mvc貼圖+ displaytag分頁/排序

JSP:

<display:table name="rooms" class="table table-striped" pagesize="5"> 
    <display:column property="name" titleKey="crs.admin.room.roomName" sortable="true" /> 
    <display:column property="capacity" /> 
</display:table> 

控制器:

@Controller 
public class RoomController { 
.... 
@RequestMapping(value = "/roomManagement*", method = RequestMethod.GET) 
public ModelAndView get() { 
    ModelAndView modelAndView = new ModelAndView(); 
    modelAndView.setViewName("roomManagement"); 
    modelAndView.addObject("rooms", roomService.findAll()); 
    return modelAndView; 
} 

視圖解析:

<bean id="jspViewResolver" 
     class="org.springframework.web.servlet.view.InternalResourceViewResolver"> 
    <property name="viewClass" 
       value="org.springframework.web.servlet.view.JstlView"/> 
    <property name="prefix" value=""/> 
    <property name="suffix" value=".jsp"/> 
</bean> 

當我打開網頁,它在我的鏈接看起來像:

http://localhost:8081/roomManagement 

但點擊後分頁/分類鏈接,它看起來像:

http://localhost:8081/roomManagement.jsp?d-49653-s=0&d-49653-o=2 

而且becouse的「.JSP」後綴我控制器犯規處理此請求,並把犯規房間列表進入視野。 我該如何處理?

回答

1

好吧這是非常簡單的,我已經加入

requestURI="/roomManagement" 

參數顯示:table標籤