Hi Mio Nino Marquez

Thanks for your reply now i am getting only Two errors please look into this
and help me over come this problem if you do this i will be Greatfull to
you.

Now my .jsp page is like this
****************************************************************************
****************************
<html>
<head>
</head>
<%@ page language="java" import="java.sql.*" %>
<body>
<%
try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   }
   catch(java.lang.ClassNotFoundException ex) { }

   String headitem_name   = request.getParameter("headitem_name");
   String clasi_name1        = request.getParameter("clasi_name1");
   String clasi_name2        = request.getParameter("clasi_name2");
   String clasi_name3        = request.getParameter("clasi_name3");
   String clasi_name4        = request.getParameter("clasi_name4");
   String clasi_name5        = request.getParameter("clasi_name5");
   String url="jdbc:odbc:Inventory";
   Connection con=DriverManager.getConnection(url, "sa", "");
   Statement stmt = con.createStatement();
   ?String headitem_code;
   ?String clasi_code1;
   ?String clasi_code2;
   ?String clasi_code3;
   ?String clasi_code4;
   ?String clasi_code5;

   CallableStatement CStmt = Con.prepareCall({?=call headitemcode[?]});
   CStmt.registerOutParameter(1,java.sql.Types.VARCHAR);
   CStmt.setString(1,headitem_name);
   String RetVal = CStmt.executeUpdate();
   headitem_code = CStmt.getString(1);

   CallableStatement CStmt1 = Con.prepareCall({?=call
subitemcode[?,?,?,?,?]});
  CStmt1.registerOutParameter(1,java.sql.Types.VARCHAR);
  CStmt1.registerOutParameter(2,java.sql.Types.VARCHAR);
  CStmt1.registerOutParameter(3,java.sql.Types.VARCHAR);
  CStmt1.registerOutParameter(4,java.sql.Types.VARCHAR);
  CStmt1.registerOutParameter(5,java.sql.Types.VARCHAR);
  CStmt1.setString(1,clasi_name1);
 CStmt1.setString(2,clasi_name2);
 CStmt1.setString(3,clasi_name3);
 CStmt1.setString(4,clasi_name4);
 CStmt1.setString(5,clasi_name5);
 String RetVal1 = CStmt1.executeUpdate();
 clasi_code1 = CStmt1.getString(1);
 clasi_code2 = CStmt1.getString(2);
 clasi_code3 = CStmt1.getString(3);
 clasi_code4 = CStmt1.getString(4);
 clasi_code5 = CStmt1.getString(5);

 String query1 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query2 ="values('" +headitem_code+"','" +headitem_name+ "','"
+clasi_name1+ "','" +clasi_code1+ "')";

 String query3 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query4 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name2+ "','" +clasi_code2+ "')";

 String query5 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query6 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name3+ "','" +clasi_code3+ "')";

 String query7 ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query8 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name4+ "','" +clasi_code4+ "')";

 String query9  ="insert into
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
code)";
 String query10 ="values('" +headitem_code+ "','" +headitem_name+ "','"
+clasi_name5+ "','" +clasi_code5+ "')";

   int rowsAffected =
stmt.executeUpdate(query1+query2+query3+query4+query5+query6+query7+query8+q
uery9+query10);

   if (rowsAffected ==1)
   {

%>

  <H1> Successful Addition of Head Item </h1>

<% }
   else
      {
%>

  <H1> Sorry , Head Item Addition has failed. </h1>

<%

      }
   cstmt1.close();
   cstmt2.close();
   stmt.close();
   con.close();

%>

</body>
</html>
**************************************************************End of my .jsp
file***************

Here are the errors i am getting like ..............

Error: 500

Location: /jspproj/addheaditem.jsp

Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for
JSPC:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspad
dheaditem_jsp_0.java:90: Missing term.
                   Statement stmt = con.createStatement();
                                                          ^
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
aditem_jsp_0.java:91: ':' expected.
                   ?String headitem_code;
                          ^
2 errors

        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
        at org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
        at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:149)
        at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:161)
        at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
        at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
        at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
        at java.lang.Thread.run(Unknown Source)
****************************************************************************
********end of errors ********

Thanks in advance
Suresh

> Suresh,
>
> Hi! I have to say it's still not clear to me what you're trying to do.
> Nevertheless, I can only guess. :) It seem to me that your problem is
mainly
> with JDBC (ie calling stored procedure, retrieving OUT parameter from the
> stored procedure). If that's the case, I suggest you check the JDBC Short
> Course at:
>
http://developer.java.sun.com/developer/onlineTraining/Database/JDBCShortCou
> rse/index.html (search for the CallableStatement string)
>
> Good luck!
>
> Mio Nino P. Marquez
>
> ----- Original Message -----
> From: "Suresh kumar K Badiga" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, December 11, 2000 3:07 PM
> Subject: Re: help on JSP
>
>
> > Hi
> >
> > Thanks for your reply now i removed SQL stuff . My problem is I had
> created
> > one Procedure in MS SQL it will take one String after that it will give
> one
> > string. suppose if user inputs string like ddsd dsdsds then it will give
> > like ddsd_dsdsds. so my procedure name is headitemcode,So please tell me
> how
> > to do this.....
> >
> > <html>
> > <head>
> > </head>
> > <%@ page language="java" import="java.sql.*" %>
> > <body>
> > <%
> > try{
> >     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
> >    }
> >    catch(java.lang.ClassNotFoundException ex) { }
> >
> >    String headitem_name   = request.getParameter("headitem_name");
> >    String clasi_name1        = request.getParameter("clasi_name1");
> >    String clasi_name2        = request.getParameter("clasi_name2");
> >    String clasi_name3        = request.getParameter("clasi_name3");
> >    String clasi_name4        = request.getParameter("clasi_name4");
> >    String clasi_name5        = request.getParameter("clasi_name5");
> >    String url="jdbc:odbc:Inventory";
> >    Connection con=DriverManager.getConnection(url, "sa", "");
> >    Statement stmt = con.createStatement();
> >   /* till here above code is ok*/
> >
> >   /*bellow i am calling the procedure here i wanted to pass user
inputted
> > string(headitem_name)
> >      then procedure will give the result string fdfff_ffdf this one i
want
>
> > to insert into the table  */
> >
> >     please tell me how pass the user input string like  fdfff ffdf  to
> > CallableStatement
> >     and how get the result string which is given by procedure fdfff_ffdf
> > and then how to insert
> >     this in to table
> >
> >     CallableStatement cstmt1 = con.prepareCall("{call
headitemcode(?)}");
> >
> >  /* here is the insert statement  in the bellow insted of +@s6 this i
ahve
> > to pass the result string fdfff_ffdf  */
> >
> >   String query1 ="insert into
> >
>
dbo.head_item1(headitem_code,headitem_name,clasification_name,clasification_
> > code)";
> >   String query2 ="values('" +@s6+"','" +headitem_name+ "','"
+clasi_name1+
> > "')";
> >   int rowsAffected = stmt.executeUpdate(query1+query2);
> >
> > Thanks in advance
> > -Suresh
> >
> >
> > > Wow, that's quite a mess. (no pun intended). It seems you have mixed
up
> > > MSSQL TSQL and JDBC stuffs altogether in a JSP file.
> > > I think you should create a Stored Procedure first, then in your JSP
> file
> > > call it using CallableStatement.execUpdate().
> > > Or remove the TSQL stuffs (like declare, select @var, begin..end
> > > combination) and replace them with valid JSP/Java stuffs
> > >
> > > Just my 2 cents. ;)
> > >
> > > Mio Nino P. Marquez
> > > (JSP/Servlet/Java Newbie)
> > >
> > > ----- Original Message -----
> > > From: "Suresh kumar K Badiga" <[EMAIL PROTECTED]>
> > > To: <[EMAIL PROTECTED]>
> > > Sent: Monday, December 11, 2000 1:51 PM
> > > Subject: Re: help on JSP
> > >
> > >
> > > > Hi MJ
> > > >
> > > > These are the errors i am getting plese help me ......
> > > >
> > >
> >
>
****************************************************************************
> > > > ***************************
> > > > Error: 500
> > > >
> > > > Location: /jspproj/addheaditem.jsp
> > > >
> > > > Internal Servlet Error:
> > > >
> > > > org.apache.jasper.JasperException: Unable to compile class for
> > > >
> > >
> >
>
JSPC:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspad
> > > > dheaditem_jsp_0.java:94: ';' expected.
> > > >                         declare
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:95: Invalid character in input.
> > > >                         @s1 varchar(100),
> > > >                         ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:96: Invalid character in input.
> > > >                         @s2 varchar(100),
> > > >                         ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:97: Invalid character in input.
> > > >                         @s3 varchar(100),
> > > >                         ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:98: Invalid character in input.
> > > >                         @s4 varchar(100),
> > > >                         ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:99: Invalid character in input.
> > > >                         @s5 varchar(100),
> > > >                         ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:100: Invalid character in input.
> > > >                         @s6 varchar(100),
> > > >                         ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:101: Invalid character in input.
> > > >                         @count int
> > > >                         ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:103: Invalid character in input.
> > > >                         select @count = 0
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:104: Invalid character in input.
> > > >                         select @s1 = '%clasi_name1%'
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:104: Invalid character constant.
> > > >                         select @s1 = '%clasi_name1%'
> > > >                                      ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:105: Invalid character in input.
> > > >                         select @s3 = '%clasi_name3%'
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:105: Invalid character constant.
> > > >                         select @s3 = '%clasi_name3%'
> > > >                                      ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:106: Invalid character in input.
> > > >                         select @s4 = '%clasi_name4%'
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:106: Invalid character constant.
> > > >                         select @s4 = '%clasi_name4%'
> > > >                                      ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:107: Invalid character in input.
> > > >                         select @s5 = '%clasi_name5%'
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:107: Invalid character constant.
> > > >                         select @s5 = '%clasi_name5%'
> > > >                                      ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:108: Invalid character in input.
> > > >                         select @s6 = '%headitem_name%'
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:108: Invalid character constant.
> > > >                         select @s6 = '%headitem_name%'
> > > >                                      ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:110: Invalid character in input.
> > > >                         declare @i6 int
> > > >                                 ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:111: Invalid character in input.
> > > >                         select @i6 = 1
> > > >                                ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:117: Invalid character in input.
> > > >                         String query2 ="values('" +@s6+"','"
> > > +headitem_name+
> > > > "','" +clasi_name1+ "','" +@s1+ "')";
> > > >                                                    ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:117: Invalid character in input.
> > > >                         String query2 ="values('" +@s6+"','"
> > > +headitem_name+
> > > > "','" +clasi_name1+ "','" +@s1+ "')";
> > > >
> > > > ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:120: Invalid character in input.
> > > >                         String query4 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name2+ "','" +@s2+ "')";
> > > >                                                    ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:120: Invalid character in input.
> > > >                         String query4 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name2+ "','" +@s2+ "')";
> > > >
> > > > ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:123: Invalid character in input.
> > > >                         String query6 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name3+ "','" +@s3+ "')";
> > > >                                                    ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:123: Invalid character in input.
> > > >                         String query6 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name3+ "','" +@s3+ "')";
> > > >
> > > > ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:126: Invalid character in input.
> > > >                         String query8 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name4+ "','" +@s4+ "')";
> > > >                                                    ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:126: Invalid character in input.
> > > >                         String query8 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name4+ "','" +@s4+ "')";
> > > >
> > > > ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:130: Invalid character in input.
> > > >                         String query10 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name5+ "','" +@s5+ "')";
> > > >                                                     ^
> > > >
> > >
> >
>
C:\tomcat_root\work\localhost_8080%2Fjspproj\_0002faddheaditem_0002ejspaddhe
> > > > aditem_jsp_0.java:130: Invalid character in input.
> > > >                         String query10 ="values('" +@s6+ "','"
> > > > +headitem_name+ "','" +clasi_name5+ "','" +@s5+ "')";
> > > >
> > > > ^
> > > > 31 errors
> > > >
> > > >         at
> > org.apache.jasper.compiler.Compiler.compile(Compiler.java:247)
> > > >         at
> > > org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:413)
> > > >         at
> > > >
> > >
> >
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
> > > > rvlet.java:149)
> > > >         at
> > > >
> > >
> >
>
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
> > > > va:161)
> > > >         at
> > > >
> org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
> > > >         at
> > > org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
> > > >         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > > >         at
> > > >
> > >
> >
>
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
> > > >         at
> > > >
org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
> > > >         at
> > > >
> > >
> >
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> > > > onnectionHandler.java:160)
> > > >         at
> > > >
> > >
> >
>
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
> > > > )
> > > >         at java.lang.Thread.run(Unknown Source)
> > > >
> > >
> > >
> >
>
===========================================================================
> > > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> > JSP-INTEREST".
> > > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> > DIGEST".
> > > Some relevant FAQs on JSP/Servlets can be found at:
> > >
> > >  http://java.sun.com/products/jsp/faq.html
> > >  http://www.esperanto.org.nz/jsp/jspfaq.html
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> > >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
> >
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to