David Chen

Ranch Hand
+ Follow
since Jan 06, 2002
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 David Chen

Thank you very much Ben, it makes scense. I'll try your way later.

Thanks a lot again
David
18 years ago
Hi, there:

I use UIManager.getDefaults().put("ComboBox.disabledForeground", Color.GRAY ) to define the fore ground color when my JComboBox is disabled. However, just noticed that if I set JComboBox Editable to be true, then, the application seems using the default disabledForeground color instead of the one I defined (ex. gray).
For example:



The above code works fine and set foregound color as gray. However, if I added the line: comboBox.setEditable(true); The application just uses default foreground color (light blue in 1.5).

Does any one know why?
Highly appreciated if any comments or hints.

Thanks a lot in advance.

David
18 years ago
I tried JK2 today, and it works for me almost immediately. I tried both Shiftomat installer application, which is so impressed, and I tried to configure JK2 step by step myself, both ways work for me just fine and almost immediately. Although JK2 is good enough for our simple application now, I still want to know if anyone get JK1.2 work with Tomcat 5.x and IIS 5. (JK2 was deprecated by Apache).

Thanks a lot in advance
David
18 years ago
Hi, there:

I have problems to integrate TomCat5.0.28 with IIS5 on Win2000. The problem seems that from Apache web site it says JK2 was deprecated ( it's weird to deprecate the higher version of product, isn't it?) and recommended to use JK1.2 ( the latest version is JK1.2.15). However, in TomCat5.0.28 server.xml it seems using JK2 by default like:
--------------------------------------------------------------------
<!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
<Connector port="8009"
enableLookups="false" redirectPort="8443" debug="0"
protocol="AJP/1.3" />
Also from log it says:
INFO: JK2: ajp13 listening on /0.0.0.0:8009
---------------------------------------------------------------------

So, my question is: how can I set up TomCat5.0.28 to use JK1.2.15? By the way did anyone get TomCat5.0.28 + JK1.2.15 + IIS 5 working? Could you please share some of your experience?

Thanks a lot in advance, highly appreciated any comments or suggestions.

David
18 years ago
Hi, there:

We are going to switch our web server from jetty to TomCat. We will run tomcat and jboss separately. I used tomcat 3.x long long time ago, and to use tomcat 3.x to lookup jboss jndi: a. copied jndi.properties to common\classes directory; b. run it with -nonaming option.
However, we are going to use TomCat 5.x, I tried the same above steps, I got exception about UserDatabase like:
2005-12-01 15:14:15 UserDatabaseRealm[Catalina]: Exception looking up UserDatabase under key UserDatabase java.lang.NullPointerException........
Checked internet there are some options to get TomCat 5.0 talk to JBoss without changing any source code:
a. someone suggest removing UserDatabaseRealm from server.xml before using -nonaming option;
b. modified catalina.bat JAVA_OPTS= Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFact
ory -........
I tried option b above, and it works fine for me. However, just wonder if any other options to set up jboss jndi resource for my web application to talk to jboss without changing my source code? Any sample example about how to create such kind of jndi resource in <Context>?

Thanks a lot in advance, highly appreciated any suggestion.

David
18 years ago
Got the answer from sun java forum, so, if interested, you can check following link to get sample code for stepped combobox:

http://www.java2s.com/ExampleCode/Swing-Components/SteppedComboBoxExample.htm
18 years ago
Hi, there:

Here is my issue on JComboBox, it seems that the drop-down list box always has the same width as input text field of a combo box. For example in my GUI requirements, I want the input text field of a combobox contains 10 characters only, however, when user clicks on the combobox, a list of choices drops down should be about 30 characters wide. Is that possible in java? if so, how to implement that kind of combobox?

Really appreciated any suggestion or comment, thanks a lot in advance.

David
18 years ago
Hi, Naveen:

It seems that you meet the same problemm I met couple days ago, please check that thread (a html:link problem):

https://coderanch.com/t/51791/Struts/html-link

hope it may help.

Thanks
David
18 years ago
Hi, Kerry:

Thank you for the reply. Yes, it seems the stylesheet can't be located by using relative path after validation.
The files structure was listed in my original post, and in my login.jsp if I use:
<link rel="stylesheet" href="config.css" type="text/css">
it works the first time login.jsp is invoked, however it can't find my stylesheet after validation found some errors. And same problem if I used:
href="./config.css"
I should use something like:
<link rel="stylesheet" href="/mywebapp/pages/config.css" type="text/css">
then works both at the first time and after validation.

my struts_config.xml looks like:

<action path="/login" type="com.xxx.actions.UserLoginAction" name="userLoginForm" input="/pages/login.jsp" validate="true">
<forward name="validUser" path="/pages/MainMenu.jsp" redirect="false" />
</action>

Greatly appreciated if any suggestion, comment, idea and helps on it.

Thanks a lot
David
18 years ago
Thank you very much Kerry for your reply. You are right, and the same as the suggestion from Ram in another thread:
both:
<a href="javascript:submitIt()">SUBMIT</a>
or
<html:link href="javascript:submitIt()">SUBMIT<html:link>
will work in my case. However it will not populate form fields if using:
<html:link action="login" onklick="javascript: submitIt()">SUBMIT</html:link>
the reason is just as you said. Thanks a lot again.

David
18 years ago
Thank you very much Ram, yes, <a href="javascript:submitForm()">SUBMIT</a> works for me.

Thanks a lot
David
18 years ago
It seems I should use absolute uri for stylesheet like:
/mywebapp/pages/stylesheet.css
then it works on both beginning and after validation. Could someone explain me why? some reasons from struts?

Thanks a lot

David
18 years ago
Hi, there:

As a newbie to struts, I have problem to access my stylesheet in my jsp file.

mywebapp
|_______pages
| |_____login.jsp
| |_____stylesheet.css
| |_____imgs
| |______logo.gif
|_______WEB-INF

so in my login.jsp I used:
href="stylesheet.css" or "./stylesheet.css" which works fine at very beginning however, after validation, it lost stylesheet uri. So, how can I use an absolute uri in my case?

Thanks a lot
David
18 years ago
Hi, Susan:

I met exactly the same problem as you posted, Did you figure out how to populate form fields values by using hyperlink? Or does anyone can please help on that?

Thanks a lot
David
18 years ago
Thank you very much Nimchi for immediately reply. It's exactly the problem. I'm so stupid to use capital 'C'. Thanks a lot again.
However, by using hyperlink instead of html:submit, now I have the problem to populate form fields.

It seems not populate the form fields at all, in myAction class I checked actionForm, all fields are null.
However, if using <html:submit /> instead, all form fields are sent correctly without any problem.
can you Nimchi, or anyone help me on that?

Thanks a lot again for your help

David
18 years ago