我有一个 Spring MVC 项目,其中我也使用了显示标签分页和 J-Query 选项卡。一切都很好,但是当我尝试在任何选项卡中从第 1 页移动到第 2 页的分页时,页面被刷新并且选项卡 1 再次处于活动状态。{如果我在第二个选项卡中分页但我被重定向到第一个}
我正在发布我的代码以供参考...请尽快提供帮助...
控制器
@RequestMapping(value="/listquestions", method = RequestMethod.GET)
public ModelAndView getQuestions() {
Map<String, Object> model = new HashMap<String, Object>();
List<Question> Answered=questionService.getAnswerQuestion();
model.put("Answer", Answered);
List<Question> unAnswer=questionService.getUnAnswerQuestion();
model.put("unAnswer", unAnswer);
return new ModelAndView("jsp/AdminIndex", model);
}
道
@Override
public List<Question> getUnAnswerQuestion() {
session= sessionFactory.getCurrentSession();
Query query= session.createSQLQuery("select * from Question where ques_id not in (select ques_id from Answer) order by date desc");
@SuppressWarnings("unchecked")
List<Question> list=query.list();
return list;
}
@Override
public List<Question> getAnswerQuestion() {
session= sessionFactory.getCurrentSession();
Query query= session.createSQLQuery("select * from Question where ques_id in (select ques_id from Answer) order by date desc");
@SuppressWarnings("unchecked")
List<Question> list=query.list();
return list;
}
服务
@Override
public List<Question> getUnAnswerQuestion() {
return questionDao.getUnAnswerQuestion();
}
@Override
public List<Question> getAnswerQuestion() {
return questionDao.getAnswerQuestion();
}
查看页面
<div id="tabs" style="width: 650px">
<ul>
<li><a href="#tabs-1">Unanswered</a></li>
<li><a href="#tabs-2">Answered</a></li>
</ul>
<!-- Answered -->
<div id="tabs-2">
<display:table name="${Answer}" pagesize="10" sort="list" id="tmp3" requestURI="listquestions.html">
<display:column style="vertical-align:top; padding-top: 7px; text-align: center; width: 75px; color:black;" sortable="true" headerClass="sortable" title="Username">
<a href="/gtlqa/getadmuserdet.html?uname=${tmp3[8]}"> <img src="/gtlqa/resources/images/userpic.gif" /></a><br>
${tmp3[8]}
</display:column>
<display:column sortable="true" headerClass="sortable" style="padding-left: 10px; padding-top: 7px; width: 465px;" title="Question Title">
<a href="/gtlqa/getQuestionDet.html?quId=${tmp3[0]}"> <h3 style="color: #00c6ff"> ${tmp3[1]}</h3> </a>
</display:column>
</display:table>
</div>
<!-- Unanswered -->
<div id="tabs-1">
<display:table name="${unAnswer}" pagesize="10" sort="list" id="tmp2" requestURI="listquestions.html">
<display:column style="vertical-align:top; padding-top: 7px; text-align: center; width: 75px; color:black;" sortable="true" headerClass="sortable" title="Username">
<a href="/gtlqa/getadmuserdet.html?uname=${tmp2[8]}"> <img src="/gtlqa/resources/images/userpic.gif" /></a><br>
${tmp2[8]}
</display:column>
<display:column sortable="true" headerClass="sortable" style="padding-left: 10px; padding-top: 7px; width: 465px;" title="Question Title">
<a href="/gtlqa/getQuestionDet.html?quId=${tmp2[0]}"> <h3 style="color: #00c6ff"> ${tmp2[1]}</h3> </a>
</display:column>
</display:table>
</div>
</div>