我们如何获得逆向的List对象?(How we get the List objects in backward direction?)
您好,我正在获取包含表的pojo类对象的List对象。 在我的情况下,我必须以相反的顺序显示表格数据。 意思是说,为我前面添加一些行到数据库中的特定表,最近添加时,数据存储在表(数据库中)的最后一行。 在这里我必须以相反的顺序在我的jsp页面中显示表格的全部内容,这意味着我最近插入的内容必须在我的jsp页面中显示第一行。
在这里我的代码是,
List lst = tabledate.getAllData();//return List<Table> Object Iterator it = lst.iterator(); MyTable mt = new MyTable();//pojo class while(it.hasNext()) { mt=(MyTable)it.next(); //getting data from getters. System.out.println(mt.getxxx()); System.out.println(mt.getxxx()); System.out.println(mt.getxxx()); System.out.println(mt.getxxx()); }
Hi i am getting List object that contains pojo class objects of the table. in my case i have to show the table data in reverse order. mean that, for ex i am adding some rows to particular table in database when i am added recently, the data is storing at last row in table(in database). here i have to show whole content of the table in my jsp page in reverse order, mean that what i inserted recently have to display first row in my jsp page.
here my code was like,
List lst = tabledate.getAllData();//return List<Table> Object Iterator it = lst.iterator(); MyTable mt = new MyTable();//pojo class while(it.hasNext()) { mt=(MyTable)it.next(); //getting data from getters. System.out.println(mt.getxxx()); System.out.println(mt.getxxx()); System.out.println(mt.getxxx()); System.out.println(mt.getxxx()); }
原文:https://stackoverflow.com/questions/4573731
最满意答案
如果我理解正确,那不仅仅是刷新页面。 您在
#pendingChallengesPage
代码可能包含再次重定向到之前的代码。 请注意, 重新加载后URL是否仍然存在? 您已经明确表示页面内容没有变化。 URL怎么样?1)如果要在函数内重定向两次,则
return;
它首次重定向后的功能。2)使用
event.preventDefault();
如有必要。回复一些更多细节。 如果可以的话,在这里扔几个脚本。
If I understood it correctly, it's not just refreshing the page. Your code on
#pendingChallengesPage
might contain code that redirects again back to it's previous. Please mention it, Is the URL is persist after reload? You've clearly stated that page content is not changing. What about the URL?1) If you are redirecting inside a function twice,
return;
the function after it's first redirection.2) Use
event.preventDefault();
if necessary.Reply with some more details. if you could, throw few script here.
相关问答
更多-
要重新加载当前网页: 重定向到新页面: if (navigator.onLine) {window.location = "http://example.com/stats/"; } else { alert('of ...
-
如何使用URL更改进行ajax加载而不是页面重定向?(How to do ajax loading with URL change but not page redirection?)[2021-08-20]
你有两个问题: 对于URL更改,您可以将路径而不是#放在锚点的href属性中(例如/ otherlink)。 对于打开聊天或打开一些div不需要在URL中发送它,它在div上的onclick事件及其扩展。 聊天仍然打开可能是第一次打开聊天时设置的cookie或标志,并检查和更改他们正在设置的标志的聊天。 As suggested by @andytuba For Facebook, Google "hash navigation ajax". For DavidWalsh, google "history ... -
无法停止页面重新加载(Unable to stop page reload)[2022-06-25]
在上面的代码中,我在keyup事件(chatSearchFriends)上绑定了searchbox。 您无法停止按键上的按键传播。 该事件已经发生。 它必须在keydown或keypress上。 In the code above, I bind searchbox on keyup event (chatSearchFriends). You can not stop propagation of the key being press on key up. The event has already t ... -
Location标头必须包含有效的URL或绝对路径。 你的标题行应该是: $response->setHeaders($response->getHeaders()->addHeaderLine('Location', 'http://www.google.com')); 另外,你不应该真的叫exit; 在ZF应用程序中。 请参阅此处的答案,了解正确的结束执行方式。 The Location header must contain either a valid URL or an absolute pat ...
-
我可以在页面重定向后执行setTimeOut()吗?(Can I get setTimeOut() executed after page redirection? [duplicate])[2022-06-27]
第一部分是不可能的,因为重新加载页面不会保持前一页的JavaScript运行。 第二部分更好。 是的,您可以处理页面加载: $( document ).ready(function() { // Check your div here }); The first part is not possible since, reloading the page doesn't keep JavaScript of the previous page running. Second part is bette ... -
如果我理解正确,那不仅仅是刷新页面。 您在#pendingChallengesPage代码可能包含再次重定向到之前的代码。 请注意, 重新加载后URL是否仍然存在? 您已经明确表示页面内容没有变化。 URL怎么样? 1)如果要在函数内重定向两次,则return; 它首次重定向后的功能。 2)使用event.preventDefault(); 如有必要。 回复一些更多细节。 如果可以的话,在这里扔几个脚本。 If I understood it correctly, it's not just refresh ...
-
页面重定向(Page Redirection)[2023-04-25]
你想使用一个button而不是input type='submit' 。 您当前的按钮正在提交表单,而不是执行其onclick操作。 或以某种方式阻止提交操作。 或者你可以使用你的函数将表单动作设置为url并让它提交。 You want to use a button not an input type='submit'. Your current buttons are submitting the form, not performing their onclick actions. Or block ... -
该问题与动态生成的内容有关。 这里有一个后续行动 The problem was related to dynamically generated content. There is a followup here
-
每个连接仅具有用户在给定页面上花费的持续时间的生命周期。 当他们导航到另一个页面时,会建立新的连接。 此外,如果用户打开了多个选项卡或浏览器窗口,则它们将具有多个连接ID。 我认为您不希望尝试将连接ID保持在其预期的生命周期之外。 在我处理的类似场景中,我们存储connectionIds OnConnect并将其删除OnDisconnect。 当需要将消息发送给给定用户时,我们将其发送到所有connectionIds。 这可确保将消息传递到所有选项卡/窗口。 编辑1以下是对@ Saurabh的评论的回应: ...
-
如何在帖子后重新加载页面(How to reload page after post)[2022-04-05]
如果你返回这个,你可以从控制器内的ajax处理程序刷新页面: return redirect()->refresh(); You can refresh the page from the ajax handler inside controller if you return this: return redirect()->refresh();