首页 \ 问答 \ 我们如何获得逆向的List对象?(How we get the List objects in backward direction?)

我们如何获得逆向的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
更新时间:2024-03-01 06:03

最满意答案

如果我理解正确,那不仅仅是刷新页面。 您在#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更改,您可以将路径而不是#放在锚点的href属性中(例如/ otherlink)。 对于打开聊天或打开一些div不需要在URL中发送它,它在div上的onclick事件及其扩展。 聊天仍然打开可能是第一次打开聊天时设置的cookie或标志,并检查和更改他们正在设置的标志的聊天。 As suggested by @andytuba For Facebook, Google "hash navigation ajax". For DavidWalsh, google "history ...
  • 在上面的代码中,我在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 ...
  • 第一部分是不可能的,因为重新加载页面不会保持前一页的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 ...
  • 你想使用一个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的评论的回应: ...
  • 如果你返回这个,你可以从控制器内的ajax处理程序刷新页面: return redirect()->refresh(); You can refresh the page from the ajax handler inside controller if you return this: return redirect()->refresh();

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。