Expand my Community achievements bar.

'Submit to URL' via Submit type Button

Avatar

Level 2

Hi,

I'm trying to post the contents of a .xdp file viewed as HTML via the RenderHTMLForm service. I want to post the contents of the form as xml input to a Java servlet. As an example, the url is localhost:8080/AppName/PostServletName - this is the target behind the submit button.

The form posts back to itself (the URL and servlet that retrieved it

initially) on submission at this point.

Is this possible? And if so, how can I get a String value of the xml contents of the form (fieldName, fieldValue format). I want to write the xml content into an XML-type field into an Oracle database rather then parse and write field by field.

Is this possible? I'm new so please bear with me...

Thanks!

3 Replies

Avatar

Level 10

You can definitely do.

First check the property of the submit button in your xdp and make sure you submit XML.

Then in your servlet you can use something like request.getInputStream to get the value of the xml into a byte[].

Jasmin

Avatar

Level 2

Jasmin,

Thanks for the quick reply. The problem is the same but I have a couple more questions for clarification regarding the Submit button.

1. Button control type is 'submit'?

2. Button type is 'Button'

3. Submit as is 'XML Data (XML)'

4. Submit to URL follows: http://10.7.88.70:7003/wsRenderHTMLTestPost

Where http://10.7.88.70:7003/wsRenderHTMLTestPost is the server name with

the servlet name. Note that there is another servlet named wsRenderHTMLTest

that is called correctly and displays an html page correctly. The submit

button on this page (non-Workbench) displays the Workbench defined .xdp page

correctly.

Is the URL defined incorrectly?

Thanks,

Bill

Avatar

Level 10

Yes. The url seems to be be fine.

You can put any url you want.

The the rest is just java/servlet code to extract the request information.

Jasmin