能不能将下面这段java代码 用jstl和EL表达式表示 经过我的反复调试 我发现有个莫名奇妙的问题就是
因为在jsp页面中加入了下面的java代码我把代码贴出来大家帮忙看下<%ApplicationContextctx=newClassPathXmlApplicationC...
因为在jsp页面中加入了下面的java代码 我把代码贴出来大家帮忙看下
<%
ApplicationContext ctx = newClassPathXmlApplicationContext("beans.xml");
SubjectAction sa = (SubjectAction) ctx.getBean("sub");
sa.list();
List<Post> lp = new ArrayList<Post>();
PostAction pa = (PostAction) ctx.getBean("p");
List<Subject> listSubject = (List<Subject>) session.getAttribute("sList");
for (int i = 0; i < listSubject.size(); i++)
{
int [] a = new int[100];
List<Post> l = pa.loadBySubject_id(listSubject.get(i).getId());
for (int j = 0; j < l.size(); j++)
{
a[j] = l.get(j).getId();
}
int maxId = TSort.sort(a);
for (int j = 0; j < l.size(); j++)
{
if (l.get(j).getId() == maxId)
{
lp.add(l.get(j));
}
}
}
session.setAttribute("newPost", lp);
%> 展开
<%
ApplicationContext ctx = newClassPathXmlApplicationContext("beans.xml");
SubjectAction sa = (SubjectAction) ctx.getBean("sub");
sa.list();
List<Post> lp = new ArrayList<Post>();
PostAction pa = (PostAction) ctx.getBean("p");
List<Subject> listSubject = (List<Subject>) session.getAttribute("sList");
for (int i = 0; i < listSubject.size(); i++)
{
int [] a = new int[100];
List<Post> l = pa.loadBySubject_id(listSubject.get(i).getId());
for (int j = 0; j < l.size(); j++)
{
a[j] = l.get(j).getId();
}
int maxId = TSort.sort(a);
for (int j = 0; j < l.size(); j++)
{
if (l.get(j).getId() == maxId)
{
lp.add(l.get(j));
}
}
}
session.setAttribute("newPost", lp);
%> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询