General discussion
-
CreatorTopic
-
March 5, 2003 at 2:41 am #2300723
Java Forum
Lockedby maryweilage · about 21 years ago
Welcome to the Java Forum. This is the place to post your Java questions, share your best techniques, develop your coding skills, and express your opinion on topics that impact IT development.
We also encourage you to post your comments about the Java TechMail.
If you haven’t subscribed to the Java TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:
http://builder.com.com/techmails.jhtml?repID=u001Topic is locked -
CreatorTopic
All Comments
-
AuthorReplies
-
-
March 5, 2003 at 2:48 am #3396465
Java TechMail
by maryweilage · about 21 years ago
In reply to Java Forum
Use inheritance to improve your Struts applications
The Mar. 6, 2003, Java TechMail discusses the use of a base action class to better implement Struts. Do you use Struts in your application development? Will this tip help improve your use of Struts?
This discussion question was derived from a Java TechMail. If you would like to receive Builder.com Java e-newsletters in your inbox twice a week, visit our e-newsletter subscription center to subscribe today:
http://builder.com.com/techmails.jhtml?repID=u001-
March 5, 2003 at 10:40 pm #3392662
Base action and dispatching
by thedew · about 21 years ago
In reply to Java TechMail
A base action class is definately useful when all of your actions depend on the execute method, but what happens when many of your actions are doing dispatched execution?
The problem I run across is that my action classes define their own methods to call in their keyMethod map, so its base class would have no idea what method will be executed and nothing guarantees that the base action’s execute method will ever be called.
Any suggestions for creating a useful base action class in this case?
-
March 6, 2003 at 5:40 pm #3395365
Re: Base action and dispatching
by muzammil786 · about 21 years ago
In reply to Base action and dispatching
The important point is that you declare one abstract method in Base class which is to be implemented in all child action classes. Now if your action class needs to call other different methods, thus invoke all such methods in implemented abstruct method. Your Base class is not to check what business logic is implemented in child classes
-
March 10, 2003 at 2:34 am #3395726
Re: Base action and dispatching
by reassembler · about 21 years ago
In reply to Re: Base action and dispatching
i’m with shabaz. your abstract class should always call the one method that your subclass must define. if you want to map method calls, do it in the subclass. if your subclass does not override the struts action method, the your base classes method will always be called.
hope i’m not missing your point. let me know. if you have a code example you could send, that might clear things up.
dave
-
March 11, 2003 at 2:43 am #3395870
LookupDispatchAction
by thedew · about 21 years ago
In reply to Re: Base action and dispatching
This is a good idea to me, but I don’t see how you could implement this using the structure provided by LookupDispatchAction (see http://jakarta.apache.org/struts/api/org/apache/struts/actions/LookupDispatchAction.html) because it’s not my subclass’s implemented abstract method that determines which method to call but this LookupDispatchAction’s execute method.
Right now all my Action classes extend this base class:
——————————————
public abstract class ActionBase extends
LookupDispatchAction {protected Map getKeyMethodMap() {
return null;
}public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {// if there is no dispatch map, return the
// default execute method
if (getKeyMethodMap() == null) {
//DO USEFUL STUFF
return defaultExecute(mapping, form,
request, response);
} else {
return super.execute(mapping, form,
request, response);
}
}public abstract ActionForward defaultExecute
(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception;
}
—————————————
The only problem is defaultExecute only gets called when there is no dispatch map.
-
-
March 6, 2003 at 2:07 pm #3395427
Do not use abstract classes for logging
by johnzoet · about 21 years ago
In reply to Java TechMail
The email suggests to use an abstract base class for logging purposes.
I definitely do not recommend this method.
It is far better to centralize logging in a filter servlet.
That way you do not mix administrative and business logic.
The filter servlet can be changed independently from the base class which avoids possible problems in the production environment.-
March 10, 2003 at 2:28 am #3395727
re: Do not use abstract classes for log
by reassembler · about 21 years ago
In reply to Do not use abstract classes for logging
centralizing logging is definitely a good idea. i suggest using log4j’s socket server and socket appender (wrong names, i’m sure), rather than writing a servlet to do it. there’s also a buzz about using jms to centralize logging, but i’ve haven’t tried that yet.
-
-
-
March 7, 2003 at 12:27 am #3395242
Java TechMail: BigInteger
by maryweilage · about 21 years ago
In reply to Java Forum
The Mar. 10, 2003, Java e-newsletter, discusses how to manipulate large bits with the BigInteger class. BigInteger allows you to manipulate numbers with more than 64 bits.
Have you used BigInteger? If so, tell us what your experience was like.
-
March 11, 2003 at 10:27 pm #3396524
Build apps easier with the Ant tool
by Mark W. Kaelin · about 21 years ago
In reply to Java Forum
Make mundane dev tasks easier with Ant:
The March 13, Java TechMail discusses Ant as a Java build tool. Do you use Ant to build your Java applications? If not, what tools do you use? Why?
If you haven’t subscribed to the Java TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:
-
March 12, 2003 at 7:40 pm #3395077
A Bad Experience with Ant
by avia · about 21 years ago
In reply to Build apps easier with the Ant tool
Granted, I haven’t looked at the latest version of “ant” — I tried using versions 1.1, 1.2 and 1.3 (I think) and had a _bad_ experience. The documentation was terrible (in my opinion), backward compatibility was non-existent, there is no DTD (or schema or whatever) for the XML build files — since they’re not valid XML files, anyway — and “ant” will happily print out “Build Successful”, when it wasn’t!
[Of-course, when it fails, and “ant” succeeds in figuring out it failed, it prints out, “there should have been error messages” — that doesn’t really assure me of the author’s confidence in the tool!]On the opening page of the “ant” Web site, they talk about cross-platform (i.e. non-UNIX) portability being an advantage of using “ant”, but with linux and cygwin and the new MacOS, how many non-UNIX platforms are there?
So PLEASE convince me that “ant” is good!
Avi.
-
March 31, 2003 at 11:20 am #3458360
Reply To: Java Forum
by suneeshvr · about 21 years ago
In reply to A Bad Experience with Ant
Ant is really cool . I can update the files from my CVS and compile and place appropriately in my working environment .I can also create javadocs. And there are alot .please search in the net
-
-
-
March 12, 2003 at 3:09 am #3397080
Java on my browser
by aballew2002 · about 21 years ago
In reply to Java Forum
Everytime I try and do any activity on by computer, I have error messages that come up concerning Java. I know nothing about it. I thought maybe there was software I needed that I didn’t have. When I pull up web pages, sometimes I get pictures, sometimes I don’t. If I don’t, I get a white box with an ‘X’ in it. Please help!
-
March 19, 2003 at 6:43 pm #3458090
Java on my Browser
by caloizky · about 21 years ago
In reply to Java on my browser
Dude, it would help if you tell us a little about your environment. Like say, what operating system, browser and what error do you see? Dig?
-
-
March 13, 2003 at 11:10 pm #3456288
Use Beans class to test object type
by Mark W. Kaelin · about 21 years ago
In reply to Java Forum
Test for object type with isInstanceOf():
The March 17, Java TechMail discusses using the java.Beans class to test for object type. Have you used the isInstanceOf() method to text for object type in your Java applications?
If you haven’t subscribed to the Java TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:
-
March 18, 2003 at 10:46 pm #3390842
Decompile Java class files
by Mark W. Kaelin · about 21 years ago
In reply to Java Forum
Retrieve lost source code:
The March 20, Java TechMail discusses the Java Decompiler (JAD). Have you used a decompiler to recover Java source code? Which compiler did you use? Tell us what you liked and disliked about it.
If you haven’t subscribed to the Java TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:
-
March 19, 2003 at 6:39 pm #3458091
Bad to Decompile
by caloizky · about 21 years ago
In reply to Decompile Java class files
I still think that people shouldn’t decompile programs. It’s just another form of piracy. Sure, it’s fun to know how things works, but how would you feel if somebody starts poking around your trade secrets? I guess people who decompile’s other person’s programs are just people that can’t make a program. Dig?
-
March 20, 2003 at 10:58 pm #3536500
Let’s explore that question
by Mark W. Kaelin · about 21 years ago
In reply to Bad to Decompile
That is an interesting point.
Are there no legitimate uses for decompiling classes? The associated TechMail indicated a few reasons for decompiling, including backup failures. But I wonder if decompiling is practical for those circumstances?I’d like to hear some more opinions on this.
-
April 13, 2003 at 10:41 pm #3525521
Reality is not so simple
by java guru · about 20 years, 11 months ago
In reply to Bad to Decompile
You are taking the point of view of the vendor. That is great, because that is exactly why customers MUST be able to decompile code when no source is provided.
When you are just one customer, your problems are not always the vendor’s highest priority. Sometimes it helps to be able to tell the vendor exactly where their problem is. They have much more time to fix a problem when the solution is known than it is to research a hard-to-duplicate problem.
As an example, when I worked at TechRepublic, there were several instances where we were pushing our vendor’s product harder than any other customer. However, we were not the largest customer that they had. In the beginning, 80% of the vendor’s patches were in response to problems that we encountered before any of their other customers.
It proves so much easier to get a vendor to fix a problem when you can say in this class/method, this condition is possible.
They may not like you snooping in their code, but you are payingthem for a service and you are helping them provide a higher level of service.
-
April 18, 2003 at 3:58 am #3533954
I am in 100% agreement
by kingjr3 · about 20 years, 11 months ago
In reply to Reality is not so simple
I agree totally with Java Guru.
We have a product that doesn’t scale well, and not know the internal workings of the EJBs I decided to decompile and “help” them along in researching the problems.
To date, we haven’t found anything that cures our problems, however, we did find many inefficiencies that could be addressed. Without my assistance, the vendor wouldn’t even know about these issues.
caloizky, your comment about decompiling is so narrow minded, that I question your experience in the Java world.
-
-
-
March 20, 2003 at 10:50 pm #3457264
Automate code generation with XDoclet
by Mark W. Kaelin · about 21 years ago
In reply to Java Forum
Let XDoclet write your stub classes:
The March 24, Java TechMail discusses automated code generation with XDoclet. Have you used XDoclet to write your stub classes? Have you used a different tool for this purpose? Share your opinion on the best productivity tool for automated Java code generation.
If you haven’t subscribed to the Java TechMail, there is no better time to take advantage of our free e-newsletter. Visit our e-newsletter subscription center to subscribe to this valuable TechMail today:
-
March 26, 2003 at 9:06 pm #3394764
Shutdown Hook
by jay_shree · about 21 years ago
In reply to Java Forum
I have added a shutdown hook in my application to perform some clean up actions while shutting down my application.I find that the shutdown hook is not being called when users shutdown the application by doing a CTRL_C.It is working fine when they do a CTRL_ALT_DEL.Is there any workaround for this?
Thanks in advance. -
March 31, 2003 at 11:05 am #3458369
Listings A and B Swapped
by avia · about 21 years ago
In reply to Java Forum
It looks to me like the hyperlink for listing A (in the article) has been swapped with the hyperlink for listing B. In other words, when I click on the hyperlink for listing B, it shows the code for the “MemoryBlock” class, but the article text refers to listing A as containing that code, whereas the hyperlink for listing A shows the sample application code while the article text indicates that listing B contains that code.
Thankyou (in advance for sorting that out :-),
Avi. -
May 15, 2003 at 7:40 am #3532880
A Request not a reply
by frank · about 20 years, 10 months ago
In reply to Java Forum
I am looking for a script to build an Affordability Calculator. Can anyone help me locate one. I play around with JAVA but I am no expert. As a small business just starting up, any help I can get would be appreciated
-
May 28, 2003 at 7:25 pm #3361502
JavaScript calculator
by virbc · about 20 years, 10 months ago
In reply to A Request not a reply
You can try using javascript (http://javascript.internet.com) instead of java. Do a search for calculator, you might find one that has the features/functions you have in mind. If not, choose the closest then modify to suit your needs.
-
-
June 12, 2003 at 11:40 pm #3516616
Application framework options
by maryweilage · about 20 years, 9 months ago
In reply to Java Forum
The June 16 edition of the Java e-newsletters details the pros and cons of using existing application frameworks.
Three options the author mentions are the Eclipse platform, NetBeans, and JLense. For more information on these platforms, please visit the following URLs.
Eclipse
http://www.eclipse.org/NetBeans
http://www.netbeans.org/ -
June 18, 2003 at 12:29 am #3354425
Capture network packets with Jpcap
by maryweilage · about 20 years, 9 months ago
In reply to Java Forum
The June 19 edition of the Java e-newsletter described how Jpcap allows you to capture network packets. For more information about Jpcap, please visit the following links.
JpcapDumper: http://netresearch.ics.uci.edu/kfujii/jpcapdumper/doc/index.html
* Please delete any extra spaces that appear in URLs after you copy and paste them into your browser.
-
June 19, 2003 at 8:57 am #3353755
Did you get Java example working ?
by johnzoet · about 20 years, 9 months ago
In reply to Capture network packets with Jpcap
Did anybody get the Java example from builder.com working ?
I downloaded the JPCAP from SourceForce.
To my surprise I could not find these imports:
import jpcap.JpcapHandler;
import jpcap.Jpcap;
import jpcap.Packet;I searched all JAR files in folder jars and thirdParty.
-
-
July 21, 2003 at 5:42 am #3607219
7/10/03 TechMail: When initialized isn’t
by reuben · about 20 years, 8 months ago
In reply to Java Forum
The July 10 Java Tech Newsletter featured the article:
“Don’t call overrideable methods from constructors, When initialized isn’t”I thought this was a very interesting article that illustrates an important mistake people can easily make, especilly if they come from a C++ background, where constructors always call methods of the same class, even if they are overridden. But I’d like to offer a suggestion that would have made the article a bit more helpful. The article concluded:
“What’s the lesson? Don’t call overrideable methods from constructors. … Save yourself a lot of time and effort by following the simple rule of not calling overrideable methods from constructors.”
But the article did not mention how to ensure that methods are not overrideable. The correct solution is to mark any methods called from the constructor as ‘final’.
-Reuben Fisher
-
July 23, 2003 at 11:23 pm #3386331
i can’t recommend that
by reassembler · about 20 years, 8 months ago
In reply to 7/10/03 TechMail: When initialized isn’t
thanks for the catch. i should have mentioned how to make methods final.
i can’t recommend automatically making all methods final because i believe that behaviour as well as attributes should be overrideable by default. though i might be persuaded to go this route if anyone has other good reasons for declaring all methods final by default?
thanks
-
-
-
AuthorReplies