Horatio Westock

Ranch Hand
+ Follow
since Feb 23, 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 Horatio Westock

Well, as long as you don't mind passing around a byte array, you can skip the base64 encoding/decoding. You just need to alter those methods slightly to accept as a parameter/return a byte[].

Just depends upon how you want to use the data you are working with. For example, writing to an XML file you might want it base64 encoded, passing to another method or somesuch then a byte[] would be fine.
18 years ago
Hi!

It looks like you might not have you CLASSPATH correct. Try reading this article about how to set the classpath.
18 years ago
Hi!

Could you post the actual code you have compiled and tested? The code you have here has syntax errors.

If you use the CODE button at the bottom and paste your code between the tags, all of the indentation will be kept - which helps in debugging.

Ta.


18 years ago
You could create a servlet to stream the blob data.

e.g. http://yoursite/fileservlet?id=5

Then have that as the source of your iframe. Basically the servlet implementation would simply query for the blob then direct the stream from the backend to the servlet output stream. If you search the web for "jsp image blob" or something similar, you should be able to find some sample code. Remember also to consider things like content-type and cache headers.

Alternatively I think there are probably some taglibs to help with this, but personally I prefer option 1.
18 years ago
This isn't really a struts specific problem. I can think of two approaches:

1. Prepare your data as two collections, one for each table. Display your data as normal and have a radio button which corresponds to each row. When the >> button is clicked, the form is submitted and you have an appropriate action which moves the data associated the radio button to the other collection. Then forward/redirect back to your display jsp (assuming you are using jsp).

2. Use javascript to alter the html of the page when the button is clicked.

The approach you take really depends upon whether you want to have a round trip to the server each time the button is clicked, whether the client is likely to have javascript enabled etc. etc. etc.
18 years ago
Hi!

There are vendor extensions for this, but unfortunately there isn't much consistency.

In Postgres (and MySQL IIRC) for example:


Would get you the top 10 from the resulting rows. In addition, you can add a second parameter to say which row to start with (offset):



In Access I believe you can do the following (note that I've never tried it):



However, getting a range is a little more complicated. One possibility is that you get, say, the top 100, then get the last 10 of those, in order to get results 90-100.



Ugly!

There are probably other approaches out there. Try searching for 'paging results' or similar, as it's essentially the same problem.

Hope this helps!
You may have solved this differently, but if I understand you problem, you could use something along the lines of:



Hope this helps (someone!)
Great! I received Head First Java over the weekend, and had a missed delivery note, which I presume was the other one.

Apologies for not contributing much round here recently. I just bought a flat, and now have two jobs: one java, one DIY. There just isn't enough time in the day! :-(

Thanks for the hard work sorting this out!
18 years ago
The simple answer is, look at java.text.SimpleDateFormat. It has parse and format methods which are handy for doing this sort of thing.
18 years ago
OK, there are a few problems here.

First thing I would say is try to use the normal naming conventions for variables. i.e. start with lower case.

The second main problem I see is with your DownRow method. You try currentRow.addElement(DisplayResults). DisplayResults is a ResultSet. I'm pretty sure you don't want to add the ResultSet to the vector, rather you want to add some information from the database rows in the result set. The result set will contain entries for each row returned by your query. You have to access this information using methods like getInt("columnName") to retrieve data for a column, and next() to advance to the next row returned by the database.

Rather than re-write your problem. I've written a simple example, which hopefully you can work from:

If you are interested, there is a bi-directional map interface (and implementations) in the Jakarta Commons package, called BidiMap. There are also associated OrderedBidiMap, SortedBidiMap etc.
18 years ago
You could also look at Java Desktop Integration Components. I've never tried it, but it appears to have functionality for opening files with the registered application. Great if you don't know if the user has Word or OpenOffice.

JDIC
18 years ago