Home |
Back |
Contents |
Next |
Tip: You may find BshServlet useful for writing unit tests that must run inside an application server environment. In this mode BshServlet can be used in the same way as or in combination with the Jakarta project's cactus. |
Tip: A WAR file is a Web Application Archive. It is a JAR file containing HTML, images, servlets, and configuration files comprising a complete web application. Web applications can usually be deployed to a servlet container by simply dropping the WAR file into a special directory. |
Note: To install BeanShell in the Tomcat server classpath place the bsh.jar file in common/lib. To use BeanShell in Weblogic you must upgrade its version of the package. See Upgrading BeanShell in Weblogic (http://www.beanshell.org/weblogic.html). |
Note: Using bshservlet-wbsh.war will still *not* work in Weblogic 6.x unless you upgrade Weblogic's internal version of BeanShell first. See Upgrading BeanShell in Weblogic. (http://www.beanshell.org/weblogic.html). |
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <servlet> <servlet-name>bshservlet</servlet-name> <servlet-class>bsh.servlet.BshServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>bshservlet</servlet-name> <url-pattern>/eval</url-pattern> </servlet-mapping> </web-app> |
http://localhost/myapp/eval |
http://localhost/bshservlet/eval |
java bsh.Remote http://localhost/bshservlet/eval test1.bsh |
// Server side script generates HTML response page bsh.httpServletResponse.setContentType("text/html"); out = bsh.httpServletResponse.getWriter(); out.println("<html><body><h1>Hello World!</h1></body></html>"); |
Parameter | Value |
bsh.script | The BeanShell Script |
bsh.servlet.captureOutErr | "true" - capture standard out and standard error during the evaluation of the script. Note: this is inherently non-thread safe. All output from the VM will be captured. |
bsh.servlet.output | "raw" - Do not generate the servlet HTML result page. Instead rely on the script to generate the complete result using the servlet response. |
bsh.client | "remote" - set by the bsh.Remote launcher to indicate that results should be raw and the return value should be encoded for transport back to the client. |
Home |
Back |
Contents |
Next |