472,805 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 4036
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
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.