I need help on JSP program..anyone know any gd website whereby they have tons of gd source code for my project?i need to do an jsp page to ban and delete user...but..i dunno how lehx..hope someone can help..thanks million!!
Sorry if i post in wrong forum
Originally posted by themoment86:I need help on JSP program..anyone know any gd website whereby they have tons of gd source code for my project?i need to do an jsp page to ban and delete user...but..i dunno how lehx..hope someone can help..thanks million!!
Sorry if i post in wrong forum
I'm not familiar with JSP, but if you already have the user account system in-place and using a SQL database to store the data, then isn't it as simple as executing a query of "DELETE FROM..."?
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=2162&lngWId=2
http://www.sap-img.com/java/how-to-connect-database-through-jsp.htm
http://scis.athabascau.ca/html/server/jspdemo.htm
The 2 links above will help you with connecting to database in jsp. I assume you know SQL and HTML so you should know how to proceed with the samples above.
i have done the connection thingy..is just those if-else thing that i dunno...haix..the more simple the code is more i dunno how to do..dunno why..lolx
Mine posting some relevant sections of the code as well as the database schema here?
1/ I think you need to design a simple user table in your database first, with fields like userbanstatus, userdeletestatus...
2/ then design the html page to list the users(with the functions of add, delete and ban users)
3/ covert it to jsp and add the sql onto the jsp.
List Users: select * from Table_Name where conditions
Add Users: INSERT INTO table_name vaules (..........)
Delete and Ban Users: update Table_Name set userbanstatus / userdeletestatus
Not recommend to delete the records in the database but change the status field to indicate that.
Hope it will help or my MSN: *removed*
Originally posted by themoment86:i have done the connection thingy..is just those if-else thing that i dunno...haix..the more simple the code is more i dunno how to do..dunno why..lolx
jsp is very similar to java. hope that helps.
Guys..need help urgently..need to hand in project on monday liao...i am trying to do a Ban user page whereby when the admin click the "ban" button..it will set the access level in the database to let say "2" and display "user banned" using mySQL statement
i need a serious guide or even the complete code if anyone has done similiar page using JSP before..left this page then i am done liao..but i try try still cannot..is the if-else statement that i am not good at..
help help :'(
So I assume that you have a field call access_level
the query
//68 is the user id to be banned
int user_id = 68; //to be banned
String query = "update table_name set access_level = 2 where user_id = "+user_id;
String query2 = "select * from table_name where access_level = 2";
Haven't touched java for a while but this should work.
Cheers
Gary