life and stuff

Listen, strange women lying in ponds, distributing swords, is no basis for a system of government... You can't expect to wield supreme executive power, just cause some watery tart threw a sword at you....
saving the world, one CVS/SVN check-in at a time...

1.06.2009

GWT widgets and Struts

This represents one solution that I found when trying to determine how to grab text from a pop-up text field, and use it in a following Action class. Originally, I decided to use a Session variable-but the guilt of the hack was weighing me down, and this is what I found works instead.

Add a hidden input variable on the JSP page with the widget.
Add a method in the Widget code that calls a javascript method on your page. The widget method should pass in whatever value your widget has collected. For example, to pass in the value from a text area the widget should do something like:

if(ta.getText()!=null){

passComment(ta.getText());


}

In this example, the text area (ta) text is used as a parameter to the passComment() method in the widget. This method uses the text as a parameter to the javascript method like this:

public native void passComment(String text)/*-{

$wnd.submitCommentToAction(text);

}-*/;

The final method in the onSuccess is a method to submit the page. The order of the two of these methods in onSuccess is important, if the page is submitted before the variable is set, the Action won't receive it. (imagine that!)

On the JSP page, add both of the methods:

function submitCommentToAction(text){
document.forms[0].comment.value = text;
}

function submitForm (){
document.forms[0].submit();
}

Also add the hidden variable you want to set. In this example it is called "comment"-as referenced in the following line: document.forms[0].comment.value = text;

This submitCommentToAction sets the value of the hidden field using the Hidden object. http://docs.sun.com/source/816-6408-10/hidden.htm#1193138 . Orginally I considered using a document.write() statement-the problem with this approach is that it must reload the page-which causes obvious problems.

Finally, grab the request parameter in the Action, and you should be good to go.

BTW, I didn't say it was a good idea to use pre-Struts 2 with GWT, only that it can be done one way or another...if you have to jam it into a legacy app that is....apparently mixing Struts and GWT is considered bad practice-so caveat empor!

3.13.2008

things that make you want to hurl

why do i often sit near guys that think it's socially attractive to burp outloud repetitively?


help!!

other than that, am awaiting an offer letter from BAE before giving notice. yes, i can't take the organizational dysfunction here. if it meant that our team was more agile, then maybe i could stomach the lack of clear process. but usually it winds up being a huge stumbling block, and means that i often don't accomplish as much as i'd like to.

in other words, i get bored.

new job is as close to home (if not closer) with my old very large with great benefits company.

oh, and did i mention better tuition benefits?

w00t.

3.07.2008

unstable subversion repository-and how it can affect you

i learned today after many attempts to delete a file, create it, and add it to the repository this little nugget. when you are in the midst of attempting interacting with the repository, and the repository connection is aborted for some reason, subversion will lock your local file.

to get around this you have to issue a "clean up" command. if you are using eclipse + subclipse, you have to select the directory with the file, right click, select Team, and then select "clean up". this will remove the locks on any of the files.

please, don't make the same mistake i did thinking recreating the file will work. it could make you go slowly insane.

or, just bitchy.