Home Answers Viewqa Development-process JSP getparameter null

 
 


uma
JSP getparameter null
3 Answer(s)      5 years and a month ago
Posted in : Development process

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 (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 Pages:
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() 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
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
<%=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
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
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
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
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
jsp
jsp  JSP that accepts a string parameter from the browser and simply...: <script type="text/javascript"> function getParameter(name){ name... = regex.exec(window.location.href); if( results == null ) return ""; else return
request.getParameter
the request.getParameter. This section will describe you about the getParameter method of request object. getParameter() method is used to get the parameter values associated... if the requested parameter is exist or returns null if the requested parameter
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
getting null value in action from ajax call
getting null value in action from ajax call  Getting null value from...;s:if test="branchList != null"> <tr><td><s:select name...;</s:if> <s:if test="semList != null"> <tr><td><s
getting null value in action from ajax call
getting null value in action from ajax call  Getting null value from...;s:if test="branchList != null"> <tr><td><s:select name...;</s:if> <s:if test="semList != null"> <tr><td><s
getting null value in action from ajax call
getting null value in action from ajax call  Getting null value from...;s:if test="branchList != null"> <tr><td><s:select name...;</s:if> <s:if test="semList != null"> <tr><td><s
Handle Null Pointer Exception while text file upload
Handle Null Pointer Exception while text file upload  I want the code for handling null pointer exception in jsp page. That is I need an error page for null pointer exception. The cause for null pointer exception is while
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
WRITE a simple JSP
WRITE a simple JSP  Write a JSP that accepts a string parameter from...; 2)display.html: <script type="text/javascript"> function getParameter... results = regex.exec(window.location.href); if( results == null ) return
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
Why the null values are stored in Database when I am sending proper values?
Why the null values are stored in Database when I am sending proper values...; the imagepath into the Database (MySQL) from the JSP. Along with the ImagePath... but the other details are not stored in the Database. Instead of other values, there null
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
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
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
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
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 You can use isset($var) to check if the variable is not defined or null in PHP. and after setting
jsp
jsp  Hi How can we display sqlException in a jsp page? How can we mantain session in jsp? Thanks Kalins Naik   JSP SQL Exception <... connection = null; Class.forName("com.mysql.jdbc.Driver").newInstance
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
java.lang.NullPointerException - JSP-Servlet
;... ... ... ... function myFunc3() { var n='' if(n!=null...);"); stmt.setString(1,request.getParameter("tt")); stmt.setInt... e) { out.println(e); } =======OUtPUT IS =========== null
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
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
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 value when a radio button clicked - JSP-Servlet
is that 1st i m callig a jsp in that i m displaying a table where i used a radio button to access a value(also used u r code),then in this jsp i m having a forms... a values from getParameter("id"), so if i call getParameter("id") it will giving
JSP
JSP   how to open and view a flat file in browser using java code in jsp?   Hi Friend, If you want to simply open a file then try... InputStreamReader(in)); String str; while ((str = br.readLine()) != null
JSP
in the JSP page and display the results back to the same JSP page. Thanks... the ajax send the parameter to another jsp page. That JSP page retrieves the record...=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send(null) } function

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.