Derek Clarkson

Greenhorn
+ Follow
since Mar 04, 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 Derek Clarkson

Hmmm, you might want to check the server versions you are on and what JSTL and EL they support. Without checking myself, I remember reading that only the very latest spec versions support using ${test} inside the html in this manner. Previous versions of the spec do not support this and you will need to use



Instead. Check up on the JSTL tags and how to use them.
[ November 22, 2005: Message edited by: Derek Clarkson ]
18 years ago
JSP
Ok got it working. I had to figure out the validator first which I had not used before or included in any projects. What a pain. It's real good and throwing out all sorts of vague messages that make no sense at all. But to summarise, the LazyDynaBean solution in the document looks good and as stated is a drop in replacement for the standard DynaActionForm Providing you have Validator Active !. However what it doesn't state is that in order to use this solution you also have to now amend the validation.xml every time you want to create a form that can handle arrays and lists.

Personally I'm wondering if this is over kill. I won't know until I investigate the Validator a bit more and decide if it's worthwhile or just the made creation of some engineer with no real world experience. I say this because sometimes the effort required to maintain solutions which break things up this much can be worse that coding it directly. Especially as projects get larger.
18 years ago
Ahhh, the LazyDynaBean looks exactly like what I was looking for. But I cannote get it to work. I replaced my custom DynaForm with the LazyDynaBean but it keeps throwing errors at me I cannot figure out. The latest I got was after including the commons validator jar which it seemed to be looking for. Now I just get


Which means nothing to me. It's obviously something to do with the setup of the validator. But I'm not using it so I cannot see what it is looking for.

Any ideas ?

ciao
Derek

[ August 29, 2005: Message edited by: Derek Clarkson ]
[ August 29, 2005: Message edited by: Derek Clarkson ]
18 years ago
Hi all, I've been researching how to handle arrays in DynaActionForms. In other words, situations where you need an array or list to represent rows of data on the screen and most especially when you don't know how any entries will be on the page. I looked around the web and found all sorts of hacks to get around the problem that struts does not initialise the arrays. Some people advocated inserting extra actions, loading stuff into session and all sorts of things. All of which sounded problematic, labour intensive and not really addressing the problem (No insults intended).

So I had a look at the struts code and came up with the following extension to the DynaActionForm. So far I've tested it using definitions of both a String array and LinkedList in my struts-config.xml and they have worked perfectly without requiring any extra actions or code to set them up. This version of the form basically extends arrays and lists on demand as the framework loads the data. Missing entries such as indexes 4 and 5 in my sample jsp are left as nulls.

Any comments welcome. I don't think I've doubled on anyones work, but let me know as I searched for solutions like this but didn't find any.



Sample struts-config.xml:



And a sample Jsp page:



And finally a sample action:


[ August 29, 2005: Message edited by: Derek Clarkson ]
18 years ago
Hi all, I have a path containing a number of jars in various directories. I then want these same jars included in the war task. However I have not been able to successfully figure out how to convert the class path to a flattened fileset so that the jars can appear in the lib directory of my war file.

I have found the optional task <pathtofileset> and the <mapper ...> types, but I have not been able to figure out how to get a flattened filset out of them.

Anyone done this ?

Regards,
Derek
18 years ago
Sounds to me like you are confusing beans with tags. A bean is an object with a specific state. Therefore throughout your html you can get/set it's properties. Tags on the other hand are about processing data and are often used to produce beans which you can then access. Depending on what you are trying to access you might approach things in a number of ways. For example, you might get your tag to create a bean in page scope which <c:if> tags can then interrogate to decide if things should be visible. Or you might construct a tag which optionally includes it's body if the visible flag is set.

There are lots of subtle variations on the above and also ways of mixing tags and beans more closely, but you need to have a clear pciture of what you are trying to achieve first.

ciao
Derek
18 years ago
JSP
Hi all, I'm not sure if this is the right forum for this. I'm trying to upload a file containing unicode text to a Tomcat server. On my local system (windows XP, Tomcat 4.1.29) it works just file. But when I intall on a test server (Linux, tomcat 4.1.19) some of the characters in the uploads are changed. See below for an example. Can anyone explain this ??? It's got me stumped ;-(

Local Windows XP, Tomcat 4.1.29, from tomcat log. (correct)
Cleaner.showUnicode[194]: B unicode = \u0042
Cleaner.showUnicode[194]: a unicode = \u0061
Cleaner.showUnicode[194]: r unicode = \u0072
Cleaner.showUnicode[194]: r unicode = \u0072
Cleaner.showUnicode[194]: i unicode = \u0069
Cleaner.showUnicode[194]: unicode = \u0020
Cleaner.showUnicode[194]: G unicode = \u0047
Cleaner.showUnicode[194]: � unicode = \u00f2
Cleaner.showUnicode[194]: t unicode = \u0074
Cleaner.showUnicode[194]: i unicode = \u0069
Cleaner.showUnicode[194]: c unicode = \u0063
Cleaner.cleanText[170]: text = Barri G�tic

Test sever linux, Apache, Tomcat 4.1.29, from tomcat log.
Cleaner.showUnicode[194]: B unicode = \u0042
Cleaner.showUnicode[194]: a unicode = \u0061
Cleaner.showUnicode[194]: r unicode = \u0072
Cleaner.showUnicode[194]: r unicode = \u0072
Cleaner.showUnicode[194]: i unicode = \u0069
Cleaner.showUnicode[194]: unicode = \u0020
Cleaner.showUnicode[194]: G unicode = \u0047
Cleaner.showUnicode[194]: ��� unicode = \ufffd
Cleaner.showUnicode[194]: t unicode = \u0074
Cleaner.showUnicode[194]: i unicode = \u0069
Cleaner.showUnicode[194]: c unicode = \u0063
Cleaner.cleanText[170]: text = Barri G���tic
18 years ago
Hi, unfortuneately I nothing that will help, except I would advise against trying to write a converter. Years ago (and no I don't have the source), I wrote a program which would analyse PB source code and produce Javadoc style html output. At that time, the only documentors for PB produced word docs which are a waste of time for documenting source code.

The one thing I remember from that experience is that the PB source code file format is really hard to fathom. The source is undocumented within the file and there are no delimiters between different sectyions. I spent many hours making subtle changes to a project and then looking at the raw source to see what the effect was. There is a specific order that PB writes stuff into each file, but you will have to do a lot of work to figure it out and your parsers will have to approach each line of text as though it could be any part of the object in question.

Basically it's a pain and I think you would be far better off using your source PB as an inspiration for the java code. Then get together several trusted programmers and put in some hours.

Sorry.
Derek.
Oh hang it. I just re-read your question. Are you talking about querying through the data ? By this a mean taking a specific node as a parameter to the sql and them tracing back to it's root, display each node in turn. If so then there is no way to do this in a single query that I can think of.
I have done something like this before. Firstly you have to design the data so that you can return it in the order in which you need to add the nodes.
So if you have

Then you could assign a sort value which brings them back in the correct order.

You need to get the data back using the sort. Then you simply add the nodes in that order, each time adding to the appropriate parent. because the sort ensures that each node appears after it's parent, the parents will always be ready regardless of the depth.
Recently I've been looking into datalayers for several applications because our systems here use a number of datasources and we may need to switch databases. The basic concept of keeping the data access in a single and seperate layer to the business logic (BL) and only allowing the BL to interact with it via methods calls seemed like a great idea. But I have hit a couple of issues I have not been able to resolve to my satisfaction.

The first is transactions and the second is prepared statements. Generally speaking a lot of methods in a datalayer assume a single access. For example reading a single record from a table or group of tables and returning the results to the BL. But I often want to do this as part of a larger block of processing and therefore do it using a prepared statement for speed. This is an issues for a datalayer because it is completely un-aware of what the calling method is up to and therefore cannot predict whether to use a direct SQL or create, store and use a prepared statement. Even if I added a parameter to indicate the use of a prepared statement, how does the datalayer know when I've stopped using it ? And doesn't persisting the prepared statement in between calls violate the basic concepts of a datalayer and how it should work ? Plus in order to do this we must also persist the Connection that created the prepared statement.

I've toyed with some ideas and the best I've come up with so far is for the datalayer to be programmed using prepared statements by default and to create additional methods which the programmer must call after he has finished the processing so the datalayer knows it can close off the prepared statement and associated connection. However I am not happy with this approach because it is an additional method that the programmer must can for no gain to his program and therefore is likely to be regularly forgotten.

I could also shift the management of the prepared statements and connections to the BL, but that violates the purpose of the datalayer from what I can see and really makes it a waste of time.

Any thoughts ?
Derek.
Have been using the PHP based Tikiwiki here. Very feature rich with forum, polls and lots of other stuff as well. We have it working on Postgres DB, although it seems to like MySQL better.

ciao
Derek
I don't know if there is such a thing as a best way because every situation tends to be different. However I started using log4j is problems, but have switched to Jakarta Commons Logging because it self configures to the environment it it running in. For example, I have some libraries which are designed to be generic to several projects. Internally I use Commons Logging on them so that I can develope and test them without requiring log4j. However when I an running a project which uses then and has log4 as well, the Commons logging automatically detects this and uses log4j instead.

I find this lets me develop things in smaller units without extra dependancies on projects I may not wish to include.

ciao
Derek.
Hello everyone,
Had this same problem and solved it. I'm using JBuilder. I prefer to build single jars for an application which contain all the required classes so that I don't have problems with upgrades and new versions etc and don't have to worry about what be effected and what won't.

When setting up the result jar file for the application, the javamail package must be included in the jar with all classes and resources included. This is because it makes use of dynamic class loading to setup the mail providers.

However the java activation packages must be included using only known classes and resources. Telling Jbuilder to include these packages with all classes causes the signature files to be built as well.

Hope this helps.
Derek
19 years ago
Hmm, not familiar with MIDP2 in this area so take this into account with these comments.

it sounds to be like you are effectively trying to re-create some sort of a button or label which reponds to a key event. I have built a cutom API for the company I work for based around MIDP1. I worked with a series of custom classes which are added to a canvas and the canvas then notifies them of events which are appropriate for them.

During this process I've built two different versions of a button. The first one is assigned a specific game key code during setup. this is registeed with the form when the button is added to it. When the user releases this specific button, the form tells the button which in turn tells all listeners which have registered with it. The listener class is ones I have written which simply has a single click(MyButton myButton) method.

The other method I have used is to have my form track the control which has focus. This is usually highlighted to the user. Thus when the user releases a button the event is automatically sent to the control which currently has focus, triggering the listeners again, etc. The form of course has code in it for asking the controls if they will allow focus to shift in a specific direction and then shifting it to the next control.

As far as the interaction modes are concerned. From my reading of the doco, I would suggest this is a way for the system to tell a control what sort of internactions it supports and that this is only necessary in some circumstances where you somehow want to make use of system based prompts, etc. If you are wanting to load your own custom screen in response to a click type event, I would simply just use the button release event to do a setCurrent() to set the new screen. I cannot see from my reading why you would need to worry about interaction modes.

ciao
Derek.
19 years ago