This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in data insert using bean

 
pravin badiyavadra
Greenhorn
Posts: 13
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hallo friends

i have following JSP code for storing fields in database using bean


<%@ page language="java" import="java.sql.*,java.lang.*,beans.InsertBean"%>


<%!

static int temp;

public String keyGenerator()
{
String key="A";
temp++;
key = key + temp;
return(key);


}
%>


<%!

public String statusCheck(String status)
{


String b = "ON";
String a;

if(b.equals(status))
{
a="TRUE";

return a;
}
else
{
a="FALSE";
return a;
}



}



%>




<%

String title = request.getParameter("cmbTitle");
String fname = request.getParameter("txtFname");
String lname = request.getParameter("txtLname");
String add = request.getParameter("txtAdd");
String city = request.getParameter("txtCity");
String state = request.getParameter("txtState");
String country = request.getParameter("cmbCountry");
String phone = request.getParameter("txtPhone");
String mobile = request.getParameter("txtMobile");
String fax = request.getParameter("txtFax");
String status = request.getParameter("chkHide");

%>

<%



String key = keyGenerator();
String b;
b=statusCheck(status);

session.setAttribute("artist_id",key);
%>

<%

String temp = "'"+key+"'"+","+
"'"+fname+"'"+","+
"'"+lname+"'"+","+
"'"+add+"'"+","+
"'"+city+"'"+","+
"'"+state+"'"+","+
"'"+country+"'"+","+
"'"+phone+"'"+","+
"'"+mobile+"'"+","+
"'"+fax+"'"+","+
"'"+title+"'"+","+
"'"+b+"'";


String fin = "insert into a_personal values(" + temp + ")";

%>



<jsp:useBean id="test" class="beans.InsertBean">

<jsp:setProperty name="test" property="query" value="<%=fin%>"/>

</jsp:useBean>


but it gives following error
type Exception report

message

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

exception

org.apache.jasper.JasperException: Exception in JSP: /gallery/regPersonal.jsp:106

103:
104: <jsp:useBean id="test" class="beans.InsertBean">
105:
106: <jsp:setProperty name="test" property="query" value="<%=fin%>"/>
107:
108: </jsp:useBean>
109:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

org.apache.jasper.JasperException
org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(JspRuntimeLibrary.java:665)
org.apache.jsp.gallery.regPersonal_jsp._jspService(org.apache.jsp.gallery.regPersonal_jsp:165)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.reflect.InvocationTargetException
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
org.apache.jasper.runtime.JspRuntimeLibrary.handleSetProperty(JspRuntimeLibrary.java:663)
org.apache.jsp.gallery.regPersonal_jsp._jspService(org.apache.jsp.gallery.regPersonal_jsp:165)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.14 logs.




same code is working on other JSP pages

plese anybody can find out what is wrong??

thanks in advance



--------------------------------------------------------------------------------
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with applets, so I'm moving it to the JSP forum.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic