Archive for the ‘javascript’ Category.

Passing Struts values to Javascript

yureka

This another day to get into struts. See, I have an input type as image and onclick function.

<input type=”image” name=”" src=”/teller/images/close.gif” onclick=”del(200);”>

The 200 given as parameter should be passed from struts form bean. Different type of combinations lead to error. finally defining a variable helped as follows.

<bean:define id=”myID” name=”resultI” property=”id”></bean:define>

<html:image src=”/teller/images/close.gif”  onclick=”<%=”del(“+myID+”);” %>”></html:image>

Coordinates of elements in DIV – Firefox and IE

The Data Area Passed to the System Call is Too Small


I got the following error in Firefox, while opening a new window with specified parameters, “the data area passed to the system call is too small”. there is some limitation in the length of the query string that is being passed (GET) request. automatically it gets screwed and the error is simply written in the browser. with Internet Explorer, we cant figure-out the error, since its error message is not at all helpful!!!

AJAX and window.location.href

see there is a html line like this
<a href=”javascript:void(0);” onClick=”javascript:deleteGroup();”>Delete</a>
the delete group function is written as

function deleteGroup()
{
selectAll(null);
if (groupNames==”" || groupNames==”,”)
{
alert (“No Groups selected”);
return;
}
var a = confirm(“Are you sure you want to delete the selected groups? This change is permanent and this cannot be recovered!”);

if(a)
{
alert(groupNames);
window.location.href=”/final/admin/Egconfiggroupp.jsp?deleteGroups=”+groupNames+”&mode=delete”;
return;
}
}

It is working fine in Firefox but not in IE. Actually the control has been transferred to configgroupp.jsp and what it need to do, has been done. but it is not getting reflected in UI. it is static :( but when you add ” window.event.returnValue=false;” after window.location.href it is workign fine.

function deleteGroup()
{
selectAll(null);
if (groupNames==”" || groupNames==”,”)
{
alert (“No Groups selected”);
return;
}
var a = confirm(“Are you sure you want to delete the selected groups? This change is permanent and this cannot be recovered!”);

if(a)
{
alert(groupNames);
window.location.href=”/final/admin/Egconfiggroupp.jsp?deleteGroups=”+groupNames+”&mode=delete”;
window.event.returnValue=false ;
return;
}
}

What MS site says is, http://support.microsoft.com/kb/190244/en-us ,
The onclick event is overwritten by href tag etc etc….. oops. oh MS associates, why your browser keep on bugging me, while firefox is working fine?


—————————————————
*Free* software is a matter of liberty not price. You should think of “free” as in “free speech”.

Creating an application with GWT – Application creator

Today I have started with applicationCreator.cmd in the GWT folder!
Adding something important, GWT follows some structure in maintaining projects. As per specification, this is my assumption.
org/vaigai/shiksha – > this is the project root
org/vaigai/shiksha/client ->client side source files
org/vaigai/shiksha/server ->server side code
org/vaigai/shiksha/public ->web resources, public

oh no, dont get tired, the application creator script will do all these for us!

D:\projects\gwt\gwt-windows-1.0.21>applicationCreator.cmd org.vaigai.shiksha.client.myapp Created directory D:\projects\gwt\gwt-windows-1.0.21\src Created directory D:\projects\gwt\gwt-windows-1.0.21\src\org\vaigai\shiksha Created directory D:\projects\gwt\gwt-windows-1.0.21\src\org\vaigai\shiksha\client Created directory D:\projects\gwt\gwt-windows-1.0.21\src\org\vaigai\shiksha\public Created file D:\projects\gwt\gwt-windows-1.0.21\src\org\vaigai\shiksha\myapp.gwt.xml Created file D:\projects\gwt\gwt-windows-1.0.21\src\org\vaigai\shiksha\public\myapp.html Created file D:\projects\gwt\gwt-windows-1.0.21\src\org\vaigai\shiksha\client\myapp.java Created file D:\projects\gwt\gwt-windows-1.0.21\myapp-shell.cmd Created file D:\projects\gwt\gwt-windows-1.0.21\myapp-compile.cmd

Hey, amazing, a hello world is readily available with this newly launched project! see the client folder
Directory of D:\projects\gwt\gwt-windows-1.0.21\src\org\vaigai\shiksha\client 01/26/2007 01:50 AM 1,208 myapp.java 1 File(s) 1,208 bytes

also the hosted mode shell MyApplication-shell and the compiler MyApplication-compile is also issued with the newly created project.
issing the command myapp-shell will launch your program!! :)
coool..

then we can start editing the java, compile, view etc etc....!

so, hereafter lets see thost applications one by one!

for now, bookmark the link
http://code.google.com/webtoolkit