Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

Arun Jassiar

Greenhorn
+ Follow
since Mar 16, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arun Jassiar

Thanks guy it worked
Bye
Arun
17 years ago
I am getting folloing error while inserting into a access database.
---------------------------------------------------------------
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:4246)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:1172)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:206)
at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(JdbcOdbcStatement.java:
163)
at InsertArticle.doPost(InsertArticle.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:4
04)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372
)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743
)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
, Compiled Code)
at java.lang.Thread.run(Thread.java:479)
----------------------------------------------------------------

Help me to do it.
My Code is below.
thanks.
Arun
__________________________________________________________
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.sql.*;
import java.util.Date;
public class InsertArticle extends HttpServlet{
// Data base connection
Connection dbCon;
// establish a connection and share it across all request
public void init(ServletConfig config) throws ServletException
{
super.init(config);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
dbCon=DriverManager.getConnection("jdbc dbc:CDGArticle");
}
catch (ClassNotFoundException e)
{
System.out.println("JDBC - ODBC Bridge not found");
return;
//catch1 closed
}
catch (SQLException e)
{
System.out.println("SQL exception thrown init");
return;
// catch2 closed
}
//init closed
}
// caaling doGet to process GET request
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,IOException
{
try
{
String authorName=request.getParameter("authorName");
String subject=request.getParameter("subject");
String message=request.getParameter("message");
//int i=0;
response.setContentType("text/html");//retuns html
//handle output Stream
PrintWriter out=response.getWriter();
String query = "select authorName, subject, message from CDGKnowledgeHub ";
String query1="insert into CDGKnowledgeHub"+ "values ( 'authorName' + ' subject' +'message')";

Statement stat=dbCon.createStatement();
//int visitor1=
stat.executeUpdate(query1);
ResultSet visitor=stat.executeQuery(query1);
while (visitor.next()) {
String a = visitor.getString(authorName);
String s = visitor.getString(subject);
String m = visitor.getString(message);
System.out.println(a+"\n"+ s+ "\n" + " " + m);
}

stat.close();
dbCon.close();

/*if (visitor1!= 0)
{
dbCon.commit();
//int intMsg = m.sendMessage();
out.println("Thanks "+authorName+". Your change request has been sent to Corporate Intranet Group.");
}//if closed
else
{
dbCon.rollback();
out.println("Kindly try again, the transaction could not be executed");
out.println("<a href=javascript:history.back(); > Back </a> ");
} // else closed*/
}
catch (Exception e)
{e.printStackTrace();
}
//doGet Closed
}
public String getServletInfo()
{
return "CDGArticle servlet";
}
//DisplayArticle closed
}
_________________________________________________________________

------------------
17 years ago
Dear Champs,
i have a big problem,
i am submitting a form (login.jsp),
with action some_action.jsp,
and redirecting it login_success.jsp
but i am getting null values through getParameter method in login_sucess.jsp
further i want to transfar thiese value to Active Server Page
on clicking at some link in login_success.jsp.
please Help me as soon as possible,
Arun

------------------
17 years ago
have ever seen JSP Html form example.
you can check that in any JSP Book,
u will find solution very well.
its very easy, just go and check ,
then after if u r not able to do it , then it i will
give u some code,
Arun

Originally posted by marko markovic:
Hi,
i have many inputs and combobox (select,option) in my jsp. I want to submit these values to another jsp page.
How i can do this?
Can anyone explain me that?
And maybe then, to submit values with sessions?
I am a newbie and don't really understand some thing.
$Regards
mm



------------------
17 years ago