473,385 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to retrieve a parameter?

I have the following function in a html file:

function selectEdit(fileID, processCode, processID, fileName,fileDesc)
{
document.forms[0].recordID.value = fileID;
document.forms[0].processor.value = processCode; `
document.forms[0].processorID.value = processID;
document.forms[0].interfaceFileName.value = fileName;
document.forms[0].fileNameDesc.value=fileDesc;
document.forms[0].submit();
}
The function is called by many buttons in the same form.
Each button is supposed to be redirecting to different html pages
based on the parameter "document.forms[0].recordID.value" i have
directed the form action to a jsp page to handle the redirection but i
cannot get the parameter using jsp. Can i retrieve the
"document.forms[0].recordID.value" if so how?
Do i use javascript to retrieve? I tried using
request.getParameter("recordID")in my jsp but i get a null pointer
exception.
Am i retrieving the value corrrectly?

Thanks
Jul 23 '05 #1
1 4075
In article <59**************************@posting.google.com >, scout3014
@gmail.com enlightened us with...
I have the following function in a html file:

function selectEdit(fileID, processCode, processID, fileName,fileDesc)
{
document.forms[0].recordID.value = fileID;
document.forms[0].processor.value = processCode; `
document.forms[0].processorID.value = processID;
document.forms[0].interfaceFileName.value = fileName;
document.forms[0].fileNameDesc.value=fileDesc;
document.forms[0].submit();
}
The function is called by many buttons in the same form.
Each button is supposed to be redirecting to different html pages
based on the parameter "document.forms[0].recordID.value" i have
directed the form action to a jsp page to handle the redirection but i
cannot get the parameter using jsp. Can i retrieve the
"document.forms[0].recordID.value" if so how?
Do i use javascript to retrieve? I tried using
request.getParameter("recordID")in my jsp but i get a null pointer
exception.
Am i retrieving the value corrrectly?


Javascript runs on the client. It has nothing at all to do with Java, despite
the name of the language.
JSP is Java Server Pages. It IS Java. (java is OT here)

Javascript cannot retrieve posted form values. It can parse a URL for GET
params.
JSP can retrieve either.

request.getParameter will never give you a null pointer exception - it's what
you're doing afterwards that is giving you the exception. If no value exists
for the param, it returns null.
From what I can tell, request.getParameter is getting null for recordID. That
means there is no value. Check what is actually get sent to the server. Just
out.print the values of the form params in the JSP and comment everything
else out. Did you get a value for recordID? If so, it's your JSP code that is
the issue, not your javascript.

Javascript is NOT a typed language - if you call the function wrong, it won't
complain overmuch. Not like Java. Are you SURE you're passing the right info
to the javascript function? Place some alerts in there if you're not sure.
See what you're really passing for fileID (which is then assigned to
recordID).

HTH

--
--
~kaeli~
Synonym: the word you use in place of a word you can't
spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eugfene | last post by:
i have the following function in a html file: function selectEdit(fileID, processCode, processID, fileName,fileDesc) { document.forms.recordID.value = fileID; document.forms.processor.value =...
0
by: Ramkumar | last post by:
Hi I am calling a DB2 stored procedure with 3 parameters. The last one is an inout parameter in which a value is returned (SQLCODE). I am using the DB2DataAdapter object's fill method to return a...
12
by: Dica | last post by:
i can't seem to find a way to cast the value in my comboBox to integer. i've tried the following: short iProjectID = Convert.ToInt16(cboProjects.SelectedValue); i keep getting a "Sepcified...
5
by: bobdydd | last post by:
Hi Everybody I have an Access database that passes a Parameter to a web page something like this. http://localhost/index.htm?paramName=1234-54321 I want to be able to retrieve the parameter...
1
by: tomjbr.32022025 | last post by:
I have started looking at the nhibernate framework, but do not really like the string based API which makes it impossible to use automatic refactoring of a property name without the risk of getting...
0
by: onno.willems | last post by:
Hi, In our project we have a large library of VB script (.vbs) files. Each file has 1 function. I want to document these functions, so a VB.NET application can retrieve the documentation and...
5
by: Ken | last post by:
I'm trying to run a loop to capture column property information from a table in my datasource. Can anybody see where this is going wrong? Dim tbl As New DataTable Dim col As DataColumn Dim x...
3
by: DhruviTrivedi | last post by:
Is there any way to get parameter value from variable like @Param1 varchar(50) @Param2 varchar(50) set Param1 ='value1' while --condition-- begin
5
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= | last post by:
Hi, I've created a class library assembly containing several string resource files, like: - TableColumns.resx - TableColumns.de.resx - General.resx - General.de.resx
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.