Click to See Complete Forum and Search --> : Separating HTML from Java


nedave
10-07-2008, 02:23 AM
Hi all

I have been trying to pass my data from forms using HTML and AJAX to my JSP pages. Can anyone suggest something alternatives other than sending HTML codes together with Java codes in JSP pages? (I have looked into Struts Framework and JSTL but it seems that it does not really adhere to separating content from the presentation by only shifting the codes to somewhere else)

Regards
Nedave

opifex
10-07-2008, 03:48 AM
have you tried xhtml with xforms?

nedave
10-07-2008, 05:42 AM
Nope. This is because XHTML with Xforms is not supported with the major recent browsers. Any sample codes to get me started or tutorial examples? :)

Regards
Nedave

opifex
10-07-2008, 01:20 PM
quite true - you have to use plug-ins.
i played with the xforms generator with eclipse at a workshop in august. worked ok and the package had good examples. i think it's the same as offered on the ibm developer site (http://www.alphaworks.ibm.com/tech/xfg?open&S_TACT=105AGX59&S_CMP=GR&ca=dgr-dw15awxfg).

what's your server architecture? would it be feasible to integrate php or perl processing for the forms?

nedave
10-07-2008, 09:11 PM
Hi opifex

I am using an open source project named Openfire (found in http://www.igniterealtime.org) with my own customized plug-in written in Java. The client-side project is developed using NetBeans IDE 6.1, while the database is running on MSSQL Express 2005 Express Edition. I am just wondering if how I can pass my data (using XML, without XSLT of course) into my JSP pages without using Strings of HTML (I am using String concatenation of HTML together with my data in JavaBeans and passing the data to my JSP pages using the innerHTML property in JavaScript). This does not conform to separating the content from the presentation layer, although my code works. I believed there might be some codes available to aid me in my development, do you know of any useful sources?

Regards
Nedave

opifex
10-07-2008, 11:52 PM
since openfire is xmpp and has it's own xform classes, why not use them - xml called from ajax ..... direct interact with java ....
XML IN -> XML OUT

think about it... the flow diagram on this page (http://xtech06.usefulinc.com/schedule/paper/133) shows exactly what you can do using the native xforms package (http://www.igniterealtime.org/builds/openfire/docs/latest/documentation/javadoc/index.html?org/jivesoftware/openfire/forms/spi/package-tree.html) and xmlwriter in openfire. XML only in the browser window.
if you can't get it to behave the way you want a good option might be to check out orbeon (http://www.orbeon.com/). i haven't played with it, but i know a couple of people who are quite happy with it and it's OpenSource(lgpl).

would like to see your finished project!

nedave
10-08-2008, 01:51 AM
Hi opifex

I am currently experimenting and looking into how to apply that to my codes. The major problem I faced is to change my approach in writing IQ (Info-query) handlers and JavaBeans in NetBeans IDE to pass data to my JSP pages. You can look under the thread "Dynamically move an element" (http://www.webdeveloper.com/forum/showthread.php?t=191480) which I posted to get the idea on what I am working on for my project. If you would like to see the source codes (which is too large in size to be posted on the forum), I can send it to your e-mail. Just let me know and I would appreciate if you can share your views with me. I hoped to hear from you soon. Thanks!

Regards
Nedave

chazzy
10-08-2008, 06:21 AM
Hi all

I have been trying to pass my data from forms using HTML and AJAX to my JSP pages. Can anyone suggest something alternatives other than sending HTML codes together with Java codes in JSP pages? (I have looked into Struts Framework and JSTL but it seems that it does not really adhere to separating content from the presentation by only shifting the codes to somewhere else)

Regards
Nedave

I think that technologies like JSF, Richfaces/a4j, and maybe even Spring/Seam would be more like what you're looking for.

opifex
10-08-2008, 12:05 PM
the chore of re-writing is for a particular "bag of beans" is what keeps me distanced from java. i like java and it is a great language, but the transportability issues are a real pain.

nedave
10-29-2008, 05:14 AM
Ok. I think I get your point.