http://forums.devx.com/showthread.php?t=147403
http://www.tek-tips.com/viewthread.cfm?qid=1471582&page=7
http://forums.sun.com/thread.jspa?threadID=635568&tstart=-1
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
http://stackoverflow.com/questions/529474/how-to-run-a-ksh-script-from-java-code
Monday, April 20, 2009
Friday, April 17, 2009
The Java Archive Tool
Sun Microsystems, Inc.
Typical usage to combine files into a jar file is:
C:\Java> jar cf myFile.jar *.class
If you have a pre-existing manifest file whose name: value pairs you want the jar tool to include for the new jar archive, you can specify it using the m option:
C:\Java> jar cmf myManifestFile myFile.jar *.class
To extract the files from a jar file, use x, as in:
C:\Java> jar xf myFile.jar
To extract only certain files from a jar file, supply their filenames:
C:\Java> jar xf myFile.jar foo bar
Updates an existing file jarfile (when f is specified) by adding to it files and directories specified by inputfiles. For example:
jar uf foo.jar foo.class
would add the file foo.class to the existing jar file foo.jar. The u option can also update the manifest entry, as given by this example:
jar umf manifest foo.jar
Typical usage to combine files into a jar file is:
C:\Java> jar cf myFile.jar *.class
If you have a pre-existing manifest file whose name: value pairs you want the jar tool to include for the new jar archive, you can specify it using the m option:
C:\Java> jar cmf myManifestFile myFile.jar *.class
To extract the files from a jar file, use x, as in:
C:\Java> jar xf myFile.jar
To extract only certain files from a jar file, supply their filenames:
C:\Java> jar xf myFile.jar foo bar
Updates an existing file jarfile (when f is specified) by adding to it files and directories specified by inputfiles. For example:
jar uf foo.jar foo.class
would add the file foo.class to the existing jar file foo.jar. The u option can also update the manifest entry, as given by this example:
jar umf manifest foo.jar
Creating executable jar files
http://csdl.ics.hawaii.edu/~johnson/613f99/modules/04/jar-files.html
Main-Class: psae.HelloWorld
jar cmf mainClass psae.jar psae
jar tf psae.jar
java -jar psae.jar Philip
Saturday, April 11, 2009
Accessing Iframes
function loadyahoo(){
//alert(window.frames['myFrame']);
window.document.frames['myFrame'].location = "test1.html";
alert(window.frames['myFrame'].document.all.nametxt.value);
window.frames['myFrame'].document.getElementById('nametxt').value="Jeetu is great!";
/*var iframeEl = document.getElementById('myFrame');
if ( iframeEl.contentDocument ) { // DOM
var form = iframeEl.contentDocument.getElementById('nametxt');
} else if ( iframeEl.contentWindow ) { // IE win
var form = iframeEl.contentWindow.document.getElementById('nametxt');
}*/
//form.value="jeetu alex";
//window.document.getElementById('myFrame').src = "test1.html";
//alert(document.getElementById('myFrame').contentWindow.document.getElementById('nametxt'));
//document.getElementById('myFrame').contentWindow.document.getElementById('nametxt').value="Jeetu";
}
//alert(window.frames['myFrame']);
window.document.frames['myFrame'].location = "test1.html";
alert(window.frames['myFrame'].document.all.nametxt.value);
window.frames['myFrame'].document.getElementById('nametxt').value="Jeetu is great!";
/*var iframeEl = document.getElementById('myFrame');
if ( iframeEl.contentDocument ) { // DOM
var form = iframeEl.contentDocument.getElementById('nametxt');
} else if ( iframeEl.contentWindow ) { // IE win
var form = iframeEl.contentWindow.document.getElementById('nametxt');
}*/
//form.value="jeetu alex";
//window.document.getElementById('myFrame').src = "test1.html";
//alert(document.getElementById('myFrame').contentWindow.document.getElementById('nametxt'));
//document.getElementById('myFrame').contentWindow.document.getElementById('nametxt').value="Jeetu";
}
Tuesday, February 24, 2009
JRun Overview of filters
http://livedocs.adobe.com/jrun/4/Programmers_Guide/filters2.htm
Filters process request objects before they get to the server or process response objects after they leave the server and before they are returned to the client. You can use filters to do the following tasks:
Take flow-control logic out of web application components.
Examine and modify the request object before the server receives it from the client.
Examine and modify the response object before the client receives it from the server.
Change the content of the response.
...
Specifically, filters are often implemented as:
Request dispatchers
User authenticators and authorizers
Request and response loggers and auditors
Form validators
Image converters
Data compressors and decompressors
Data encryptors and decryptors
Response output tokenizers
Triggers for resource access
XML transformers
Content localizers
Filters process request objects before they get to the server or process response objects after they leave the server and before they are returned to the client. You can use filters to do the following tasks:
Take flow-control logic out of web application components.
Examine and modify the request object before the server receives it from the client.
Examine and modify the response object before the client receives it from the server.
Change the content of the response.
...
Specifically, filters are often implemented as:
Request dispatchers
User authenticators and authorizers
Request and response loggers and auditors
Form validators
Image converters
Data compressors and decompressors
Data encryptors and decryptors
Response output tokenizers
Triggers for resource access
XML transformers
Content localizers
Using the getResource method
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet19.htm
You can use the ServletContext object's getResource method to include content in your servlet. The getResource method returns a URL object. Then you can use the URL object to access the content. One advantage of using the URL object is that you can parse the content before returning it to the browser. You can also use this technique to include content that is otherwise not accessible to the users directly, such as files in the /WEB-INF directory.
You can use the ServletContext object's getResource method to include content in your servlet. The getResource method returns a URL object. Then you can use the URL object to access the content. One advantage of using the URL object is that you can parse the content before returning it to the browser. You can also use this technique to include content that is otherwise not accessible to the users directly, such as files in the /WEB-INF directory.
JRun Passing control
Using the RequestDispatcher
Using the sendRedirect method
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet17.htm
Using the sendRedirect method
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet17.htm
Using databases - Understanding JDBC
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet16.htm
JRun connection pooling mechanism...
import javax.naming.*;
import javax.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
...
Connection dbConnection = null;
ResultSet dbResultSet = null;
ResultSetMetaData rsmd = null;
try {
��InitialContext ctx = new InitialContext();
��DataSource ds = (DataSource) ctx.lookup("compass");
��dbConnection = ds.getConnection();
��Statement stmt = dbConnection.createStatement();
��dbResultSet = stmt.executeQuery("SELECT * FROM user");
��rsmd = dbResultSet.getMetaData();
} catch (Exception e) {
}
...
//process your result set and result set metadata here
JRun Handling exceptions
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet12.htm
Exceptions are errors detected within your servlet. Exceptions can occur at run-time, such as when a servlet processes form data, or at compile-time, such as when you pre-compile JSPs. You should catch compile-time exceptions before putting your web application into production. This section describes how to handle run-time exceptions in servlets and JSPs.
In a Java servlet, an exception is represented by an instance of the class javax.servlet.ServletException.
You can define how a web application handles errors using the error-page element in the WEB-INF/web.xml file. You can also define error handling for all web applications on the JRun server by adding error-page elements to the SERVER-INF/default-web.xml file.
The error-page element defines exceptions by exception type or by error code, as the following sections describe. The order of these elements in the web.xml file determines the error handler. JRun redirects the error processing to the location specified by the first error-page element that matches the error-code or exception-type.
��java.io.FileNotFoundException
��/error-pages/404.jsp
��500
��/error-pages/servererror.jsp
Exceptions are errors detected within your servlet. Exceptions can occur at run-time, such as when a servlet processes form data, or at compile-time, such as when you pre-compile JSPs. You should catch compile-time exceptions before putting your web application into production. This section describes how to handle run-time exceptions in servlets and JSPs.
In a Java servlet, an exception is represented by an instance of the class javax.servlet.ServletException.
You can define how a web application handles errors using the error-page element in the WEB-INF/web.xml file. You can also define error handling for all web applications on the JRun server by adding error-page elements to the SERVER-INF/default-web.xml file.
The error-page element defines exceptions by exception type or by error code, as the following sections describe. The order of these elements in the web.xml file determines the error handler. JRun redirects the error processing to the location specified by the first error-page element that matches the error-code or exception-type.
��
��
��
��
JRun Writing results back to the client
Working with special characters
Setting headers
Using the PrintWriter
Using the ServletOutputStream
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet10.htm
Setting headers
Using the PrintWriter
Using the ServletOutputStream
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet10.htm
Writing to the web application's root directory
Writing to the web application's temporary directory
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet11.htm
Processing requests
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet9.htm
Servlet requests can come in a variety of ways. Your servlets are responsible for accepting those requests, parsing client input, and then generating a response. The methods of passing data to a servlet include:
Query string parameters
Form input
Request headers
Servlet requests can come in a variety of ways. Your servlets are responsible for accepting those requests, parsing client input, and then generating a response. The methods of passing data to a servlet include:
Query string parameters
Form input
Request headers
Understanding servlet mappings
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet6.htm
To access any servlet on a JRun server, you can use the implicit /servlet mapping as long as you store the servlet in the /WEB-INF/classes directory. For example, if you store the MyServlet.class file in /WEB-INF/classes, you can request http://yourhost/servlet/MyServlet to request that servlet.
This mapping is predefined in the default-web.xml file, as the following example shows:
��ServletInvoker
��/servlet/
To access any servlet on a JRun server, you can use the implicit /servlet mapping as long as you store the servlet in the /WEB-INF/classes directory. For example, if you store the MyServlet.class file in /WEB-INF/classes, you can request http://yourhost/servlet/MyServlet to request that servlet.
This mapping is predefined in the default-web.xml file, as the following example shows:
��
��
JRun security architecture
Using a customized security implementation
http://livedocs.adobe.com/jrun/4/JRun_Administrators_Guide/authentic5.htm
http://livedocs.adobe.com/jrun/4/JRun_Administrators_Guide/authentic.htm
Using HttpServlet
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet4.htm
http://livedocs.adobe.com/jrun/4/JRun_Administrators_Guide/authentic5.htm
http://livedocs.adobe.com/jrun/4/JRun_Administrators_Guide/authentic.htm
Using HttpServlet
http://livedocs.adobe.com/jrun/4/Programmers_Guide/techniques_servlet4.htm
Subscribe to:
Posts
(
Atom
)