Forums Register Login

Problem in invoking post method of other form at a URL

+Pie Number of slices to send: Send
I have to invoke a post method of a Form at a particular URL
from my current program
I am doing the following
I am invoking this method in actionPerformed method of my button
public void formSubmitted(FormEvent event) {
FormEncodedContent content = (FormEncodedContent) event.getContent();
FormURLEncodedContent encodedContent = new FormURLEncodedContent();
String selectedValue = content.getValue("RadioGroup1").toString();
System.out.println("Form encoded content:" + event.getContent());
System.out.println("Value of radio button" + selectedValue);
if (selectedValue.equalsIgnoreCase("DSL")) {
configFile = "DSLProperties.txt";
}
else if (selectedValue.equalsIgnoreCase("Cable")) {
configFile = "CableProperties.txt";
}
loadConfiguration(encodedContent, configFile);
postForm(encodedContent);
}
which calls the following method
public void postForm(FormURLEncodedContent content) {
try {
File f = new File(System.getProperty("user.home") + File.separator +
".spark" + File.separator + "templates" +
File.separator + "NetworkConfig.htm");
uriResource = new URIResource(f.toURL(), content.toString());
System.out.println("contents are" + content.toString());
}
catch (MalformedURLException mex) {
System.out.println("Malformed URL" + mex.getMessage());
}
catch (IOException mex) {
System.out.println(mex.getMessage());
}
FormEncodedContent is in form of a stringbuffer and I am trying to send this content through uriResource class but I am not able to perform this operation.Can anyone pls suggest me where I am going wrong or what should be my approach?
Thankx in advance
What are you doing? You are supposed to be reading this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1051 times.
Similar Threads
Sound Problem
how to send email from j2me using Servlets
How To Code When Work With DynaValidatorForm
File Input/Output
Problem in Uploading files other than text files
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 04:36:10.