Server-Side Development Section Index | Page 2
How to implement an entity bean which the PrimaryKey is an autonumeric field
The EJB 2 Spec (10.8.3 - Special case: Unknown primary key class) says that in cases where the PrimaryKeys are generated automatically by the underlying database, the bean provider must declare th...more
I have a problem with the LocateRegistry.createRegistry(int port) method.
I have a problem with the LocateRegistry.createRegistry(int port) method.
The registry starts of fine with no problem with the first passed port number but later if I try to start the registry aga...more
How do I transfer a text file from server to client? I am trying to transfer a text file from server to client using File objects. but i am not getting success. so how can we transfer a text file without going into the Socket programming and streams.
How do I transfer a text file from server to client?
I am trying to transfer a text file from server to client using File objects. but i am not getting success. so how can we transfer a text file ...more
Why do I get the error. org.xml.sax.SAXParseException : Element type "web-app" must be declared. when starting my web application? It has a web-app element already!
Why do I get the error
org.xml.sax.SAXParseException : Element type "web-app" must be declared
when starting my web application? It has a web-app element already!
What is the meaning of marshalling and unmarshalling?
Omar,
In few words, "marshalling" refers to the process of converting the data or the objects inbto a byte-stream, and "unmarshalling" is the reverse process of converting the byte-stream beack to...more
How can we hide the html source code when the user tries to view the source code from the browser's "view source" file menu option?
[Short answer: no, it's not possible, since the source code *is* the response. If the user wants to see your source, he can. However, here's a clever hack... -A]
Yes it's possible, I've done it...more
How to read a file from the WAR or webapp? If I have a configuration file, say an XML file, stored inside the WAR, how do I open it from a servlet?
How to read a file from the WAR or webapp?
If I have a configuration file, say an XML file, stored inside the WAR, how do I open it from a servlet? I.e., InputStream in = new FileInputStream(????);
more
How can I use JUnit to test J2EE/EJB applications?
Check out Jeff Schnitzer's JUnitEE package and the
Wiki EJB Unit Testing page.
Can I force the browser to save a downloaded file with a name I specify, rather than the name of the URL?
Assuming that you want to save the file as "myFile.txt" you have to set the Content-Disposition response Header as follows :
response.setHeader("Content-Disposition", "a...more
What causes an "javax.activation.UnsupportedDataTypeException: no object DCH for MIME type xxx/xxxx javax.mail.MessagingException: IOException while sending message;" to be sent and how do I fix this? [This happens for known MIME types like text/html.]
The Java Activation Framework used by JavaMail is not configured correctly.
It doesn't know how to handle the text/html content type.
An html handler is provided in JavaMail 1.1.3 but the mailc...more
I am using ResultSetMetaData.getColumnLabel() to create headers for a table. I have specified column labels on the table ( DB2 on an AS/400, ) which show up when I run an SQL statement directly over the table, but the method returns the same data as getColumnName(). Any ideas, help or explanation?
Many drivers implement this method identically to getColumnName(), apparently because it is a "suggested" title, but always be sure you have the latest versions. For the AS/400 drivers ...more
Is there any way to generate offscreen images without relying on the native graphics support? I'd like to create an image without an X server running, or create an image with more colors than the current video mode.
You must have a graphical environment installed on your server to work with Java image routines in AWT, even though the image will only be displayed on the client's machine.
The AWT image manipul...more
How can I design my servlet/JSP so that query results get displayed on several pages, like the results of a search engine? Each page should display, say, 10 records each and when the next link is clicked, I should see the next/previous 10 records and so on.
Use a Java Bean to store the entire result of the search that you have found. The servlet will then set a pointer to the first line to be displayed in the page and the number of line...more
How can I display content in the form of a Tree using JSP?
There are a few ways that you could try, although it all depends on any restrictions you have on deployment.
First off, you could use Swing's JTree in a small applet. This would require the use o...more
How can I precompile all my JSP files when I place them on my web site? I don't want to wait until they are hit the first time.
Release 3.1 of the Jakarata Tomcat JSP server (found at jakarta.apache.org)
includes a JSP compiler (JSPC) that does exactly this. You can specify either
a web application directory or a specif...more