Home Discussion Discuss: Introduction to the JSP Java Server Pages

  • Duplicates on a JSP webpageHi Sheeyla Marrero April 18, 2011 at 9:42 PM

    Hi There.. I am building a JSP web application in which I need to write data into MySQL database, but I need a code to check if data entered has not been entered before, to avoid duplicates.... This is what I have so far, but it is not working, it is writing data into the database even when I am intentionally using data already in the database.... <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <html> <head><title>Create Data</title></head> <body bgcolor=#F5F5F5> <%-- <jsp:useBean id="beanInstanceName" scope="session" class="beanPackage.BeanClassName"/> --%> <%-- <jsp:getProperty name="beanInstanceName" property="propertyName"/> --%> <%@page import="java.sql.*"%> <% String REF=request.getParameter("d_ref"); String DATE=request.getParameter("i_date"); String UBC=request.getParameter("i_ubc"); %> <% try { //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Connection connection=DriverManager.getConnection("jdbc:odbc:db1","",""); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection=DriverManager.getConnection("jdbc:mysql://localhost/labacacias?user=root&password=letmein"); Statement statement=connection.createStatement(); String query; query="SELECT referencia FROM enero"; boolean b=false; ResultSet resultSet=statement.executeQuery(query); while (resultSet.next()) { if (REF.compareTo(resultSet.getString(1))==0) { b=true; } if (b) { out.println("Datos ya han sido adjuntados anteriormente!"); out.println("<a href=\"EneroU.jsp\">Click Aqui para Adjuntar nuevos Resultados</a>"); } else { pageContext.forward("InsertE.jsp"); } } } catch (Exception e) { //e.printStackTrace(); out.println(e.toString()); } %> </body> </html> Could you please help????

  • Duplicates on a JSP webpageHi Sheeyla Marrero April 18, 2011 at 9:42 PM

    Hi There.. I am building a JSP web application in which I need to write data into MySQL database, but I need a code to check if data entered has not been entered before, to avoid duplicates.... This is what I have so far, but it is not working, it is writing data into the database even when I am intentionally using data already in the database.... <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <html> <head><title>Create Data</title></head> <body bgcolor=#F5F5F5> <%-- <jsp:useBean id="beanInstanceName" scope="session" class="beanPackage.BeanClassName"/> --%> <%-- <jsp:getProperty name="beanInstanceName" property="propertyName"/> --%> <%@page import="java.sql.*"%> <% String REF=request.getParameter("d_ref"); String DATE=request.getParameter("i_date"); String UBC=request.getParameter("i_ubc"); %> <% try { //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //Connection connection=DriverManager.getConnection("jdbc:odbc:db1","",""); Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection connection=DriverManager.getConnection("jdbc:mysql://localhost/labacacias?user=root&password=letmein"); Statement statement=connection.createStatement(); String query; query="SELECT referencia FROM enero"; boolean b=false; ResultSet resultSet=statement.executeQuery(query); while (resultSet.next()) { if (REF.compareTo(resultSet.getString(1))==0) { b=true; } if (b) { out.println("Datos ya han sido adjuntados anteriormente!"); out.println("<a href=\"EneroU.jsp\">Click Aqui para Adjuntar nuevos Resultados</a>"); } else { pageContext.forward("InsertE.jsp"); } } } catch (Exception e) { //e.printStackTrace(); out.println(e.toString()); } %> </body> </html> Could you please help????

  • studentkarthik June 16, 2011 at 3:17 PM

    no comments

  • JavaAnseri November 11, 2012 at 9:10 PM

    this service is good.

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Java Server Faces Questions

java server pages - Java Server Faces Questions
java server pages  code for jsp login page if user forgot password reminding password with hint question.the table login is created in database  Hi Friend, Try the following code: 1)email.jsp: Enter Email 

Core Java

Java Server Pages(JSP)
Java Server Pages(JSP)       JavaServer Pages (JSP) technology provides... and platform-independent. The JavaServer Pages specification extends the Java Servlet API 

General

Introduction to the JSP Java Server Pages
source code. Introduction to JSP Java Server Pages or JSP... applications.   JSP Tutorials - Introducing Java Server Pages... JSP termed as Java Server Pages is a technology introduced by Sun 

JSP-Tutorials

JSP - Java Server Pages
JSP JSP stands for Java Server Pages. JSP is Java technologies for creating dynamic web applications. JSP allows the developer to embed Java code inside HTML. It makes the development of dynamic web application very easy in Java 

JSP Tutorials

Java Server Pages (JSP)
Java Server Pages (JSP) In this tutorial we are going to give you over view of JSP. What is JSP ? JSP is java based technology by using that you can... Dynamic Elements in HTML Pages itself. JSP are always compiled before it's 

Java Beginners

java pages run
java pages run  how do we run jsp file in the browser. do we need... Tomcat Server to run the jsp code over it. Follow these steps to run the simple... a jsp file:'hello.jsp' <%@page language="java"%> <%String st="Hello 

JSP Tutorials

Tutorials - Java Server Pages Technology
Tutorials - Java Server Pages Technology   ... server-side Java a very exciting area. JavaServer Pages - An Overview... web servers, and its underlying server components. That is, JSP pages 

JSP-Tutorials

JavaServer Pages (JSP) Roseindia
JavaServer Pages (JSP) is used to develop dynamic web content on the server using HTML, XML templates, and Java code. JSP is extensively used because... pages that get compiled into Java servlets the first time they are invoked. JSP 

JSP Servlet Questions

why jsp pages are not working on linux but java application is working in windows - JSP-Servlet
why jsp pages are not working on linux but java application is working in windows  java web application jsp pages are not showing the fileds corectly on linux server but same application is working on windows.why 

Java Beginners

Iterating through pages
with a sample java/ jsp code or technical details of how to iterate through the pages...". And the next 100 records will get displayed in the page2. The pages go on wrt 

JSP Interview Questions

jsp pages
jsp pages  I am using 3 jsp pages in an application.. 1.login.jsp 2.checkuser.jsp:is connected to databse..from this page im giving path to search.jsp 3.search.jsp:Here we need fetch data from data base..do u want to connect 

JSP Servlet Questions

server side scripting java - JSP-Servlet
server side scripting java  I Very new to java server pages I am doing a project in java messaging service so in that i have a client on d server... on the server side i want that in the client side as pop up window 

Blog

What is JSP?
types of documents to server the web client. The JSP technology allows the programmers to embed Java code into html (.jsp) page. Java Server Pages are first...The JSP  Java Server Pages Technology: Java Server Pages is a technology 

JSP Tutorials

JSP Tutorials
articles given belows: Java Server Pages Technology JSP Architecture JSP...JSP Tutorials JavaServer Pages (JSP) is a server-side programming technology... for creating the UI for web applications easily. JSP pages are first compiled into Java 

Core Java

Web Server
pages to the client. Apache and Microsoft's Internet Information Server (IIS) are two leading web servers. In the case of java language, a web server is used to support Servlet and JSP web components. A web server does not provide support 

General

JSP Error Pages
JSP Error Pages      .... To know more about JSP error pages click on the link:   http... a server's default exception page. Even though most of the  well-designed 

JSP Interview Questions

JSP
JSP   What is JSP?   JavaServer Pages (JSP) is a server... document types.   Hi, Here is the answer. JavaServer Pages (JSP) is a server-side Java technology an extension to the Java servlet technology 

JSP Tutorials

JSP Tutorials
: Introduction to JSP Java Server Pages or JSP for short is Sun's solution... with working source code. JSP stands for Java Server Pages and is a technology...; JSP Tutorials - Introducing Java Server Pages Technology 

Web Services

Introduction to the Tomcat web server
Introduction to the Tomcat web server   ... Reference Implementation for the Java Servlet and JavaServer Pages technologies. The Java Servlet and JavaServer Pages specifications are developed by Sun under 

HTML Questions

using session variable determine the no of pages viewd by the user
/java/jsp/trackuserSession.html Thanks...using session variable determine the no of pages viewd by the user  using session variable determine the no of pages viewd by the user   Hi 

JSP Tutorials

Introduction to JSP
; Developing first JSP Java Server Pages... as a small stand-alone server for testing servlets and JSP pages before... for testing servlets and JSP pages, or can be integrated into the Apache Web server 

Eclipse Plugins

EasyEclipse Server Java
EasyEclipse Server Java       EasyEclipse Server Java For development of server-side Java applications, such as JavaServer Pages, EJBs and Web Services. EasyEclipse 

Struts Questions

JSP pages are provided in Struts framework?
JSP pages are provided in Struts framework?  What helpers in the form of JSP pages are provided in Struts framework 

Struts Questions

JSP pages are provided in Struts framework
JSP pages are provided in Struts framework  What helpers in the form of JSP pages are provided in Struts framework 

Training

JSP Training
JSP Training     Java Server Pages... Model 1 architecture Model 2 architecture Java Server Pages The Role... of the JSP lifecycle, JSP syntax and architecture, fundamentals of using the latest Java 

JSP Servlet Questions

JSP
JSP  Hi, What is JSP? What is the use of JSP? Thanks   Hi, JSP Stands for Java Server Pages. It is Java technology for developing web applications. JSP is very easy to learn and it allows the developers to use Java 

Servlets

Web Server
Web Server Introduction      ... e-mail and building and publishing web pages. A web server works on a client... program. While talking about Java language then a web server is a server 

Training

Description of GlassFish Application Server
the latest versions of technologies such as JavaServer Pages (JSP) 2.1... Description of GlassFish Application Server     GlassFish is a free, open source application server 

Java Server Faces Questions

jsf - Java Server Faces Questions
jsf  Hi, In my project there are 3 jsp pages and one jsf page ,first jsp page forwarding the request to jsf page then this jsf gives the greeting... page.The problem is in success jsp i wrote only "success" now i need this success 

Applet Questions

linking of pages in java
a register page how can i do this in java (applet ie frames)i made to pages one for login and other for register pls rply   Java linking two pages...linking of pages in java  i made a login form accountno: password 

DMCA.com