aspose file tools*
The moose likes JSP and the fly likes how to sort tables displayed in a web page designed in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to sort tables displayed in a web page designed in JSP" Watch "how to sort tables displayed in a web page designed in JSP" New topic
Author

how to sort tables displayed in a web page designed in JSP

manu kaushik
Greenhorn

Joined: Aug 20, 2012
Posts: 7
Hi ,

I have written a java class to read XML file. I have 2 questions:

1) How can I display the data of XML file in a web page in a table form?
2) And I also have certain rules to apply to sort the table rows before displaying the table. How can I do this sorting in JSP file?

Cheers
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

You should not be doing any data processing in the JSP. JSP are view components. Prepare any data in the servlet controller, then forward the data to the JSP.

If you end up with XML, the JSTL's XML tags could prove helpful. If you parse the XML in order to sort the data into normal Java collections, then the JSTL core tags and EL will be your best friends.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61224
    
  66

P.S. What's generating the XML? Could it not sort the data properly at the outset?
manu kaushik
Greenhorn

Joined: Aug 20, 2012
Posts: 7
Xml files are the rugby matches files .. and data have to display on web page in such a way that highest score team should display at top in table row.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to sort tables displayed in a web page designed in JSP