Jsp-faq (5)

Source: Internet
Author: User
Tags constant file upload ip number session id sessions zip
JS-there some sort of event that happens when a session object gets bound or unbound to the session? Toc



From: "Kirkdorffer, Daniel" <daniel.kirkdorffer@ATTWS.COM>

Httpsessionbindinglistener'll hear when the events are added and/or remove from the sessions object, or when the Session was invalidated, in which case the objects are the "session", removed the session is whether Manually or automatically (timeout).

Is there a way to execute a JSP from the comandline or from my own application? Toc



There is a little tool called Jspexecutor This allows to do just. The developers (Hendrik Schreiber
Http://www.webapp.de/jspexecutor.html

What should I use, model 1 or Model 2? Toc



Whichever one works for you. Model 2 can give control, especially if you are doing things such as filtering the actual Web pages a client rece Ives because of language. Model 1 is generally. A more full description of Model 1 vs Model 2 are at http://www.aptura.com/technology/jspBook_Architectures.html.

How do I delete a cookies with JSP? Toc



From:chris Fesler <cfesler@InstantObjects.com>

A little more experimentation, and I-came up with a is to delete cookies. Say that I have a cookie called "foo," which I set a while ago & I
Want it to go away. I simply:

<%
Cookie Killcookie = new Cookie ("foo", NULL);
Killcookie.setpath ("/");
Killcookie.setmaxage (0);
Response.addcookie (Killcookie);
%>
This is the is-not-how the JSDK documentation indicates cookies are to is deleted, but what the heck--it seems to W Ork.



Are there tips on things to watch out for in JSP? Toc



There are a number of things to beware of I ' m sure, I have found one into particular so far:

From John Langley (Langley@NEOTEK.MV.COM), don ' t have directories in your path that are not valid Java identifiers (for ex Ample, they start with a number, or are a number). A number of JSP implementations use the directory your JSP? As part of the package name and if this is directory With an invalid identifier then your are out of luck.
Beware of server side includes not recompiling when to you have changed. Some JSP engines won ' t check into your JSPs or create dependency lists to ensure this entire content of your JSP would b e recompiled if a dependency has changed.
Many servlet engines don ' t notice that's your change your beans, so this if you are your JSP and change a bean which it use S, although the JSP would reload, the bean would not. This is require to restart your server.
The Virtual Machine has some intrinsic limitations as OK (contributed by Costin Manolache), and these affect your JSP. From Virtual Machine Spec:

64k entries in constant pool (which means the count of strings you can-in-out.println (), plus all other constants < 64k)
64k as the size of a method (which mean the service () method can ' t have unlimited number of instructions)
Constant string limit is 64k (Bytes-not characters!) This may explain the 32K (since Unicode chars are ~ 2 bytes-sometimes).
(It's not the limit of a String-just constant String).
Other Tips appreciated! Email me at rvowles@esperanto.org.nz

How do I get started and JSP on the Macintosh? Toc



From:niels Peter Strandberg <nps@HEM1.PASSAGEN.SE>

This mail are for all Mac users, want to get started with Java Server Pages on the Mac.

This list is base on the mails I got from Mike Engelhart <mengelhart@earthtrip.com>. who helped me to get my server started. Hi mike!

Java Server Pages are the Java worlds answer to Active Server pages in NT. Sun has made a free version witch includes a Web Server and an JSP
Engine. The package is made in 100% pure Java. So it runs on every Java platform, and it's free.

Before you can cook your own Java Server Pages, you are need to build the "JSP machine". And here are how todo it.

You are need the latest MRJ from Apple. MRJ2.1 can be found here:http://www.apple.com/java/. After download run the installer and install
The MRJ.
You also need the latest MRJ SDK 2.1 (Im using 2.0 and so works great), which can be found here:http://developer.apple.c Om/java/text/download.html#sdk. After download run the installer and install the MRJ SDK.
You are also need the "JavaServer WDK ea (JavaServer Web Development Kit 1.0 EA)" from Sun. This can is found here:http://developer.java.sun.com/developer/earlyaccess/jsp/. I downloaded the Win version, but there should is no problem if you download the
Solaris version. After you have downloaded the ZIP, unzip it using Zipit or StuffIt. You are have to being a registered member of developer connection
To get access to the files, but that it's free. So go ahead a register yourself.
After your have unziped the zip file, place the unziped folder "Jswdk-1.0-ea" on the desktop. Now locate the "MRJ SDK 2.1" folder and
Open it. Inside that folder is another folder named "Jbindery" and "Inside", that folder, the app with the same name.
Now launche the app "Jbindery". Click on the ' Command ' icon and add this to the Class Name field: ' Com.sun.web.shell.Startup '. Leave the
Optional parameters blank.
Click on the "Classpath" icon. Click on the "Add. zip file ..." button and add the following files: "Webserver.jar" which is in the root of your "jswdk-1. 0-ea "folder. Also Add the following files which are in the "Lib" folder: "Jsp.jar" and "Jspengine.jar" and "Servlet.jar"
Click on the "Add Folder ..." button and ad the following folder "Beans" locate in examples/web-inf/jsp/
Now, are ready to save this setting as an click Able application. Click on the "Save Settings ..." button, and give your "app" a name (ex.
JSP Server) and make sure the check box, "Save As APP" is checked. Make sure this to save the app in the root of the "Jswdk-1.0-ea" folder.
Now you have embedded this setting in a application file. Now locate your The "JSP Server" application and double click on it. Wait a few seconds, and your server should is up a running. The app would quit if it cant find a IP number. Go into your TCP/IP control Panel and assign a permanent IP number (ex. 127.0.0.1). Then try to run the app again.
The JSP Server would run at port 8080 by default. Can change this by opening the "default.cfg" file in a text editor and change the "Server.port" from 8080 to, witch is the default port for webservers.
Now this is where the fun begins. Open your Web browser and type in the IP number you are assigned to your Mac in the TCP/IP control Panel. (http://127.0.0.1) or (http://127.0.0.1:8080) if you didn ' t change the port setting in the ' default.cfg ' file.
Now, explore the example and then your are ready, cook your own JSP.
What application Servers support JSP? Toc



Originally contributed by Daniel Kirkdorffer, daniel.kirkdorffer@attws.com. Also http://www.interpasnet.com/JSS/textes/jsp2.htm or http://www.flashline.com/components/appservermatrix.jsp


What happened to the LOOP and DISPLAY tags from JSP 0.92? Toc



They were left out in JSP 1.0 onwards. There was no explanation given. They May is able to is expressed as tag extensions but I have not investigated the 1.1 APIs yet to determine how that could Be done.

Does JSP have a bean providing File Upload features like ActiveX Upload control? Toc



Get a look in the Multipartrequest object from the author of "Java Servlet Programming" (O ' Reilly). Home page is http://www.servlets.com/index.html. The zip file for this class and other useful classes are at http://www.servlets.com/resources/com.oreilly.servlet/cos.zip.

I use the EJB from JSP? Toc



Can I just abort processing a JSP? Toc



Yes. Because your JSP is just a servlet method, can just put (whereever necessary) a

<% return; %>
The "I ' m trying to pass" an object between a servlet and a JSP page, but the I-is-null on the JSP page. What could be wrong? " Toc



From:timothy Owen Reilly
HttpSession objects are limited in the scope to a particular servlet zone. In my case, I saw this behaviour because the my servlet is in one servlet zone, and my JSP engine (gnujsp) is in another. Try printing out of the session ID in both your servlet and your JSP page [Use:HttpSession.getId ()], if it's different in B OTH, then obviously each side of the equation are using a different session framework, and you could have the same problem As I did.

Running both my servlets and gnujsp in the same servlet zone the solved of this problem.

Note:the observed behaviour and solution were under Apache Jserv 1.1 and Gnujsp 1.0

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.