I am using 3 frames in a jsp, one frame contains links for transactions. If one clicks on the link, I need to display 2 xmls (as Strings) in respective frames.
<display:table name="sessionScope.transactions" id="tTable">
<display:column title="Transaction Id">
<a href="javascript:somejavascript('<bean:write name='tTable'
property='requestXML' />','<bean:write name='tTable' property='responseXML' />');">
<bean:write name='tranTable' property='transactionId' />
</a>
</display:column>*
I want to bring evrything altogether while bringing links and when one clicks on the link I want to pass those xmls as String in javascript function and dispaly it in frames.
somejavascript(req, resp){
parent.frame2.location.href = req;
parent.frame3.location.href = resp;
}
But I came to know that I cannot pass large data in javascript function , it breaks some javascript rule. Is there any workaround to this problem?
You should balance your quotes and escape inner quotes.
http://jsfiddle.net/9qdkc/
Overall, your approach is inappropriate. Avoid using
javascript:links.How to improve?
Present the data you want to pass into a JavaScript function as a separate node and assign a unique ID to this node.
Then add an attribute with this ID to the link node.
Now, iterate over all such links in your separate JavaScript file and add click event listeners to them.
In the handler of these listeners analyze the ID attribute of the clicked link and traverse the document using DOM/E4X to find the node with the corresponding ID.