Go Back   Webmaster Malaysia Forum » Website Design & Development » Website Programming

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 16-02-2004, 11:06 AM
dyda's Avatar
Novice Webmaster
 
Join Date: Feb 2004
Location: jb
Posts: 13
Rep Power: 0
dyda is on a distinguished road
jsp problem la

sape leh tolong,saya nak buat insert function tp asyik error je.nak kata problem connection ngan database function login boleh la run.sape2 sudi tolong.codingnye ade kat bawah ni.

<%
String StrName = request.getParameter("name");
String StrMatrix = request.getParameter("matrix");
String StrIC = request.getParameter("ic");
String StrCpa = request.getParameter("cpa");
String StrProg = request.getParameter("prog");



Connection dbconn = null;
ResultSet results= null;
PreparedStatement ps =null;

Class.forName("org.gjt.mm.mysql.Driver");

dbconn = DriverManager.getConnection("jdbc:mysql://localhost/spath02","root","");

String sql ="SELECT register.* FROM register WHERE matrix= ?";

ps = dbconn.prepareStatement(sql);
ps.setString(2,StrMatrix);
ps.setString(3,StrIC);

results = ps.executeQuery();

if (results.next())
{
response.sendredirect("error.html");

}
else
{String status = 0;
sql = "INSERT INTO register(name, matrix, ic, cpa, prog,status) VALUES (?,?,?,?,?,?)";

ps = dbconn.prepareStatement(sql);

ps.setString(1,StrName);
ps.setString(2,StrMatrix);
ps.setString(3,StrIC);
ps.setfloat(4,StrCpa);
ps.setint(5,StrProg);
pc.setint(6,status);
ps.executeUpdate();

response.sendredirect("login.jsp");

}
results.close();
ps.close();
dbconn.close();


%>



lepas tu error dia lak ni yang kuar:

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /projek/checkRegister2.jsp(2,4) Invalid directive
org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatc h(ErrorDispatcher.java:402)
org.apache.jasper.compiler.ErrorDispatcher.jspErro r(ErrorDispatcher.java:126)
org.apache.jasper.compiler.Parser.parseDirective(P arser.java:546)
org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1577)
org.apache.jasper.compiler.Parser.parse(Parser.jav a:171)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:247)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:237)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:456)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:439)
org.apache.jasper.JspCompilationContext.compile(Js pCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)


note The full stack trace of the root cause is available in the Tomcat logs.
__________________
dyda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 16-02-2004, 12:29 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 115
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
"org.apache.jasper.JasperException: /projek/checkRegister2.jsp(2,4) Invalid directive"

Check the checkRegister2.jsp for coding error.
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 16-02-2004, 03:50 PM
hymns's Avatar
Senior Webmaster
 
Join Date: Nov 2001
Location: Johor
Posts: 768
Rep Power: 98
hymns is on a distinguished road
Send a message via ICQ to hymns Send a message via Yahoo to hymns
hhuhuhuu lcf dah terer dah JSP... good try
__________________
I hate when:

vBulletin Message:
Sorry! The administrator has specified that users can only post one message every 60 seconds
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 16-02-2004, 04:27 PM
dyda's Avatar
Novice Webmaster
 
Join Date: Feb 2004
Location: jb
Posts: 13
Rep Power: 0
dyda is on a distinguished road
coding saya kasi tu la,coding untuk checkregister2.jsp.page yg seblm 2 just form method ='post'.
__________________
dyda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 16-02-2004, 04:31 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 115
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
terer in reading error messages only... because always got error in my code :P

dyda: no idea then... perhaps u need to read the tomcat log file. It will be located under <tomcat installation directory>/logs/

Log file is very helpful to debug
__________________
LiewCF | Malaysia Bloggers Forum

Last edited by lcf; 16-02-2004 at 04:35 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 16-02-2004, 07:02 PM
Senior Webmaster
 
Join Date: Oct 2001
Location: Melbourne, AU
Posts: 456
Rep Power: 94
sufyan is on a distinguished road
Hi,

On the first line of you file, make sure you have:
Code:
<%@page import="java.util.*,java.sql.*" %>
Something is wrong with the following bits of code, and your error probably lies within these few lines of code:
Code:
String sql ="SELECT register.* FROM register WHERE matrix= ?";

ps = dbconn.prepareStatement(sql);
ps.setString(2,StrMatrix);
ps.setString(3,StrIC);
How come there is only 1 ? and two setStrings, and why does the setString start from 2? Since i don't really know what the variables StrMatrix or StrIC are, I can't help you edit the code.

Also, with the SQL statement, try using just "register" (without the dot) instead of "register."

Try editing those lines above and see what you get.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 17-02-2004, 11:11 AM
dyda's Avatar
Novice Webmaster
 
Join Date: Feb 2004
Location: jb
Posts: 13
Rep Power: 0
dyda is on a distinguished road
still error lagi la...
matrix dan ic dlm db variablenye nvarchar

error yg same gak kuar.
ke something setting yg saya dah miss place.
...please....
__________________
dyda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 17-02-2004, 12:19 PM
lcf's Avatar
lcf lcf is offline
Pro-Blogger
 
Join Date: Feb 2003
Location: Kluang, Johor
Posts: 2,376
Rep Power: 115
lcf will become famous soon enough
Send a message via ICQ to lcf Send a message via MSN to lcf Send a message via Yahoo to lcf
see log file. see log file. see log file.
__________________
LiewCF | Malaysia Bloggers Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 17-02-2004, 01:57 PM
dyda's Avatar
Novice Webmaster
 
Join Date: Feb 2004
Location: jb
Posts: 13
Rep Power: 0
dyda is on a distinguished road
cam ne nak baca log file tu...byk sgt dlm tu error yg append2
__________________
dyda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 17-02-2004, 04:57 PM
dyda's Avatar
Novice Webmaster
 
Join Date: Feb 2004
Location: jb
Posts: 13
Rep Power: 0
dyda is on a distinguished road
sape2 leh tolong lagi nih....semua page yg buat sql statement berproblem..dan errorr yg kuar semua same cam tu...
ade tak solution yg boleh settlekan problem ni.
__________________
dyda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 19-02-2004, 03:25 PM
hymns's Avatar
Senior Webmaster
 
Join Date: Nov 2001
Location: Johor
Posts: 768
Rep Power: 98
hymns is on a distinguished road
Send a message via ICQ to hymns Send a message via Yahoo to hymns
hurm... x leh edit la... x tau var ape sebenarnya....
test tgk log ler
__________________
I hate when:

vBulletin Message:
Sorry! The administrator has specified that users can only post one message every 60 seconds
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 20-02-2004, 11:49 AM
dyda's Avatar
Novice Webmaster
 
Join Date: Feb 2004
Location: jb
Posts: 13
Rep Power: 0
dyda is on a distinguished road
dah settle dah..sorry aa..x gi tau dah dapat.
acrtually lib java tu terlupa nak tulis page..
tu pasal dapat error cam tu..
__________________
dyda
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 21-02-2004, 09:32 AM
hymns's Avatar
Senior Webmaster
 
Join Date: Nov 2001
Location: Johor
Posts: 768
Rep Power: 98
hymns is on a distinguished road
Send a message via ICQ to hymns Send a message via Yahoo to hymns
:P
__________________
I hate when:

vBulletin Message:
Sorry! The administrator has specified that users can only post one message every 60 seconds
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with new pc wirfash Mamak Stall 2 07-12-2005 11:39 AM
ISP problem lately? Hunz Mamak Stall 2 05-12-2004 04:08 PM
Any way to get around this problem philin Revenue and Monetization 18 09-10-2004 11:56 PM
ftp problem limteoh Webmaster Tools 2 03-05-2003 10:31 AM
IIS problem kasih Website Programming 1 01-10-2002 11:56 AM



All times are GMT +8. The time now is 03:01 PM. Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.


WebmasterMalaysia.com is Proudly Hosted by Exabytes Semi Dedicated Server.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59