Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet multivalued attribute

Have Programming Question? Ask it here!
 
 
 


maithri
multivalued attribute
1 Answer(s)      3 years and 2 months ago
Posted in : JSP-Servlet


I have a author as multivalued attribute and i have inserted values for it in database but now how to insert values in the database through form .I have written query as shown below and iam getting error .

String query4="INSERT INTO author_det(accno,isbn,author) VALUES ('"+accno+"','"+isbn+"','"+author+"')"; stmt.executeUpdate(query4);


Advertisement
View Answers

March 4, 2011 at 12:37 PM


Jsp insert data into database

1)form.jsp:

<html>
<form method="post" action="insertdata.jsp">
<table>
<tr><td>Enter Acc No:</td><td><input type="text" name="accno"></td></tr>
<tr><td>Enter ISBN:</td><td><input type="text" name="isbn"></td></tr>
<tr><td>Enter Author:</td><td><input type="text" name="author"></td></tr>
<tr><td></td><td><input type="submit" value="submit"></td></tr>
</table>
</form>
</html>

2)insertdata.jsp:

<%@page import="java.sql.*,java.util.*"%>
<%
int ano=Integer.parseInt(request.getParameter("accno"));
int isbn=Integer.parseInt(request.getParameter("isbn"));
String name=request.getParameter("author");
ArrayList list=new ArrayList();
        try{
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
        Statement st=con.createStatement();
        int i=st.executeUpdate("insert into author_det(accno, isbn,author) values("+ano+","+isbn+",'"+name+"')");
        con.close();
        out.println("Data is successfully inserted into database.");
        }
        catch(Exception e){
        System.out.println(e);
        }
        %>

3)table author_det:

CREATE TABLE `author_det` (                              
              `id` bigint(255) NOT NULL auto_increment,              
              `accno` int(255) default NULL,                         
              `isbn` int(255) default NULL,                          
              `author` varchar(255) default NULL,                    
              PRIMARY KEY  (`id`)                                    
            );


Related Tutorials/Questions & Answers:
multivalued attribute
multivalued attribute  I have a author as multivalued attribute and i have inserted values for it in database but now how to insert values in the database through form .I have written query as shown below and iam getting error
multivalued attribute?
multivalued attribute?  I have a problem in editing the database through form because of multivalued attribute it is creating the error and also how to write code for displaying the data when there is multivalued attribute
Advertisements
multivalued attribute?
multivalued attribute?  I have a problem in editing the database through form because of multivalued attribute it is creating the error and also how to write code for displaying the data when there is multivalued attribute
jsf attribute
jsf attribute  What is the different between value and binding attribute of jsf
MySQL Attribute
MySQL Attribute This example illustrates how to use the COLLATE attribute in MySQL. In this example we use the COLLATE attribute to define the attribute... and collation for the column. Query CREATE TABLE atttribute (attribute_name CHAR
Quotes around attribute values.
Quotes around attribute values.  Should I put quotes around attribute values
Language Attribute In Page Directive
Language Attribute In Page Directive  How use language attribute in page directive
What is attribute oriented programming?
What is attribute oriented programming?  Hi, What is attribute oriented programming? Thanks
Use of immediate attribute
Use of immediate attribute  What is the use of immediate attribute
JSF Rendered Attribute
JSF Rendered Attribute  i need the example for jsf with rendered attribute
Language Attribute In Page Directive
Language Attribute In Page Directive  How use language attribute in page directive ?   This attribute is used to denote the language used... of language attribute for page directive is : <%@ page language = "lang" %> <
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute of jsf tag
value and binding attribute
value and binding attribute  What is the difference between value and binding attribute in jsf
JavaScript Defer Attribute
JavaScript Defer Attribute  defer attribute in javascript   Hi Friend, The defer attribute gives a hint to the browser that the script does not create any content so the browser can optionally defer interpreting
contentType attribute in the page directive
contentType attribute in the page directive  How use contentType attribute in the page directive ?   contentType attribute is used to set the mime type and character set of the JSP. The user can make use of any MIME
Import attribute of page directive
Import attribute of page directive   How use import attribute of page directive ?   The import attribute is used to import all the classes in a java package into the current JSP page. If there are many Java packages
errorPage attribute in the page directive
errorPage attribute in the page directive  How use errorPage attribute in the page directive ?   If the programmer wants to place errors... in this attribute as errorPage. Syntax : <%@ page errorPage="relativeURL" %>  
Buffer attribute in the page directive
Buffer attribute in the page directive  How use buffer attribute in the page directive?   The buffer size in kilobytes used by the out object to handle output sent from the compiled JSP page to the client Web browser
AutoFlush attribute in the page directive
AutoFlush attribute in the page directive  How use autoFlush attribute in the page directive?   Whether the buffered output should be flushed automatically when the buffer is full. If set to true (the default value
Extends Attribute of page Directive
Extends Attribute of page Directive   How use language extends in page directive ?   This is used to signify the fully qualified name of the Super class of the Java class used by the JSP engine for the translated
isThreadSafe attribute in the page directive
isThreadSafe attribute in the page directive  How use autoFlush attribute in the page directive?   autoFlush means it will not clear. it send to the desitation.   Whether thread safety is implemented
isErrorPage attribute in the page directive
isErrorPage attribute in the page directive  How use isErrorPage attribute in the page directive ?   isErrorPage attribute is used... attribute is used to specify whether or not a JSP page displays an error page
retrieve multiple attribute values
retrieve multiple attribute values  Hello All Am a beginner. Would like some help with this. The following is part of my XML file: <process... like is to retrieve both the attribute values of process:Output during execution
retrieve multiple attribute values
retrieve multiple attribute values  Hello All Am a beginner. Would like some help with this. The following is part of my XML file: <process... like is to retrieve both the attribute values of process:Output during execution
retrieve multiple attribute values
XML retrieve multiple attribute values  Hello All Am a beginner. Would like some help with this. The following is part of my XML file: <...; What I would like is to retrieve both the attribute values of process
Page Directive attribute - language
Page Directive attribute - language This section contains description of language attribute of page Directive. language Attribute : The language attribute is one of attribute of page directive. Its functionality to specify
attribute in action tag - Java Beginners
attribute in action tag  I'm just a beginner to struts. The name tag(name="bookListForm") is used to define the form used with the action class. But i`m not clear about the attribute tag(attribute
Page Directive attribute - isThreadSafe
Page Directive attribute - isThreadSafe This tutorial  contains description of isThreadSafe attribute of page Directive. isThreadSafe Attribute : isThreadSafe attribute is one of attribute of page directives. It is used
Page Directive attribute - pageEncoding
Page Directive attribute - pageEncoding This tutorial contains description of pageEncoding attribute of page Directive. pageEncoding Attribute : Page directive provides pageEncoding attribute to specify the language that the page uses
<html:option > with "selected" attribute - Struts
with "selected" attribute  how to display formbean object with "selected" attribute in . please help me
Page Directive attribute - extends
Page Directive attribute - extends This tutorial  contains description of extends attribute of page Directive. extends Attribute : This attribute specifies the super class of the JSP page's implementation servlet. It allows
Page Directive attribute - buffer
Page Directive attribute - buffer This section contains description of buffer attribute of page Directive. buffer Attribute : This attribute is used for specifying the buffer size for the output stream. Buffer size is specified
Page Directive attribute - autoFlush
Page Directive attribute - autoFlush This section contains description of autoFlush attribute of page Directive. autoFlush Attribute : The autoFlush Attribute: This attribute is used to control the nature of the servlet output
The info Attribute of page Directive In JSP
The info Attribute of page Directive In JSP  ... about the info attribute of the page directive in JSP. This attribute simply... Servlet.getServletInfo() method. The value of the attribute will be a text string. Here
HTML5 target attribute, Definition and use of target attribute.
HTML5 target attribute, Definition and use of target attribute. In this tutorial we will inform about the target attribute of <area> tag in html5. This attribute is used for specifying the name of  the window or frame where
Page Directive attribute - info
Page Directive attribute - info This tutorial  contains description of info attribute of page Directive. info Attribute : info attribute of page... of the attribute will be a text String. This feature is useful where a huge number of server
Page Directive attribute - isErrorPage
Page Directive attribute - isErrorPage This tutorial  contains description of isErrorPage attribute of page Directive. isErrorPage Attribute : This attribute of page directives sets the boolean value either true or false
Page Directive attribute - isELIgnored
Page Directive attribute - isELIgnored This tutorial contains description of isELIgnored attribute of page Directive. isELIgnored Attribute : page directive provides isELIgnored attribute which is of boolean type. This attribute
Page Directive attribute - import
Page Directive attribute - import This tutorial  contains description of import attribute of page Directive. import  Attribute : This attribute of page directive imports single package and classes or list of packages
Page Directive attribute - errorPage
Page Directive attribute - errorPage This tutorial  contains description of errorPage attribute of page Directive. errorPage Attribute : Functionality of errorPage attribute is to define the error page. If there is exception
Page Directive attribute - session
Page Directive attribute - session This tutorial contains description of session attribute of page Directive. session Attribute : session attribute is one of attribute of page directives. Its functionality to show whether or not page
Page Directive attribute - contentType
Page Directive attribute - contentType This section contains description of contentType attribute of page Directive. contentType Attribute : The contentType attribute defines the MIME type for the response an defines the character
Retrieving attribute value from XML
Retrieving attribute value from XML  I have an XML as below to parse...; ..... But am not able to fetch the value of LoadTicketId attribute. My code... was able to find the error. I was treating attribute as an element. No more response
JDOM Attribute Example, Different method of Attribute class.
JDOM Attribute Example, Different method of Attribute class...(). These methods are present in the Attribute class. The Attribute class is available... getParent() method of Attribute class returns parent of the associated attribute
Table & the Border attribute
Table & the Border attribute   ... and the Border attribute. In this Tutorial, the code explains to create a table and the border with a specified attribute. Understand with Example To create a table in HTML
Why binding attribute is required in jsf frame work
Why binding attribute is required in jsf frame work  Why binding attribute is required in jsf frame work. And what use of binding attribute
HTML Action attribute - Java Beginners
In action Attribute I want to give emp_event.java class. But When I run I am
HTML5 type attribute, Definition of type attribute in <area> tag.
HTML5 type attribute, Definition of type attribute in <area> tag. This tutorial will inform you about <area>tag type attribute. The type attribute is used for defining the MIME (Multipurpose Internet Mail Extensions) type
The "contentType" Attribute of Page Directive
The "contentType" Attribute of Page Directive In this Section, we will discuss about the "contentType" attribute of page directive with an example. The "contentType" attribute is used for setting the '
<applet> tag requires code attribute.
applet tag requires code attribute.  import java.applet.*; import java.awt.*; import java.awt.image.*; /*<applet code=Lavatron.class width=590 height=130> <param name="img" value
 

 

 

DMCA.com