Hi, I have been working in this issue for sometime, but have been stuck in this step for a while. I searched a lot in the internet, read many tutorials and question/answers and now I am totally confused! Hence I am asking this question.
I have to develop a html/jsp GUI which will calculate the difference of two XMLs entered in two textareas and the result will be populated in the result textarea. Very much similar to XDiff or KDiff applications. GUI will pass the XML1 and XML2 to servlet and servlet will pass the difference to the GUI. I am stucking at the last step - how servlet will populate the result textarea of the html/jsp?
Also my GUI is multi frames and hence has different source files for each of them. Sample code is as follows -
1. XML1.html
2. XML2.htmlHTML Code:<form name="xml1"> XML 1:<br /> <textarea name="xml1text" id="comments" style="width:100%;height:95%;background-color:#D0F18F;"> Text Area 1! </textarea><br /> </form>
3. XML3.htmlHTML Code:<form name="xml2"> XML 2:<br /> <textarea name="xml2text" id="comments" style="width:100%;height:95%;background-color:#D0F18F;"> Text Area 2! </textarea><br /> </form>
4. XMLDiff.htmlHTML Code:<script language="javascript" type="text/javascript"> function mysubmit() { xml3.text1.value=window.parent.left.xml1.xml1text.value; xml3.text2.value=window.parent.right.xml2.xml2text.value; } </script> <form action="/servlet/XMLDiffServlet" name="xml3" method="post"> XML 3:<br /> <textarea name="resulttext" id="comments" style="width:100%;height:90%;background-color:#D0F18F;"> </textarea><br /> <input type="submit" value="Submit" onClick="javascript:mysubmit()"/> <input type="button" value="Clear" /> <input type="hidden" name="text1" /> <input type="hidden" name="text2" /> </form>
5. XMLDiffServlet.javaHTML Code:<html> <head> <title>XML Diff</title> </head> <form name="xmldiff" method="post"> <frameset rows="50%,50%"> <frameset cols="50%,50%"> <frame name="left" src="XML1.html"> <frame name="right" src="XML2.html"> </frameset> <frame name="bottom" src="XML3.html"> </frameset> </html>
What should I do here so that the result can be thrown in the XML3's result textarea?
If it is not possible in html, is it possible to do the same in jsp? Somebody is saying yes, it's possible in html, somebody is saying no. Sobody is suggesting javabeans and somebody is suggesting ajax. I am totally clueless!
I am sure I have to use req.getRequestDispatcher(), but can it populate the client textarea?
Please help me out.
Thanks