Klaus Jesper

Greenhorn
+ Follow
since Jan 20, 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 Klaus Jesper

Thanks for all answers!

@Stan: My orderNo is of type int.

@all: I'm sorry, but indeed it has been a stupid copy&paste-mistake by me.

In the line that should be

I actually didn't check for class Test2 but for another class. So I always got 1 as returnValue because the if-statement has been always true.

Thanks again for your great suport!

Klaus
19 years ago
Sorry for my inaccuracy. "C: The program runs but the ordering is incorrect" is the problem the occurs.

The correct code is:



What I want to do is to sort a set of Test2-objects by using the compareTo-method of the associated Test1-object.
[ January 31, 2005: Message edited by: Klaus Jesper ]
19 years ago
Hm, why should anyone first declare an integer value and than change it without accessing a method or anything else? Makes no sense I guess? Please tell me what you want to achieve.

Klaus
19 years ago
Hi, I have a problem to with sorting some elements.

I have a class Test1 which implements Comparable and so has as compareTo-method:



Next I have class Test2, that has a relation to Test1. Every Test2 has one associated Test1. To order a set of Test2-objects I want to use the associated Test1-objects (by comparing them throw compareTo()).



Now I want to order a Set of Test2 with the help of their associated Test1-class. But it doesn't work:



Any ideas what I'm doing wrong?

Klaus
[ January 30, 2005: Message edited by: Klaus Jesper ]
19 years ago
Thank you very much!

Klaus
19 years ago
Try to move your jar-file with the mysql-jdbc-driver to a different directory, so that the path to the jar has no spaces. Let me know if it works now..

Klaus
19 years ago
Noticed, I will change the key/value-thing because it will confuse other people that work with my code.. Thanks for pointing that out.
I've just noticed that I don't have to play the key/value-game anymore, because the language-dependance problem is solved with the bean:message-part...

I didn't mention before that I want to have a different background-color for every option. Ok, I don't know how to do this right now, but I think I have to assign a css-class to every option (depending on the value) or something like that. Well, that's the reason for avoiding the optionsCollection-tag.

Thanks again,
Klaus
[ January 29, 2005: Message edited by: Klaus Jesper ]
19 years ago
Ok, yor code is working.
But I have the problem, that I have to separate the "value" which is shown in the jsp (and depends on the current language) and the "label" to save in the db (that is not language-dependend).

But inspirated by your code I finally got it working:



Thanks, Klaus
[ January 28, 2005: Message edited by: Klaus Jesper ]
19 years ago
Just to be sure: Did you configure your action-mapping in struts-config.xml to use the validation with validate="true"?

Klaus
19 years ago
Hallo,

I've a problem using the <select>-Tag with a pre-selected value.

Iterating through the different levels of my nested beans works great (with nested-tags). But I can't get my selection-box to pre-select a value. I know that I have to use "value=" to tell the jsp which item in the box should be selected, but I can't manage to get the correct item selected.



The available options for this <select> are stored in "ratings" in my testForm. Populating the <select> with these values works as expected. The "value=" I want to be selected is saved in tasteRating in test1.test2.toDoBean in a String-attribute named "rating". The <nested:message>-tag above gives me the value I want. Do I have to use this el-thing like ${xxx} or just the name of the property?

How can I make this working?

Klaus
[ January 27, 2005: Message edited by: Klaus Jesper ]
19 years ago
Thanks for your answers!

I'll take a close look on the page suggested by Jason today and than try this whole nested-thing.

Klaus
[ January 22, 2005: Message edited by: Klaus Jesper ]
19 years ago
Try using this in your jsp:

<html:messages property="passwordconfirm" message="false" id="pwConfirm" >
<bean:write name="pwConfirm"/>
</html:messages>

This article could help:
http://www.oracle.com/technology/oramag/oracle/04-jan/o14dev_struts.html

Klaus
19 years ago
Just an example, should work:

<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="com.mysql.jdbc.Driver" />
<set-property property="url" value="jdbc:mysql://localhost:3306/testDB" />
<set-property property="username" value="testuser"/>
<set-property property="password" value="testPW" />
</data-source>
</data-sources>

Maybe this would help, too:
http://struts.apache.org/faqs/database.html

Klaus
19 years ago
Hallo,
I have a little problem when using complex forms with struts.

I have a form with is a quite complex table. To populate it, I use some nested Beans (Bean1 has a collection of Bean2, Bean2 has a collection of Bean3, Bean3 has a collection...). Each Bean has a name (simplified!) and a collection of a "sub-Bean".
In the jsp I access the data with:



The example above deals with <bean:write> but I need to use <html:text> to make the data changeable. Should be no big deal so far (with a little help of struts-el/jstl).

But how could I submit changed values? The form expects a getter/setter method for each value(?). How should it look for example for getting data from test3_id.name into my form?

Maybe I am on the wrong way with my nested Beans? Would be nice to have some comments on that..

Klaus
19 years ago