Jorge Blaz

Ranch Hand
+ Follow
since Jan 31, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jorge Blaz

Originally posted by Bear Bibeault:
The inability to directly accesss constant values is about the only thing I miss after going completely sciptless. But the other benefits I reap vastly outweigh that disadvantage.



Agree 100%
18 years ago
JSP
Yes, if it's not taking with care having a lot of maps for storing the constants can be a big mess. But if the namespaces are clear, maybe it's easy to have them accessed in an easier way and at the same time have the advantage of maintanance that constants give you. I will take a look at it and see if i can apply on the project.
Thanks for your info Bear, it has been very useful.
18 years ago
JSP

Originally posted by Jim Yingst:
And of course with J2SE 5.0, you can use the enhanced for:




Wow! how simple...
I've to learn J2SE 5.0

Regarding J2SE 5.0, I've a question maybe you have an answer to...
If I want to use J2SE 5.0 new features what is the least version of J2EE I have to use?. I mean, i guess it is not possible to use J2SE 5.0 features with J2EE 1.3, maybe the minimal would be J2EE 1.4?. Am I wrong?

Thanks

[ July 12, 2005: Message edited by: Jorge Blaz ]

[ July 12, 2005: Message edited by: Jorge Blaz ]
[ July 12, 2005: Message edited by: Jorge Blaz ]
18 years ago
Thanks Bear.
Yes, this could be a nice solutiom. I've constants grouped in several classes, so i would have to use several maps or a map o maps, and have as keys some id that would identify each class.
18 years ago
JSP

Originally posted by Bear Bibeault:
What is it you are trying to do with said constant in the JSP page? You will not be able to reference it with the EL.



Is there a way of refering to Constants using the EL?. The only idea I have is to have a Constants class as a JavaBean, but this will lose the idea of a Constants class.

I really like JSTL and have been using it a lot. The EL is very powerful and since i have to use J2EE 1.3 I'm stick with JSTL 1.0 so can't use advance JSTL elements like functions. Still find it very helful.
But I find that without accesing constants then it is very error prone.

I mean, having a like like this:
<c:set var="miVar" value="${requestScope.myBean}" />

in a lot of pages would be a pain if suddenly the bean is stored in the requestScope under another name rather than "myBean".

Thanks in advance
18 years ago
JSP
So, speaking about ArrayList and Iterators, is there an advantage of iterating the ArrayList with a "for loop" or a "while loop"?

I've usually used the while loop, but other people suggest to use a "for loop", because this way the Iterator only is declared among the "for scope" and this leads to less mistakes. Is that true?
18 years ago
Yes, the Calendar object is a great way of handling dates. Some methods of the Date object have been deprecated in favor of using the ones provided by the Calendar object
18 years ago
If you warranty that the Object is a String, then I prefer to do the cast rather than calling toString() method.

The reason is that if the object is null, then casting the object to String would give null as well, but trying to call the toString() method on a null String will throw a NullpointerException
18 years ago

Originally posted by Eric Pascarello:
You have to handle it on the server than. No other option. Look to see what button was clicked in the form submission.

Eric



Thanks Eric :-)

I have done it the way you say. Since I'm using Struts i used an Action who looks which buttons was clicked and then link to the appropiate page.
But I still have one problem.

I have some hiddens that are set when each button is pressed. These hiddens are different from one button to the other. That means, if i click button1, the hiddens are sent with some values. When I click button2, these hiddens are sent with other values (i sent them with javascript-onclick event).

No, if i do the button-clicked check on the server, I don't know how can i send the related hidden values to the clicked button.

I could have the same hiddens repeated with different names for each button, and then sent all of them, the ones related to the clicked button will have been populated with values and all the others will be sent blank. But I don't really like this solution. Maybe you can point me to other ideas.

Thanks a lot
Jorge

Originally posted by Lasse Koskela:

...and then you could test the Plugin delegate class in isolation of the SAX handler, the actual XML document contents, and the ApplicationContext since you would be in a position to pass mock implementations of them to the delegate's init() method.

Just a thought. Might not be worth the effort.



I don't understand your suggestion here. I'm very new to testing. Is there a way to have mock Objects for the ActionServlet and ModuleConfig objects?. I guess Cactus could give you a Servlet or HttpRequest object, but ModuleConfig and ActionServlet are Struts dependant. I've take a look at StrutsTestCase Api and haven't found a way to get these objects either as mock objects or as container-supplied ones.
The same happens when testing the maps that are in the application context scope. I cannot simulate the ServletContext object.

By the way, I tested the Handler and it worked. I parsed it and then asserted that the maps had the right values readed from the xml file.

Thanks Lasse for your help :-)

Regards
Jorge
18 years ago
Hello,

I have a table with ten rows, for example. The table has three columns and the first one has a checkbox per row. So, you can select one or more rows by checking the corresponding checkbox. Then you have three buttons, each of them to do a different action with the rows selected.
The table and buttons are surrounded by a form. But what i want is to submit to a different location when each button is clicked.
What I do now is to have an onclick event on the buttons and then with Javascript I change the action attribute of the <form> tag.
But I want to make it accesible, I mean, that if someone disables Javascript, that the form still works. Any ideas?

Thanks in advance
Jorge

Originally posted by Lasse Koskela:

I suppose that depends on what kind of an interface do these Struts plugins have?.



I have a class that implements org.apache.struts.action.PlugIn, reads a path to an xml file (with set-property nested tag) in the init method, then parses this xml with SAX, build a map with the xml element values and stores the map in the application context.


Originally posted by Lasse Koskela:

Yes, you can indeed test a SAX handler with JUnit -- just create an instance of the handler and start calling the SAX event methods (and then, after you're done, verify somehow that the handler did what it's expected to do).



Thanks Lasse, I will try it :-)

Regards
Jorge
18 years ago
Hello,

I have done several plugins for struts (similar to TilesPlugin or ValidatorPlugin). What I don't know is which tool to choose in order to test the plugins.
I have used StrutsTestCase for Struts Actions, but don't know if I can test the plugins with StrutsTestCase as well. Ho about Cactus?
I've also done a handler Class (extending DefaultHandler) to read an xml with a SAX Parser. It's possible to test this Handler class also with JUnit?.

Thanks in advance
Jorge
18 years ago
Thanks for the reply, Carlos :-)
I started learning Java with VisualAge. It was a great IDE.
Later when I changed to Eclipse/WSAD I thought it would be difficult to be used to it since I was very familiar with VisualAge. But I really like Eclipse, it's great the way you can customize perspectives and move views everywhere you want.
And you can always build a plugin to get features Eclipse does not support.
I've been using WSAD for two years and I also have used Eclipse. I really find it a great IDE, but since I haven't used any other IDE's I can't objectively say that Eclipse is the best one. But I like it a lot.
Maybe Carlos can point two or three characteristics that make Eclipse unique and worth to learn and use it (and read his book, of course ;-).

Thanks
Jorge