Ross Hendry

Greenhorn
+ Follow
since May 03, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ross Hendry

Originally posted by Ben Souther:
What do you mean by this?
There is only one JSP that shows this?



Yes. The breadcrumb trail is only used in one place.

At least, it was at time of posting. The customer's wanting it in a couple of other places now so I'll be writing that bean for reusability.
17 years ago
JSP
If you're having Javascript problems in Firefox then install Firebug (http://www.getfirebug.com). It's an incredibly useful bit of software.
I've got a tree-like data structure which I'm displaying on a web page. As the user navigates through a breadcrumb trail is left behind to let them retrace their steps.

e.g. Root / First Group / Second Group / Third Group (where the groups are links back up)

At the moment the function to create the links is in the jsp. It's only used in one place so this seemed the pragmatic option though I'm not sure if it's "correct". I realise it wouldn't make any sense to put it in the entity itself but would a static class that generates the links, callable from the jsp make more sense?

Just curious about people's opinions and experiences on this one.
17 years ago
JSP
Solved by changing the relationship to a @ManyToMany like it should be. Doh!
Quick situation overview - I've got an entity called a PartHolderNode which has a collection of entities called RepositoryItems. I'm trying to add an existing RepositoryItem into an existing PartHolderNode's collection. Instead of a slightly bigger collection, I get an exception stating "Unable to commit". The mapping seems to be correct based on the fact that if I add a new (not persisted) RepositoryItem to a collection and call merge it persists to the database as expected.

Detail -

Inside a stateless controller bean for PartHolderNodes I had the following method -


manager.persist() has also been tried as manager.merge().

Unfortunately, this results in the following -


The JBoss logs show that it has executed an update to the join table between the two entities, but when it attempts to "close PreparedStatement" it throws the JDBCException stating "Could not execute JDBC batch update".

Surely adding an element to a collection and saving the change to the db should be straightforward? What have I missed this time?!


The relationship between PHN and RIs is mapped as follows -



and the addFile(foo) method in the controller bean just consists of files.add(foo.)

If you need any more detail just let me know.
[ May 17, 2007: Message edited by: Ross Hendry ]
I've just moved from Fedora Core to Ubuntu and after only a few days I've come across a few good and bad points about Ubuntu.

Good - It works. Soundcard, network card, volume controls on my laptop, suspend/hibernate, everything seems to work right just out of the box. Installation was a breeze and installing software is nice and easy (not that yum on Fedora isn't).

Bad - On a personal preference level, it's set up differently which confuses me after many years of RH based distros. Bash preferences are different and I haven't figured out how to get everything how I like it yet. My ATI video card didn't work at the proper resolution straight out the box though I did find a howto in about ten minutes. Getting encrypted DVD playback was a bit more convoluted than FC, though it was really just a question of which packages to tell it to install. Small nitpick - the /etc/fstab is set up in such a way that it's peppered with entries making "df -h" or other such tools less easy to use.

Okay, the bad paragraph is bigger, but they're all irritations rather than show stoppers. Also, I've got ~7 years of RH based bias!
17 years ago
Tag files did it! Time to order a more up-to-date book.

I was trying to pass the entity to a fragment to output some html. I'd tried passing it directly instead of copying to another container but hadn't managed that as, IIRC, the tags would only allow a string value to be passed.

Two minutes after reading your post this morning I had converted the fragment to a tag file and got it working precisely how I'd intended. Many thanks.
17 years ago
JSP
Greetings all, I'm a JSP newbie so I'm hoping someone can point out where I'm going wrong here and give me a helping hand.

The situation is that I'm iterating through a collection of objects and outputting html accordingly. The problem is that I'm using a <jsp:useBean> to pass the object to an included file and so I'm only getting to see the first element of the collection.

Code will help. The iterating code -



(which seems horribly ugly now that I'm showing it to people!)

and the included file -



I think I'm getting the same output each time because after the first iteration the bean is instantiated and so useBean doesn't create a new one, no? I know I can't use a nested param tag because they're only for string parameters.

So am I into custom tag territory? That seems overkill for just writing a bit of text. I also don't want to inline the markup from the included file as that defeats the purpose of separating it out in the first place.

Can't help but feel I'm missing something straightforward with this one. Any pointers gratefully received.
[ May 03, 2007: Message edited by: Ross Hendry ]
17 years ago
JSP