Billy Bob

Greenhorn
+ Follow
since Apr 05, 2005
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 Billy Bob

Internationalization... for example, lets say we are dealing with food. That food is organized by Food group and sub group. The food, group and sub-group have different values depending on the language but you want the user to be able to transfer between one language and another so the ID for a food is the same regardless of the language. As a result you have an ID, and the food name in as many languages as you need as a row in your DB. As a hibernate object (as far as I'm aware) you have all those languages present however as a Java object you don't care what language you're using as your food has a name and it's the responsibility of the business layer to populate it according to the Locale. Picture using a POJO in your jsp tags, you want to call name not englishname, frenchname, germanname, etc. depending on what the locale is as that logic is not the role of the jsp page.

This seperates your view and controller POJO's from the details of language implementation and isolates where changes need to be made if new ones are added. In my mind a business class will take the data from a hibernate object populate a POJO depending on the Locale (plus other items) and pass that POJO back to the calling struts action (which puts it in session for the jsp to use). At this point you can change the data access implementation (jdbc, ejb, etc) without altering anything for the struts and up just the business classes.

My question is, is that a reasonable way of doing it? I don't want to end up with my layers to reliant upon each other where one change will affect all portions of the application. I'm just not certain that that is a better way of going about it (or is there something that I'm completely missing that hibernate can accomplish).

Any feedback would be appreciated.

Thanks
I've been going back and forth on the following issue for sometime now but I'd like to get some different opinions. For all of the applications I deal with my java objects do not match up with my database tables nor should they and alot of the differences revolve around Internationalization. Because of this I have two real options, I can create objects that meet both the hibernate and application concerns there by coupling them together. Or I can do what I believe is the appropriate thing and use the hibernate objects simply as data transfer objects and use business layer classes to transfer the data thereby creating a true seperation between my model and the rest of my app.

Does anyone out there have any suggestions or comments on the class organization of these types of apps (usually struts and hibernate) and the difficulties inherent in ensuring that they remain decoupled?
17 years ago
I've been going back and forth on the following issue for sometime now but I'd like to get some different opinions. For all of the applications I deal with my java objects do not match up with my database tables nor should they and alot of the differences revolve around Internationalization. Because of this I have two real options, I can create objects that meet both the hibernate and application concerns there by coupling them together. Or I can do what I believe is the appropriate thing and use the hibernate objects simply as data transfer objects and use business layer classes to transfer the data thereby creating a true seperation between my model and the rest of my app.

Does anyone out there have any suggestions or comments on the class organization of these types of apps (usually struts and hibernate) and the difficulties inherent in ensuring that they remain decoupled?
Hey;

I'm having huge performance issues with the Debug environment in WSAD 5.1.2... I've got all the available updates, I'm running a machine with 2GB of RAM and when I was running WSAD 5.1 this wasn't an issue.

Right now, I'll start an app in debug mode and it will proceed to the first page with out any problems but returns a blank page after the next action, however clicking on refresh brings that page up... next page is the same and so on. The application works fine (to the point that the bugs are happening anyway) when using the regular "run on server". Any thoughts on why it is so bloody slow? Using Hibernate, struts, jsp, etc.

One thing I have noticed is that when I start it up I'm getting more then one javaw.exe and presumably the one responsible for the server is usually hitting 100+k.

any thoughts would be appreciated
[ March 29, 2006: Message edited by: Billy Bob ]
17 years ago
OK... here's my issue.

I've got a series of classes compiled by a different organization that I am attempting to build in 5.1.2 (all updates) running off of 5.0 jre... What I am getting is a "not visible" error for Calendar.getTimeInMillis() which I know was protected for some obscure reason prior to 1.4. I don't believe it was made public until like 1.4.2 or so.

My question. How is it that they could get this to compile if they were also using 5.1.2? Is there a way to use a java version higher then 1.4 in that version of websphere? can someone else out there with the same version try to compile something using that?

Help...

Thanks
18 years ago
Hey;

Having huge issues with my workspace. I've become a somewhat transient worker and in order to facilitate this I've had to place my workspace up on a server. In addition I've got slightly different versions and different products. I'm going from a 5.1.1 site developer to a 5.1.2 application developer environment. Aside from the fact that the network aspect was killing me in terms of time I'm now getting an error that I can't seem to source anywhere. This doesn't occur on all projects but of course the one it is occuring on is the one i'm trying to use.

The error I'm getting is the following. I'm trying to run a project on server and i'm getting "too many deployable objects" as the error... now this didn't occur previously nor did it occur when using site developer. Add that to the fact that it doesn't occur with some of the other projects makes me wonder wtf is going on.

Any thoughts would be appreciated...

Thanks
18 years ago
Is it possible to upgrade from Websphere Studio Site Developer 5.1.0 to 5.1.2? I am currently having JDK issues with the Calendar class, external code is calling a formerly protected method and not allowing it to compile. This code is coming to me from another agency and I know that they coded to a different version then I have access to and don't even get me started on how out of date it is. Right now I need to know emphatically whether or not I can simply download the upgrade or whether I should toss it all and have them upgrade me to RAD which I hear causes its own problems.

Help from any websphere gurus out there would be appreciated.

Thanks
18 years ago
So far, like most here I've obtained the SCJP and the SCWCD so the next logical step would be SCEA. I've picked up the Osborne Sun Certified Enterprise Architect for J2EE book but I'm having some difficulty getting into it. Other then memorizing a number of definitions there doesn't seem to be any "learning" component to it (1/2 way through ch 4). There seems to be a great deal of out dated tech and the info I've encountered so far is extremely dry.

Does this flow with other peoples experience and is it just one of those things you need to force into memory or is there something closer to a head first book that might be a more entertaining read?

I've never gotten used to the text heavy tech book and find them extremely tiring if they aren't written in an engaging manner. I'm assuming the patterns portion of the book will be more "captivating" but right at the moment its just a struggle to read through the bloody thing.

Can anyone give me an indication as to the degree of difficulty for part 1 (i.e. how does it compare to the SCWCD)? I've been developing for a while and the only concern I have is glazing over while I look at 20 definitions which will cause me to miss something.
bloody hell... i could open that file with whatever i wanted, notepad, wordpad, etc... i must have accidentally saved it as unicode when i created it... i hate stuff like that ... all i had to do was recreate that file... thanks so much for your help and time...

fyi as of struts 1.2 ActionError has been depreciated and as i understand it they will be removing it in 1.3...

thanks again so much... i was wondering why i was going crazy
18 years ago
i did get the same message before i submitted but again changing the directory and file name didn't change it... i do truly appreciate everyones time and if someone has another 15min to spare you can download a zip of the directory i'm using at www.andymellett.com/strutsTests.zip ... this has been driving me nuts for a couple of days and i'm sure its something small, mind you it could also be the tomcat version i'm using, or some config issue in there who knows... if you would care to take a look at the files and let me know what you think i'd appreciate it... do note that i haven't coded anything in the Action simply because it was the form validation using the ActionForm that i was trying out.

thanks again for your time
[ May 23, 2005: Message edited by: Billy Bob ]
18 years ago
I'm not trying to do multiple resources based on locale but it appears that the resource key that it is trying to find is en_US.validate.FirstName.incomplete when the resource that i'm calling is simply validate.FirstName.incompleteb (why is it prefacing it)... i've put it in ApplicationResources and ApplicationResources_en_US properties files, i've prefaced the key=value pairs in the resource file with en_US. to see if they'll match... i just added the locale key that you mentioned and still the same bloody error messages... this is making me absolutely nuts...

do i have to do more then simply start and stop the local tomcat server? does it have anything to do with the fact that i am using the ActionErrors GLOBAL_MESSAGE value as the key for all my values?

I've put the following in my servlet parameters in web.xml

<init-param>
<param-name>application</param-name>
<param-value>ApplicationResources</param-value>
</init-param>

This is the message resource portion of my struts-config.xml file

<message-resources parameter="ApplicationResources" null="false"/>

and the items mentioned above are in both ApplicationResources.properties and ApplicationResources_en_US.properties files in the /WEB-INF/classes directory.


********************************************************************
my ActionForm

public org.apache.struts.action.ActionErrors validate(org.apache.struts.action.ActionMapping mapping, javax.servlet.http.HttpServletRequest request) {
int confirm = 0;
com.x.validation.Validate validateThis = new com.x.validation.Validate();
org.apache.struts.action.ActionErrors messages = new org.apache.struts.action.ActionErrors();

if(request.getParameter("firstName").trim().length() == 0){
confirm += 1;
messages.add(messages.GLOBAL_MESSAGE, new org.apache.struts.action.ActionMessage("validate.FirstName.incomplete"));
}
if(request.getParameter("lastName").trim().length() == 0){
confirm += 1;
messages.add(messages.GLOBAL_MESSAGE, new org.apache.struts.action.ActionMessage("validate.LastName.incomplete"));
}
if(request.getParameter("address").trim().length() == 0){
confirm += 1;
messages.add(messages.GLOBAL_MESSAGE, new org.apache.struts.action.ActionMessage("validate.Address.incomplete"));
}
if(request.getParameter("phone").trim().length() == 0){
confirm += 1;
messages.add(messages.GLOBAL_MESSAGE, new org.apache.struts.action.ActionMessage("validate.Phone.incomplete"));
}
if(!validateThis.email(request.getParameter("email"))){
confirm += 1;
messages.add(messages.GLOBAL_MESSAGE, new org.apache.struts.action.ActionMessage("validate.Email.incomplete"));
}

if(confirm > 0){
return messages;
} else {
return null;
}

}

***********************************************************************
why can't we just state everything in a bloody java class... at least the errors would give me something to track down i'm praying for a null pointer exception right now
[ May 23, 2005: Message edited by: Billy Bob ]
18 years ago
I don't think the naming of the resource is the problem... i tried everything that was suggested but none of it's working... why is it that the resource that i am trying to access i.e. validate.Address.incomplete is prefaced by en_US when it is printed out?... is there something that has to be set in the web.xml file that i'm missing (i.e. an init parameter that specifies the existance of resources?) or is it because i am using the ActionErrors GLOBAL_MESSAGE as the key when i'm populating in the ActionForm... the following is the web.xml file that i'm using...

once again thanks for your time but i think it lies somewhere other then the naming of the resource.

******************************************************************
web.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>

<!-- Action Servlet Configuration -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>

<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>


<!-- Action Servlet Mapping -->

<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>


<!-- Struts Tag Library Descriptors -->
<taglib>
<taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-html.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
</taglib>

<taglib>
<taglib-uri>/WEB-INF/struts-form.tld</taglib-uri>
<taglib-location>/WEB-INF/struts-form.tld</taglib-location>
</taglib>


</web-app>
[ May 23, 2005: Message edited by: Billy Bob ]
18 years ago
tried it but it didn't work... actually tried a number of different things but i'm recieving the same messages at the top... any other thoughts would be appreciated.
18 years ago
After a variety of problems, starts and stops i'm now actually recieving some messages back from my action form but apparently it can't find the resources....

Please take a look at the following and let me know if you have any ideas... thanks in advance...

************************************************************************
Submit1.jsp

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
<html>
<head>
<title>Struts Number One Form</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<%@ page language="java"%>
<body>
<html:errors/>
<html:form action="/testing.do" focus="FirstName">
<table width="500" border="0" cellspacing="0" cellpadding="5">
<tr>
<td>First Name:</td>
<td><html:text property="firstName"/></td>
</tr>
<tr>
<td>Last Name:</td>
<td><html:text property="lastName"/></td>
</tr>
<tr>
<td>Address:</td>
<td><html:text property="address"/></td>
</tr>
<tr>
<td>Address 2:</td>
<td><html:text property="address2"/></td>
</tr>
<tr>
<td>City:</td>
<td><html:text property="city"/></td>
</tr>
<tr>
<td>Province/State:</td>
<td><html:text property="provState"/></td>
</tr>
<tr>
<td>Country:</td>
<td><html:text property="country"/></td>
</tr>
<tr>
<td>Postal/Zip:</td>
<td><html:text property="postalZip"/></td>
</tr>
<tr>
<td>Phone:</td>
<td><html:text property="phone"/></td>
</tr>
<tr>
<td>Email:</td>
<td><html:text property="email"/></td>
</tr>
<tr>
<td colspan="2"><html:submit value="submit"/></td>
</tr>
</table>
</html:form>
</body>
</html>


*******************************************************************
struts-config.xml

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>

<form-beans>
<form-bean name="infoForm" type="com.x.struts.InfoForm"/>
</form-beans>

<action-mappings>
<action path="/testing"
type="com.x.struts.InfoAction"
name="infoForm"
scope="request"
validate="true"
input="/Submit1.jsp">
</action>
</action-mappings>
<message-resources parameter="/WEB-INF/classes/Eng_Resources" null="false"/>
</struts-config>


******************************************************************

this is what is being printed out at the top of the form when it is returned


???en_US.validate.FirstName.incomplete???en_US.validate.Address.incomplete???en_US.validate.Phone.incomplete???en_US.validate.Email.incomplete???en_US.validate.LastName.incomplete???

*******************************************************************

I am using messages.GLOBAL_MESSAGE as the key when i add it to the action error collection (how exactly do i get those messages out on the jsp side or does html:errors do it for me?)

*******************************************************************

Eng_Resources.properties file is placed in the /WEB-INF/classes/ directory

validate.FirstName.incomplete=<LI>Please input your first name.</LI>
validate.LastName.incomplete=<LI>Please input your last name.</LI>
validate.Address.incomplete=<LI>Please input your Address.</LI>
validate.Phone.incomplete=<LI>Please input your Phone.</LI>
validate.Email.incomplete=<LI>Please input a valid email address.</LI>

********************************************************************

any thoughts would be appreciated
[ May 22, 2005: Message edited by: Billy Bob ]
18 years ago
ok... figured it out... if you are going to override validate make sure you aren't being a moron and overriding the wrong one... override the one that takes javax.servlet.http.HttpServlet as an argument. Secondly, something that really irritated me initially, your form elements must start with a lower case character and if you are using a ActionForm it will automatically try to compare parameters (introspection) by prefacing your form elements with get/set and changing your first character to uppercase... as a result make certain that you aren't thinking of that in your validate and just focus on the form element names (i didn't change them when i changed the forms)....

hope this might help someone...
18 years ago