Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

HTTP client: xml vs HTML Response

807589Jan 9 2009 — edited Jan 9 2009
Hi Guys,
i'm using appache commons http client to send HTTP post queries to a given url and receive HTTP response then process it.
one of the requirements of my Application is the following:
one of these HTTP Post methods is supposed to return an HTML form with different html types (text filed, text area etc..) that i will need to display in my swing application. one important function is that i can't know in advance what the html form types will be ; it depends on a given parameters that my application send as part of HTTP Post method (using apache http client).
i thought of two possibilities :
1-the http method returns html String with all form fields that i can render in my java application using a JEditorPane : the draw back of this solution is that when user fills the html form inside JEditorPane , my application will need to send a HTTP POST method with parameters the values filled in from by user. I'm not sure if there is a way JEditorpane can detect what html types are in html form and what are their values . i doubt JEditorPane can do this work ,unless i parse the html content inside JEditorpane. what you think ? how can i post the html form in JEditorPane and recieve http response from sending this html form inside my swing app?
2-second solution : the http method returns an xml string that i parse and then i will need to map the xml fields (representing html form types) to corresponding swing components . it's sort of xml to swing conversion work.
Now I'm not sure what is easier and better solution from the 2 above ? is it better to receive html stream or xml stream which contains html form types ?
any Ideas how to handle this problem would be very welcome.

thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2009
Added on Jan 9 2009
2 comments
257 views