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



Home Answers Viewqa Development-process JSP getparameter null
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


uma
JSP getparameter null
3 Answer(s)      6 years and 9 months ago
Posted in : Development process


How to get the parameter in JSP even if it is null?


Advertisement
View Answers

April 22, 2008 at 7:51 PM


Hi friend,

<html>
<title>Date validation</title>
<head>

<script LANGUAGE="JavaScript">
<!-- Original: Mike Welagen (welagenm@hotmail.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("That date is invalid. Please try again.");
datefield.focus();
return false;
}
else {
return true;
}
}
function chkdate(objName) {
var strDatestyle = "INDIA"; //United States date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
}
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
}
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
}
}
if (isNaN(intMonth)) {
err = 3;
return false;
}
}
---------------


April 22, 2008 at 7:51 PM


intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
}
else {
datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
function doDateCheck(from, to) {
if (Date.parse(from.value) <= Date.parse(to.value)) {
alert("The dates are valid.");
}
else {
if (from.value == "" || to.value == "")
alert("Both dates must be entered.");
else
alert("To date must occur after the from date.");
}
}
// End -->
</script>
</HEAD>
-----------------


April 22, 2008 at 8:03 PM



<body>
<form>

<b>Start Date:</b><input type=text name=from onBlur="checkdate(this)" size=20 maxlength=11>
<br/>
<b>End Date:&nbsp&nbsp</b><input type=text name=to onBlur="checkdate(this)" size=20 maxlength=11>

<input type=button name=formatbutton onClick="doDateCheck(this.form.from, this.form.to);" value="Check">

</form>
</body>
</html>


Related Tutorials/Questions & Answers:
html-jsp - getparameter() - JSP-Servlet
html-jsp - getparameter()  Hi! friedns, This is my front end and I want to retrieve username and password in two different jsp pages. I used getParameter() with two form action as shown below. But I am not getting
getparameter
or returns null if they don't. Here we are discussing its use in a JSP...getParameter() method of the Request Object gets value of the HTML form fields. These fields are linked with the form of a HTTP request. getParameter
Advertisements
Need alternative for getParameter() method - JSP-Servlet
Need alternative for getParameter() method  Hi Expert, I would like to know if if any other way to fetch the vaule from text box withour using getParameter() method. Kindly requesting you to let me know it, If any way
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
Getting Null pointer Exception in the jsp page
Getting Null pointer Exception in the jsp page  I have developed this jsp page to store the data in database.While storing the value of check box in database I am getting null pointer exception in the following code
null pointer exception in jsp
null pointer exception in jsp  index.html <html> <body> <table align=center> <form action="Login.jsp" method="get"> <tr> <td colspan=2><h1>Student Login</h1></td><
getParameter() Method Of The Request Object
getParameter() Method Of The Request Object... you about the getParameter() method of the request object. This section provides you the best illustration for why the method used or how to use in your JSP
Null pointer exception error in Jsp - JSP-Servlet
Null pointer exception error in Jsp  Hi i write a login page. when i... cause java.lang.NullPointerException org.apache.jsp.validateLogin_jsp..." attributes in the input tag So id,userpwd gives null pointer exception
<%=request.getHeader("referer")%>,getting null in jsp - JSP-Servlet
,getting null in jsp  Hi, I am getting null in in jsp.Could you help on this regards. Thanks Ajay   Hi friend, Code to help in solving the problem : Thanks
Null pointer exception error in Jsp - JSP-Servlet
Null pointer exception error in Jsp  Expert:Majid Hi i write a login... cause java.lang.NullPointerException org.apache.jsp.validateLogin_jsp..." attributes in the input tag So id,userpwd gives null pointer exception. Thanks
method returning null on JSP page.Plz HELP!!!
method returning null on JSP page.Plz HELP!!!  public String... sAddress = null; if(sPort>=0) { sAddress...); return sAddress; } When I am calling this method on the jsp page
method returning null on JSP page.Plz HELP!!!
method returning null on JSP page.Plz HELP!!!  public String... on the jsp page it is returning null while the parameter values are successfully... sAddress = null; if(sPort>=0) { sAddress
Passing java variables from JSP to Servlet - return null values
Passing java variables from JSP to Servlet - return null values  I want to pass some variables from a JSP page to a servlet. These variables are from... from JSP to servlet gives null values. I got msg=null. Is there another way
null pointer
null pointer  dear sir , what is mean by null pointer in c
java.lang.NumberFormatException: null
java.lang.NumberFormatException: null   I get org.apache.jasper.JasperException: java.lang.NumberFormatException: null exception when i submit the form plz help me regarding
null interface
null interface   what is the null interface and what is the use of it in real java project ?   Hi Friend, A null interface is an interface without any methods.Is also known as Marker interface. Null interfaces are used
javascript null mean
javascript null mean  What does javascript null mean
Null pointer execption
Null pointer execption  what is null pointer exception. I am getting the null pointer exception in this line conn= com.mypay.dao.Connection.getConnection(); what is wrong
Null pointer execption
Null pointer execption  what is null pointer exception. I am getting the null pointer exception in this line conn= com.mypay.dao.Connection.getConnection(); what is wrong
null pointer exception in java
null pointer exception in java  What is null pointer exception in Java and when it occurs? Show it with an example.Thanks!   Java Null Pointer Exception
check null exception java
check null exception java  check null exception java - How to check the null exception on Java?   The null pointer exception in java occurs when we call or perform some action on the object or value when it null
array_merge null - PHP
array_merge null   i am using the array_merge and getting the unusual null error...any help
disallow NULL values in a table.
disallow NULL values in a table.  How do I disallow NULL values in a table
database connectivity in jsp form
. This application can be used by any jsp web project.  syntax of getParameter:- <...database connectivity in jsp form We are going to create jsp registration form...;will be stored in he database. We use method getParameter() that return the value
What is NOT NULL Constraint?
What is NOT NULL Constraint?  What is NOT NULL Constraint?   Hi, The NOT NULL constraint enforces a column to NOT accept NULL values.The NOT NULL constraint enforces a field to always contain a value. This means
ajax+options is null or not an Object
ajax+options is null or not an Object  HI i have developed a simple... is null or not an Obejct.. here im sending my code select.jsp <%@page..."); } if (xmlHttp==null){ alert("Browser does not support XMLHTTP Request
org.apache.jasper.JasperException: java.lang.NumberFormatException: null
jsp page where all the details will be inserted in to the Oracle database...: null" exception. Also "The server encountered an internal error... con=null; int mobile=Integer.parseInt(request.getParameter("mobile
Httpservletresponse null pointer exception.
Httpservletresponse null pointer exception.  What is Httpservletresponse null pointer exception?   NullPointerException occurs when we try to implement an application without referencing the object and allocating
Advertisements
 

 

 

DMCA.com