jmc430
asked on
Passing A Value -- HELP!
Greetings!
I'm getting the following error:
Error: java.lang.NumberFormatExce ption: For input string: "<%cPk%>"
Reason: For input string: "<%cPk%>"
Basically I aimed to pass a hidden value from one application to another, in order to hide the URL location from users' browsers.
I used a "POST" form instead of a "GET", and used the correct input tag - <input TYPE="hidden" name="cPk" value="<%=cPk%>">
However, I suspect that the value of cPk, a primary key, is not being correctly passed in the proper format .. although I made the types consistent in my code (and when I hardcoded a number value, I know conceptually this thing should actually work):
Here is the relevant code from the class in the first application:
========================== ========== ========== ========== ========== ========== ========== ===
protected Double cPk;
public Double getCPk() {
return cPk;
}
public void setCPk(String getCertificateUrl) {
cPk = new Double(getCertificateUrl);
}
public String getCertificateUrl() {
String cPk = certification.certificatio nPk().toSt ring();
//String url = "https://hostname/etc/WebObjects/PDFGenerator.woa/wa/viewReport?cPk=" + cPk;
//String url = certification.certificatio nPk().toSt ring();
return cPk;
}
========================== ========== ========== ========== ========== ========== ========== ==
and here is the relevant code in the second application:
========================== ========== ========== ========== ========== ========== ========== ==
protected Double cPk;
private NSArray lookupCertification() {
// Lookup Certification via cPk
return fetchSearch("getCertificat ionPk", "Certification", "cPk", getCPk(), this.session().defaultEdit ingContext ());
}
public Double getCPk() {
return cPk;
}
public void setCPk(String newCPk) {
cPk = new Double(newCPk);
}
========================== ========== ========== ========== ========== ========== ========== ==
and here is some more relevant code from another class:
========================== ========== ========== ========== ========== ========== ========== ==
public void takeFormValues(NSDictionar y value) {
java.util.Enumeration e = getValueList().objectEnume rator();
while (e.hasMoreElements()) {
String key = (String)e.nextElement();
Object obj = context().request().formVa lueForKey( key);
if (obj != null) {
takeValueForKey(obj, key);
}
}
}
========================== ========== ========== ========== ========== ========== ========== ==
I am ripping what little is left of my hair out ... I suspect the issue is trivial but the cause of the error is beyond me.
Any advice and or guidance would be greatly appreciated!
Best regards,
nearly hairless jamie
I'm getting the following error:
Error: java.lang.NumberFormatExce
Reason: For input string: "<%cPk%>"
Basically I aimed to pass a hidden value from one application to another, in order to hide the URL location from users' browsers.
I used a "POST" form instead of a "GET", and used the correct input tag - <input TYPE="hidden" name="cPk" value="<%=cPk%>">
However, I suspect that the value of cPk, a primary key, is not being correctly passed in the proper format .. although I made the types consistent in my code (and when I hardcoded a number value, I know conceptually this thing should actually work):
Here is the relevant code from the class in the first application:
==========================
protected Double cPk;
public Double getCPk() {
return cPk;
}
public void setCPk(String getCertificateUrl) {
cPk = new Double(getCertificateUrl);
}
public String getCertificateUrl() {
String cPk = certification.certificatio
//String url = "https://hostname/etc/WebObjects/PDFGenerator.woa/wa/viewReport?cPk=" + cPk;
//String url = certification.certificatio
return cPk;
}
==========================
and here is the relevant code in the second application:
==========================
protected Double cPk;
private NSArray lookupCertification() {
// Lookup Certification via cPk
return fetchSearch("getCertificat
}
public Double getCPk() {
return cPk;
}
public void setCPk(String newCPk) {
cPk = new Double(newCPk);
}
==========================
and here is some more relevant code from another class:
==========================
public void takeFormValues(NSDictionar
java.util.Enumeration e = getValueList().objectEnume
while (e.hasMoreElements()) {
String key = (String)e.nextElement();
Object obj = context().request().formVa
if (obj != null) {
takeValueForKey(obj, key);
}
}
}
==========================
I am ripping what little is left of my hair out ... I suspect the issue is trivial but the cause of the error is beyond me.
Any advice and or guidance would be greatly appreciated!
Best regards,
nearly hairless jamie
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
whats the value of cPK?
Have you tried:
<input TYPE="hidden" name="cPk" value="<%= java.net.URLEncoder.encode (cPk, "UTF-8") %>">
Have you tried:
<input TYPE="hidden" name="cPk" value="<%= java.net.URLEncoder.encode
Hello jmc430,
With out your responses it is difficult to analyse your problem. Let us know if any of the suggestions helped you
Best Regards
Sudhakar
With out your responses it is difficult to analyse your problem. Let us know if any of the suggestions helped you
Best Regards
Sudhakar
ASKER
Hi .. thanks for all of your help.
=)
=)
8-)
:-)
<input TYPE="hidden" name="cPk" value=<%=cPk%>>