Mar 31st 05
Posted by Remus Stratulat in Java
Struts was using two different classes to report errors and messages back to the user: ActionErrors and ActionMessages. As the ActionErrors and ActionError classes were deprecated since 1.2.0. version I will talk now only about ActionMessages and ActionMessage.
From an action class when you need to send a message to the page all that must be done is to set it up using the ActionMessages class.
Struts ActionMessages example:
ActionMessages actionMessages = new ActionMessages();
actionMessages.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("my.error"));
saveMessages(request, actionMessages);
This error will be displayed in JSP using:
<logic:messagesPresent message="true">
<html:messages message="true" id="msg">
<bean:write name="msg" ignore="true"/>
</html:messages>
</logic:messagesPresent>
One issue to be mentioned here is that “my.error” is a key that will be used to look up message text in an appropriate message resources database, like Application.properties for example.
But if you do not need to report a generic error message you will have to use the following code:
ActionMessages actionMessages = new ActionMessages();
actionMessages.add(ActionMessages.GLOBAL_MESSAGE,
new ActionMessage("my.error"));
request.setAttribute("warnings", actionMessages);
This code will set up an error message under an arbitrary key and display it with the html:messages tag:
<html:messages name="warnings" id="message">
<bean:write name="message" />
</html:messages>
There are some differences to be noticed here.
- There is no message=”true” attribute present that signals to look up for an ActionMessage under the Globals.MESSAGE_KEY.
- There is no <logic:messagePresent> tag as it will not be validated.
If your error message gets constructed dynamically the ActionMessage class offers four constructors that allow message customization with up to four parameters.
So the message:
new ActionMessage("my.error", "p1", "p2", "p3", "p4")
where
my.error=You are not allowed to do {0}, {1}, {2} and {3}
will render
You are not allowed to do p1, p2, p3 and p4
Mar 22nd 05
Posted by Remus Stratulat in Java
I am developing an application using JBoss as a deployment server. After a redeploy the JBoss throws an error on me: org.jboss.deployment.DeploymentException: Connection refused: connect
The problem was in jboss.xml file:
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS3.2//EN"
"http://localhost/jbossdtd/jboss_3_2.dtd">
After I have changed this to:
<!DOCTYPE jboss PUBLIC
"-//JBoss//DTD JBOSS 3.2//EN"
"http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
everything has gone smoothly.
Mar 17th 05
Posted by Remus Stratulat in Java
I found myself the other day in a strange position developing a project on JBoss.
The project was based on Struts and after deployment it didn’t worked. The symptoms were this: the landing page was not updated to the version of the deployed project. Instead the browser was showing to me a page from a previous Struts based project.
After I sniff around on the Internet I found no solution to my problem
. So I did it the hard way.
I start searching for a pattern in the JBoss behavior and I found that it cached all the files that were common between the two projects. That was because the last project was from CVS and had all the sources older then the first project I was working with. So I modified the index.jsp and after loading it into the browser (and sow it was the correct one) I’ve start to search on my hard drive all the files not older than 10 minutes. And there it was
, c:\tmp\project_name\index_jsp.java.
So after I’ve deleted c:\tmp\project_name directory everything gone back to normal.
Mar 14th 05
Posted by Remus Stratulat in Java
Well, Struts uses the Model-View-Control Model 2 approach.
There is only one difference between Model 1 and Model 2, Model 2 architecture introduces a controller servlet between the browser and the JSP pages. And that is all.
Mar 7th 05
Posted by Remus Stratulat in Java
I have started to learn Struts which is an open source framework for building web applications. There are some nice features in this framework and I am trying now to get a hold on them.
There are more frameworks out there in the Internet realm, some better then others. Here are some of them that I know:
For sure there are a lot more frameworks but this four are the ones I know. I will return with more on this subject.
Mar 4th 05
Posted by Remus Stratulat in Java
Today I am reentering into the Java world.
I have changed my workplace. It has been nice and fun to work for InterAKT and to develop Dreamweaver extensions as I believe that I helped the company become the best in this market. The experience gained there was great. I have learned new technologies and I have become a better person, better team mate as I have polished my people skills under the tutor of some great colleagues.
But the time has come to return to the technology I like most: Java.
Nov 4th 04
Posted by Remus Stratulat in 2004
It’s 2:30 PM and I’m at the Community Pit. Only few are here as this last day of MAX is filled only with sessions.
We just had a “work” lunch with Randy from Macromedia. The discussions were so insightful as after an hour or so we found ourselves alone in the dining room.
I think the conference was a great success. A lot of people visit our booth (we will carry no promotional materials back home) and we made a lot of connections. We meet with customers and they were all satisfied with our products.
I meet here Kai Konig. He was a real help to me and to all of us as he give us some useful informations on how to become a Premier Partner (his company is one). First step will be to get some Macromedia certifications, so Lucian and I will start learning to get those certifications. Kai show us two very good books that help him in his study and with his recommendations we bought them.
Nov 2nd 04
Posted by Remus Stratulat in 2004
Today is the second day of the conference. We got up early and arrived here at 7:30 for a short breakfast. Now we are all sitting at the community pit working on our laptops. I’m writing this blog and Alexandru is preparing his tonight session.
Yesterday the conference started late in the evening. We loose all our day preparing the booth, the folders and flayers and the product boxes. When the conference finally started a lot of people come to our booth. For the user groups managers we have prepared the boxed MX Kollection and wen the word got out a lot of them came to our booth an we almost finish all the boxes.
Other people came to our asking about the products. They were very interested in MX Kollection and a special atention was captured by KTML. We are all pleased the way first day presented. Now we are looking forward at the current day that is due to start in a short time.
Oct 31st 04
Posted by Remus Stratulat in 2004
Today we have gone to CF Underground.
The day started a little bit on the left foot as we found ourselves outside an empty Conference Centre. It seams that the CF Underground is not here. So we rush back to the hotel and connected to the Internet to find out that the CF Underground is held at Pan American Conference Centre
.
We arrive at Pan Am CC in time to the first session: a discussion about Flex. The speaker Kai Konig is very prepared about the subject and the arguments in favour to use Flex are good. What I really like is that is not aggressive about this subject, he does not want to impose his point of view about Flex, more to this he is even recommending Flesh remoteing for some types of projects.
The second session is about Extreme Programming. It is presented by Michael Smith and Shlomy Gantz. The session is very dynamic and all the participants get involved in the discussion. At the end of a debate about pear programming in XP the common point of view is that is efficient but with some limitations as is unpractical to put two programmers to waste there time on common tasks. Other limitations refers to the nature of the involved programmers (as in their skills, ego, …).
I missed the following 2 hours of the conference but I got in time for Bogdan’s presentation about securing shop sites. After a slow start (due to the fact that probably everybody thought their own work was secure enough) the discussion picks up some speed as the auditorium get more scared as Bogdan goes deeper into the subject. Phrases like: “Can you do that? I didn’t know somebody can do that to a site.” are common and the session ends with a promise from Bogdan that will write a more detailed article about this subject.
After that Simon Horwith comes and entertain us with his session about design patterns and his unique presentation stile. He’s got humour, knowledge and we are all ears.
The day ends again on Bourbon Street. This time we are tired and after just a beer we return to the hotel.
Oct 29th 04
Posted by Remus Stratulat in 2004
After a day spent on shopping (we’ve got us some decent digital cameras) we head into the night again. With us is George Fox from Macromedia. He is for the second time in New Orleans so we ask him to be our guide. But the last time he was in New Orleans it was to many years ago so we took the guiding in our hands and head out to the Bourbon Street. Again
.
This time is even wilder then last time. More people on the street are making this outdoor party a big event. At any restaurant or bar there is a guy or girl in front of it luring you inside. We took the chances and enter one and have some (expensive) beers.
The party goes on on the street and the beads are thrown up and down in an almost continuous flow.
Me and Lucian part the team and we go to eat something. After that we return to the hotel being to tired to stay up any more.