wood burning stoves 2.0*
The moose likes JSP and the fly likes problem in data insert using bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "problem in data insert using bean" Watch "problem in data insert using bean" New topic
Author

problem in data insert using bean

pravin badiyavadra
Greenhorn

Joined: Mar 23, 2006
Posts: 13
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



--------------------------------------------------------------------------------


pravin
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
This has nothing to do with applets, so I'm moving it to the JSP forum.


Ping & DNS - my free Android networking tools app
 
Don't get me started about those stupid light bulbs.
 
subject: problem in data insert using bean
 
Similar Threads
Struts validation problem
Getting exception on deployment to Tomcat using JSF
IntegratedParserConfiguration classcast exception
HTTP Status 500 - error running servlet with JSP
tag libs