• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem in invoking post method of other form at a URL  RSS feed

Gaurav Chikara
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
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) {
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
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!