JSP getparameter null

JSP getparameter null

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

View Answers

April 22, 2008 at 7:51 PM

Hi friend,

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

<script LANGUAGE="JavaScript">
<!-- Original: Mike Welagen ([email protected]) -->

<!-- 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
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
Advertisements
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
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><
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
getParameter() Method Of The Request Object
is retrieved in the JSP page by using the getParameter() method of the request... getParameter() Method Of The Request Object... you about the getParameter() method of the request object. This section provides
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
jsp
jsp  JSP that accepts a string parameter from the browser and simply...; 2)display.html: <script type="text/javascript"> function getParameter... results = regex.exec(window.location.href); if( results == null ) return
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 this..ADS_TO_REPLACE_1
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
Artifacts of null
List of Artifacts of null maven depenency
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
javascript null mean
javascript null mean  What does javascript null mean
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
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
ArrayList in JSP
ArrayList in JSP ArrayList is a class and a member of Java Collection Framework. It is the resizable-array and permit all element including the null... there are two file index .jsp and postIndex.jsp. The index.jsp fill take the user
disallow NULL values in a table.
disallow NULL values in a table.  How do I disallow NULL values in a table
array_merge null - PHP
array_merge null   i am using the array_merge and getting the unusual null error...any help
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
ModuleNotFoundError: No module named 'null'
ModuleNotFoundError: No module named 'null'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'null' How to remove the ModuleNotFoundError: No module named 'null' error
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
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
if variable is null php
if variable is null php  How to check if submitted variable is null in PHP? Thanks!   Check if Variable is NULL in PHP... if the variable is not defined or null in PHP. and after setting a variable
comparison with null - Framework
comparison with null  String value = txtfld.getText(); if (value == null) ----- failing step----control goes to else part { // some code... friend, if (value == null) works properly for comparision For any more
Null Pointer Exception
Null Pointer Exception  whis is the Null Pointer Exception in java? or define Null Pointer Exception with exp?   NullPointerException occurs, when you try to implement an application without referencing the object
Output of null value
main(String [] args){ String str=null; System.out.println(str); } } Output value Null Description:- In the given example... a String variable and initialized it with null value
Stumped with NOT NULL AUTO_INCREMENT
Stumped with NOT NULL AUTO_INCREMENT  I've almost made it through my... to create a new table with the ID column being NOT NULL AUTO_INCREMENT. The table will create if I do not have NOT NULL AUTO_INCREMENT, but it WILL NOT create
NULL POINTER EXCEPTION
NULL POINTER EXCEPTION    What is the Root cause for Class caste exception in struts frame work .and how 2 handle that 1 please help me
comparison with null - Framework
comparison with null  I am having one textfield, from which I am getting text using getText() method. Now I want to compare this value with null (i.e. to check whether the entered value is null or not) How should I check
array_merge null - PHP
array_merge null   i am using the array_merge and getting the unusual null error...any help?  Hi Friend, Please visit the following links: http://www.roseindia.net/tutorial/php/phpbasics/PHP-Array-Merge
Server_Gives_Null_Response
Server_Gives_Null_Response   I have one InternetServer.java which starts a server at port 10000. In same class i have started a server at different...) to client class it always sends null and it shows NULL value only when i stop
mysql query for null value
mysql query for null value   What mysql query for null value i need to write to display message when no data in database? Please help.Thanks!   if(mysql_num_rows($data2) > 0){ //while loop goes here } else
WRITE a simple JSP
WRITE a simple JSP  Write a JSP that accepts a string parameter from... getParameter(name){ name = name.replace(/[\[]/,"\\\[").replace...( regexS ); var results = regex.exec(window.location.href); if( results == null
Java null pointer exception
Java null pointer exception  Hi I've made an array of Book objects that I made, the array is called library and it can hold 100 books, but currently...]!=null){ if(strfield.contains(param)){ result+=library[counter
get a radio button click value - JSP-Servlet
have one probs that is i m getting a null value i m calling getParameter("id") in servlet that is used in another jsp so can i call getParameter("radio") i.e in the input tag name="radio" eventhough i m getting a null value please help me
The null keyword
The null keyword       The null keyword in java programming language is a reserved word that is used... how to declare and define null values in java programming language.ADS
NUll POINTER EXCEPTION
NUll POINTER EXCEPTION  public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException... of code i m getting null pointer Exception. can some one please explain what
Mysql Alter Allow Null
Mysql Alter Allow Null       Mysql Alter Allow Null is used to change the Null Type of a column in a table.The Allow Null allows the null type characteristics in a column

Ads