Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
manu kaushik
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
P.S. What's generating the XML? Could it not sort the data properly at the outset?
 
manu kaushik
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic