java

Request in src attribute of <img> tag is not processing

Hi All : I have a request which contains parameters and response will give barcode image. We are using Comergent frame work. <img src="../direct/bestbuy?cmd=BBFBGenerateBarCode&type=code128&msg=12345&fmt=JPEG&height=10&hrsize=5pt" alt="Barcode" width="166" height="44"> The above will go the controller "BBFBGenerateBarCode" and execut...

Java Optimizations

Hi, I am wondering if there is any performance differences between String s = someObject.toString(); System.out.println(s); and System.out.println(someObject.toString()); Looking at the generated bytecode, it seems to have differences. Is the JVM able to optimize this bytecode at runtime to have both solutions providing same perfor...

What is the technical name of the syntactic feature "long foo = 12L;" style casting of harded-coded values in Java?

Today, I was trying to cast a hard-coded value into a short and S did not work. So, I went to search for it, but I realized that I do not even know what this feature of Java's syntax is called. Is there a name for it? If not, is there at least a list of all of the possible ways to cast hard-coded numeric values? Epilouge After getting ...

String.format with lazy evaluation

I need something similar to String.format(...) method, but with lazy evaluation. This lazyFormat method should return some object whose toString() method would then evaluate the format pattern. I suspect that somebody has already done this. Is this available in any libararies? I want to replace this (logger is log4j instance): if(lo...

How do set request parameter value while calling java method?

Hi All : I need to call a method of java class from jsp page.. While calling that in jsp page, need to set some request parameters also. How do i do that in jsp page? Ex : Java class : public void execute() { string msg = request.getParameter("text"); } JSP file : I need to call the method here and also need to set paramete...

Can I make one maven profile activate another ?

I have 2 maven2 profiles, selenium and jspc. Now for "selenium" id'd like to have an implicit activation of "jspc", so that I don't have to write mvn -Pselenium,jspc from the command line. Is this possible ? ...

How to store into database table two java.sql.Date s, when they are truncated ?

Hello. I want to store into the same table, in different columns 2 java.sql.Date objects to their corresponding SQL Datetime. It works fine, but the hour, minute and seconds are truncated. That's documented in the javadoc. For instance having the date: 5/30/2009 14:33:21 AM when inserted in table it is truncated to 5/30/2009 12:00:00 A...

How can I use Spring XML configuration to set a bean property with list of all beans of a certain type?

I have the following XML configuration: <bean id="bean1" class="Simple"/> <bean id="bean2" class="Simple"/> <bean id="tasks" class="java.util.ArrayList"> <constructor-arg> <list> <ref bean="bean1" /> <ref bean="bean2" /> </list> </constructor-arg> </bean> <bean id="list" ...

Is MVC from Microsoft the new Struts for Dot net ?

I have not used MVC but am merely wondering as a Java person, hence the q. ...

How do I configure an OSGi environment so that it is possible to use it from the EclipseStarter class?

Hi there! Currently I'm trying to execute some bundles using the capabilities of the EclipseStarter class. If I run my program directly from Eclipse the OSGi service bundle is loaded and I'm able to install and start other bundles. But if I export my java program to a executable jar-file and run it from the command line the environment...

How can I customise the appearance of a JComboBox?

I'd like to make a drop-down list that looks like this: JComboBox provides the functionality I need, so I shouldn't need to write a custom component. But I can't find a way to customise the entire appearance of a JComboBox to achieve this. Any suggestions? Update: I don't want all JComboBoxes to look like this. I only want to create ...

Detect PKCS#11 token to be inserted/removed in JAVA

I'm using a PKCS#11 usb device to create a SSLContext. The project is migrating from an IAIK jce implementation to sun's, iaik provide a tokenmanager to detect when the token is removed, inserted, could not find a way to do this with sun implementation. Any ideas? ...

How to display an image which is in bytes to jsp page using html tags?

Hi All : I have ByteArrayOutputStream which contains a jpeg image in bytes. My requirement is to display that image in jsp page(to display the image in front end using html tags). How do i do that?. I have refrred BufferedImage class but it confusing for me because i am new to this.. Please help me.. Thanks in advance. ...

Variables in jsp pages with "included" pages.

What are the scoping rules for variables in a jsp page with pages added to them using tags? My understanding is that an included page is essentially copied verbatum into the page, which would lead me to assume that if I've declared a variable in a Parent jsp that it would be available in the child ones. However Eclipse complains about...

Packaging Jar

Hi, It has been a frustrating day trying to package multiple plugins and their property files into an executable jar. How to I package these plugins into a single jar, leaving the properties files outside: - pluginA with pluginA.properties - pluginB with pluginB.properties - pluginC that requires pluginA and pluginB The property files...

How to write efficient Java code?

As all of you may know, Java code is compiled and interpreted by JVMs. My questions deal with optimization: Is it optimized at run-time by the JVM only or also at compile-time? In order to write efficient code, where can I find the list of supported optimizations? Or are JVM optimizations powerful enough so that I just have to write co...

How to config QueryCache in ehcache.xml

From my sql log file, I think the QueryCache's physical properties are configured by the element: <defaultCache maxElementsInMemory="0" eternal="false" timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="false" memoryStoreEvicti...

Embed a web browser within a java application

how can i embed a web browser within a java application? Thanks, David ...

How can I hide (make invisible) row in JTable?

Is there any way to do it? ...

Interesting subjects for very experienced developers (Java)

I was asked to mail a weekly "interesting subject" to my fellow developers (all very experienced) - a short summary (2-3 paragraphs), some "how is this relevant to us" information, and a link or two for further reading. Now, as I've said before, these are very experienced people - some more than me. I was thinking along lines of "why no...