Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieve values from radio buttons

 
phani kon
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp with radio buttons for Category below

1.ALL 2.GGG 3. HHH 4.TTT 5.TOT 6.ANYCAT

ANYCAT means select all catgory ie ALL,GGG,HHH,TTT,TOT. In the database, I have a table ALLSTATS table in the database which has got category as one of the column.

Category column contains ALL,GGG,HHH,TTT and TOT contains both( ALL ,GGG).

In the java file I am calling the method which passes the categories like below

ResultSet rs = wds.getData(String Category, int Month, intYear)


StringBuffer query = new StringBuffer("SELECT SUM(AMT), SUM(ADD_COLL) ");
query.append(" FROM "Constants.ALLSTATS" WHERE CAT
='").append(Category). append("' AND YEAR(DATE)=").append(year);

The above query is working fine for all categories(ALL,GGG,HHH,TTT) except TOT. How do I pass TOT catgory also which contains both(ALL, CGG). My code is below


if (Category == TOT)
{

Category =" ALL", +"," +"CGG";

StringBuffer query = new StringBuffer("SELECT SUM(AMT), SUM(ADD_COLL) ");
query.append(" FROM "Constants.ALLSTATS" WHERE CAT
IN'").append("(").append(Category).append(")"). append("' AND YEAR(DATE)=").append(year);


}
[ March 31, 2008: Message edited by: lakshmi manepally ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic