wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Problem with applying Sql order by   to html table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem with applying Sql order by   to html table" Watch "Problem with applying Sql order by   to html table" New topic

Problem with applying Sql order by to html table

sirisha makkapati
Ranch Hand

Joined: Dec 10, 2006
Posts: 83
Hi to all,

I want to aply sql order by commands to html table.

TestCase_asc=select * from mytable order by testcase asc;
TestCase_desc=select * from my tableorder by testcase desc;
user_asc=select * from mytable order by user asc;
user_desc=select * from my tableorder by user desc;

My html table:

TestCase User
test1 ANTONY
Count ZXc
Compare ABC

When user clicks on fields,Records should sort by calling above sql commands.
Any one please give me the code for this.

Thanks in advance
Jesus Angeles
Ranch Hand

Joined: Feb 26, 2005
Posts: 2049
What is the problem? Have you coded it already? Any error?

Do you want to sort it without going back to the model/database/server, using javascript? Or you want to go back to re-query against the database?
sirisha makkapati
Ranch Hand

Joined: Dec 10, 2006
Posts: 83

I already have the code for sorting while clicking the radio buttons as follows.

<td bgcolor="#e1e8f3" align="left">
<input type="radio" name="<%= TestCasesData.RADIO %>0" value="1" >asc
<input type="radio" name="<%= TestCasesData.RADIO %>0" value="2" >desc

with The above line of code i could able to sort while clicking the radio buttons buti want to sort while clicking the arrow rather than clicking the radio button.

please help me,
Jeanne Boyarsky
internet detective

Joined: May 26, 2003
Posts: 30057

It sounds like you have an HTML question. I'll move this to our HTML forum for you.

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Alaa Nassef
Ranch Hand

Joined: Jan 28, 2008
Posts: 460
Hello Sirisha,

I advice you to use the display tag library. It gives you the ability to have sortable columns, and to sort by clicking on the column header.

I don't know if this is what you want or not. The problem here is that you are not specifying your problem clearly. Please try to be more clear so that I can help you better.

Visit my blog: http://jnassef.blogspot.com/
Bryce Martin
Ranch Hand

Joined: Nov 19, 2007
Posts: 269
You need to code for the arrow's onClick event just like you did for the radio buttons onClick event. Its essentially the same thing...you just need to apply it to the arrow instead of the button.
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with applying Sql order by to html table
Similar Threads
Head First Design Pattern -Command Pattern
Once again JAVA-ORACLE
Help with SQL
Solved : JTDS MSSQL Pagination problem.
Is the answer correct?