View Full Version : need a little bit of help :)

01-07-2012, 06:55 PM
hey guys

m new here for my project as we have chosen to build a website using eclipse and derby database and m trying to run it in apache 6.0.35 and i am facing some small problems like the control is not passing through the if statement it directly gives the alert and i needed a little bit of help in figuring out what i am doing

this is my code i am trying 2 create

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"%>

<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<sql:setDataSource dataSource="jdbc/SampleDB" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Registration Page</title>
form {
width: 400px;

label {
float: left;
width: 120px;

input[type=text] {
float: left;
width: 250px;

.clear {
clear: both;
height: 0;
line-height: 0;

.floatright {
float: right;

body {
background: red;
<script type="text/javascript">
function error() {
alert("Please provide all details!");
<script type="text/javascript">
function reset() {
alert("Details have Been Reset!");

<h1>Registration Page</h1>

<div style="position: absolute; top: 200px; right: 500px;">


<b> <label for="Name">Name:</label> <input
type="text" name="name" /><br /> <br /> <label
for="Address">Address:</label> <input type="text"
name="addr" /><br /> <br /> <br /> <label for="Contact Person">Contact
Person:</label> <input type="text" name="coperson" /><br /> <br /> <label
for="Contact Number">Contact Number:</label> <input type="text"
name="conumber" /><br /> <br /> <label for="Email-Id">Email-Id:</label>

<input type="text" name="email" /><br />

</b> <br /> <br /> <br /> <input type="submit" name="action"
value="Submit" /><input type="Reset" onclick="reset()" /><br />

<c:set var="coname" value="${param.name}" />
<c:set var="coaddr" value="${param.addr}" />
<c:set var="coperson" value="${param.coperson}" />
<c:set var="conumber" value="${param.conumber}" />
<c:set var="email" value="${param.email}" />

<c:if test="${param.action == 'Submit'}">
test="${not empty name and not empty addr and not empty coperson and not empty conumber and not empty email}">
INSERT INTO app1.posts(Name,Address,ContactPerson,ContactNumber,EmailID) VALUES(?,?,?,?,?)
<sql: param value="${name}" />
<sql: param value="${addr}" />
<sql: param value="${coperson}" />
<sql: param value="${conumber}" />
<sql: param value="${email}" />
<c:set var="msg" value="Thank you. Details saved. " />
<c:set var="name" value="" />
<c:set var="addr" value="" />
<c:set var="coperson" value="" />
<c:set var="conumber" value="" />
<c:set var="email" value="" />
<c: otherwise>
alert("Please provide all details.!");
</c: otherwise>

and this is the table i have created in derby database

CREATE TABLE app1.posts(
name varchar(45),
address varchar(75),
contactperson varchar(40),
contactnumber varchar(15),
emailid varchar(35)

i was referring to this link on how to create a database application


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum