jGuru
Register Email     Password Forgot your
password?
HOME FAQS FORUMS DOWNLOADS ARTICLES PEERSCOPE LEARN

  Search   jGuru Search Help

View:
JSP FAQ Index By Topic

Java:API:JSP
How do I mix JSP and SSI #include?
How do I upload a file to my servlet or JSP?
How do I access a database from my servlet or JSP?
How can I implement a thread-safe JSP page?
Can a JSP page process HTML FORM data?
How do I include static files within a JSP page?
How do I use comments within a JSP page?
How do I perform browser redirection from a JSP page?
How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
Is there a way to reference the "this" variable within a JSP page?
How do I set a cookie within a JSP page?
How can I delete a cookie from within a JSP page?
Can I stop JSP execution while in the midst of processing a request?
How can I declare methods within my JSP page?
Can you make use of a ServletOutputStream object from within a JSP page?
How can I send email from a JSP page?
Can I invoke a JSP error page from a servlet?
What's the difference between the JSDK and the JSWDK? And what's the current version?
How do I communicate with a JSP page from an applet?
Name some sites that make extensive use of JSP technology.
I've installed the JSWDK and it says I've run out of environment space when I try to start the server. How do I increase the amount of environment space under Windows?
How do you pass an InitParameter to a JSP?
How can my JSP page communicate with an EJB Session Bean?
How can I prevent the word "null" from appearing in my HTML input text fields when I populate them with a resultset that has null values?
What ISPs provide hosting services which include JSP support?
What are some alternatives to JSP?
How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the default?
How can I integrate my JSP pages with OLE/COM objects?
What is the difference between JSP and PHP?
How do I download a (binary, text, executable) file from a servlet or JSP?
Where can I find a jsp editor?
How can I get information regarding the client browser using JSP?
Why use JSP when we can do the same thing with servlets?
Can I call a JSP, then have it return control to the original JSP, like a subroutine or method call?
What is the difference between <%@ include file="abc.jsp" %> and <jsp:include page="abc.jsp" %> ?
When I use the and then recompile "myclass", the JSP document doesn't seem to understand that there is now a new class. Instead, it continues to use the old object that has already been loaded within the servletcontext. How can I avoid this?
It is a basic concept that JSPs compile into servlets. What happens to JSP scriptlets? How are they compiled and excuted?
I want to use url rewriting as the default mechanism for maintaining the session ID rather than make use of a cookie. How do I enable this when creating a new session with JSP or servlets?
How can I include stock quotes in my JSP pages?
Should I use the SingleThreadModel interface or provide explicit synchronization to make my JSP pages and servlets thread safe?
What are the disadvantages of JSP?
Can a JSP call itself recursively?
What are some of the strategies for internationalising JSP pages, without duplicating the JSP page for each language?
How can I use JSP to make sure a user has logged in before I handle the request?
How can I write to a text file from a JSP page?
How can you define methods in a JSP file?
How can I include a non-relative page (an .html page which is situated on another server) within my JSP pages?
How do you share session objects between servlets and JSP?
How can I customize the HTML generated by my JSP file based upon what browser the user is using?
How can I include content from a URL, not from a local file?
How do I setup a cookie to expire after a certain time?
How can I set things up such that some of my code is run upon starting of all of my JSPs? If possible, can I share what is started with the generated servlets?
For brand new JSP page, if several clients make request to the same page at the same time: is it possible that due to concurrent nature of request handling several requests handlers will compile same JSP more then once? How does the server resolve concurrent compiles (you ideas)? Does JSP specification say anything about it?
What happended to the LOOP Tag from JSP 0.92? How can I display the values for a bean with indexed properties?
What exactly happens behind the scenes when a JSP page is compiled? Is it converted to a servlet? If it is, then does each request to a JSP page result in the creation of a new servlet?
When we use <jsp:forward>, the URL in the browser's location/address area doesn't change to the page that is forwarded to. Is there any way to update this upon forwarding to a new location?
Does the mere act of accessing a JSP page with your browser create a session? If so, can this session then be accessed within the service method of a servlet that may be invoked later on?
What is the use of param tag in setProperty, include , forward commands?
For JSP 1.0, is there any way to use both standard Java scriptlets and JavaScript in the same JSP? (Motivation: Reuse of tool-generated JavaScript)
How can I convert my 0.9 JSP files to 1.1?
Is there any equivalent to the "global.asa" file that's available for ASP developers in JSP?
Is there any way in JSP to set focus on an input field in a HTML form using JSP code, and not JavaScript?
What is the best way to do database connection pooling using JSPs?
Can I use a bean in a JSP that implements the Runnable interface or extends the Thread class?
Can an ASP page call Servlets or JSP, and vice versa?
Let's assume I use a JavaBean as a go-between a JSP and an EJB, and have, say, 50 concurrent clients that need to access the EJB functionality. Will the JSP container actually instantiate 50 instances of the bean, or can it reuse a single instance to access the EJB?
How can I determine the name and version number of the servlet or JSP engine that I am using?
What are all the implicit objects available within a JSP page?
How can I get the absolute URL of a servlet/JSP page at runtime ?
Are there any good books out on JavaServer Pages?
Can I use WML (wireless markup language) from a Java Server Page?
It seems to me that a JSP page forward always ends up in the frame where the original JSP page was in. How can I replace the entire frame with a new page?
Can I write a JSP program which can act an an FTP client?
How can I refresh the page my browser is showing with JSP?
Can a JSP be multi-threaded?
Can a JSP page access data in a Hashtable instead of a bean? If so, what is the syntax? For example, I want to put simple values into the Hashtable as well as more complex values such as other Hashtables or Vectors and retrieve them by key.
How do you stop all futher processing in a JSP page?
What is the difference between Java Servlets and Java ServerPages (JSP)?
Can you give an example of how I can use JSP 1.1 TagLib feature to create custom and portable actions for my JSP pages?
Can I pass GET parameters specified within the ACTION clause of a FORM in a JSP page as:
ACTION="xyz.jsp?userid=<%=userid%>"
to another JSP page?:

Are there any other ways to pass GET parameters from a FORM to a JSP page?

When I reference 'session' or 'request' from within a method contained in a declaration, I get an 'Undefined variable' compile error. Why?
What is the diference between a front component and a presentation component?
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.
How does the "session" scope work with the useBean tag? What is the difference between "session" and "application" for the useBean tag?
How can I incorporate mail facilities into JSP pages?
What is the most efficient approach for integrating EJB with JSP? Should the EJBs be invoked directly from within JSP scriptlets? Should the access take place from within Java beans? Or is it best to use custom tags for this purpose?
How do I get a JSP page to implement a Java interface?
How can I get the version of the Servlet API that is being used by a servlet/JSP engine?
How do I include a file in my JSP file where I don't know the filename to include until runtime?
How do I pass session information from a JSP to a Applet. Can I pass them as parameters or can I talk back from an Applet to the JSP page?
Where do I place the JAR files so that I can use JavaMail from JSP?
How can I display content in the form of a Tree using JSP?
Is it an acceptable practice to use response.sendRedirect() in a JSP page? Or should you just throw an exception and use the error page directive?
How can I use the '<%@include file="filename" %>' directive, within an 'if' clause using JSP?
I want to throw an exception that I wrote, from within a JSP page. How do I do it? Do I have to declare a throws MyOwnException somewhere?
How can I communicate between a JSP and an included JSP, included via the <jsp:include> syntax?
What is the difference between ServletContext and PageContext?
If "yy.jsp" includes "xx.jsp" and then I modify "xx.jsp" and try to execute "yy.jsp", does the JSP engine recognize "xx.jsp" as being modified? If it detects modification, does it automatically recompile xx.jsp ?
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.
How can I protect my JSP pages (or servlets) against the user's using the browser's back arrow and losing the session?
What does the attribute flush=true in <jsp:include page="abc.jsp" flush="true"/> mean? Where is it essential to use?

What happens to the compiled servlet class files when we shutdown the JSP engine? Will they will be erased from memory as well as from disk?
What is the equivalent in JSP to FileSystemObject in ASP?
What are the differences between JSP and ASP?
Are there any tools to help convert an ASP-based application to a JSP-based application?
What JSP engines support clustering?
Is there an example showing introspection or reflection being used in a JSP? I'd like to populate a form w/ data from a bean, then populate that bean automatically with the modified/unmodified data when the page gets/posts to my servlet w/o parsing the parameters.
What is the best way to do session and application initialization in a JSP page?
How do I use the <jsp:plugin> tag to embed an applet and have multiple parameters?
How can I pass data retrieved from a database by a servlet to a JSP page?
How do I force JSP page references to use the HTTPS rather than HTTP protocol? It seems that using <jsp:forward .../>, for instance, prohibits me from specifying the https:// protocol explicitly in the reference (e.g., <jsp:forward page="https://..."/> is not allowed).
Where should my property files be placed under Windows using Tomcat 3.1 such that they can be located by my beans?
How can I create a new web "application" using the JSWDK?
How do I deliver a JSP-based web app as just the precompiled .class files?
What are all my options for running JSP under Linux?
What effect on variables does the keyword 'static' have when used in the declaration section of a JSP Page?
How can I take advantage of introspection and have a servlet process the entire form like I can using the JSP directive
<jsp:setProperty name="formHandler" property="*"/> ?
Is it possible to have two JSPs with the same name, in two different directories on the server?
How can I include a JavaScript function within a JSP page?
I'm attempting to use a <%@ include file="xx" %> within a table cell, and it ends the include with a carriage return, even though the included file has none. Is there some way I can strip out the carriage return in the table cell?
Can I create documentation for a JSP file using javadoc ?
How to view an image stored on database with JSP?
Can I instantiate an object in the init method of a JSP and use the same object within the service method during request processing?
Tomcat JSP URLs appear to be case-sensitive (presumably because the page name and directory tree form part of the class name). Is it possible to have case-insensitive JSP URLS?
My Java applet which needs to be sent to a browser by means of a JSP page is contained within a JAR file. How can the browser download this JAR file?
Is there any way to convert "Post" request to "Get" request dynamically in case of JSP, as there is only service method?
Can I access a property or call a method of a previously instantiated bean within the overidden jspInit()?
Is there any way to hide the .jsp extension from being displayed in the URL?
When building a predominantly dynamic site using the Model 2 pattern, are there any good reasons to also put static pages (i.e., those that could be written in just HTML) under Model 2 control as well?
What is the best way to send parameters to servlets when using the jsp:include statement to embed the servlet output inside of a JSP page?
How can I call an ASP page from JSP?
Under Apache Tomcat, where should I place the JavaBeans components such that it can be accessed by both servlets and JSP pages belonging to my application?
I am having hard time deciding if a piece of functionality should be implemented as tag library or server side objects to be used in scriptlets within a JSP page. Are there any guidelines and what are the performance implications?
Can I set a charset on my response dynamically in a JSP? I want to set the content type to have a charset that can represent characters in a particular language in an I18N'ed application--Big5, ISO-8859-5, etc.
How can I use a database connection pool within a servlet or JSP page?
Which is the most efficient (i.e. processing speed) way to create a server application that accesses a database: A Servlet using JDBC; a JSP page using a JavaBean to carry out the db access; or JSP combined with a Servlet? Are these my only choices?
How could I detect the bean is in session scope? What I am trying to do is this: In a jsp page, if the bean is in session scope, I will call beans method and get its values. If the bean is not in scope, I will direct the page to a servlet, which will instantiate a new bean and place it into the session.
How can I set a cookie that is persisted only for the duration of the client's session?
Can I reference a bean within a JavaScript function in a JSP Page. I have used <jsp:useBean .. /> as a instance of a bean, and I would like to control the client side graphics using JavaScript <SCRIPT> … </SCRIPT>. At the end of the processing I would like to have the Java Script use methods/variables in the bean.
Can I create an inner class within my JSP file? If yes, can it be dynamically reloaded when changed like the rest of the JSP?
My java code needs to pass a memory buffer (containing one complete JSP file) to the JSP engine and retrieve the output of its execution in another memory buffer. Is there some way of acheiving this?
In there an example on how to create a JSP page that uses other JSP pages as components? How does this work with tag libraries that contain if/then/else/loop tags whose bodies must include component JSP pages?
What would make a JSP page to start a new session even though I had created one before?
How would I implement events “On Application Start” and “On Session Start” using JSP? The reason I need “On application start” is so that I can instantiate my connection pooling class only once for the entire duration of my web application.
What are some examples of good JSP applications (with/without source)?
What are custom tags useful for ?
How can the data within an HTML form be refreshed automatically whenever there is a change in the database?
I am using URLRewriting to pass sessionID from one page to other page. Can I hide sessionID from displaying in URL.
Can I use more than one jsp:include action within JSP page? Is there anything I need to watch out for?
What is the exact difference between request.getRequestURI() and request.getServletPath()?
Is there a way to set up the unlimited buffering for a JSP page?
Can I use the PageContext.forward() or RequestDispatcher.forward() method to forward to a specific anchor (something like "mypage.html#intro")?
How can i define and manage access rights for different user accounts under mydomain.com/user/xxx for which they have to login first?
What is a scriptlet?
How do I enable a JSP page send a dynamically generated GIF image back to browser?
How can I access FORM data encoded in an non-English charset in my JSP file?
How can I find out as to which page (static or dynamic) was responsible for invoking a JSP page?
How can I call a servlet from a JSP page? How can I pass variables from the JSP that the servlet can access?
Can I use a page anchor with a JSP page? It should work like test.jsp#myAnchor
Is there an example of a shopping cart using Stateful Session Beans and a JSP client?
On my JSP pages I need the HEAD request to return "200 OK", but by default it returns "500 INTERNAL SERVER ERROR". Is there any way to change the default response a JSP page returns to a HEAD request?
Where can a tag built with taglib reserve their resources? For example, a tag may need to reserve a database connection to improve its performance. It's a taglib constructor a good place to do it? If the answer is yes, where can I free these resorces?
There seems to be a serious problem with custom tags and jsp:include, they can't go together. Correct me if I'm wrong but jsp:include requires flush="true" and custom tags require flush="false". Is there any way around this ? or if not: Will there be a way around this in JSP 1.2?
What will be the better approach for sending data from an Applet to a JSP page for processing, using "appletContext and showDocument()" or "setting up an URL Connection and passing data through a stream"?
How do I set a cookie value and retrieve the results in a later JSP page?
What is the difference between response.sendRedirect(), RequestDispatcher.forward(), and PageContext.forward()?
Does the IIS server support JSP? If not, is there a way to enable the same?
Is there a tool that contains wizards to create a quick database form in JSP? I want to publish some pages that would allow my team members to view lookup / informational database tables.
Are there any tools which can automate the translation of ASP files to JSP?
How can I invoke an RMI Server from a in JSP page?
Is there any way to get the Last Modified date of a JSP source file from that file? I want my JSP to have a display of the last modification automatically.
How do I bypass Basic Authentication for a JSP page?
What is the best product now in the market that supports JSP 1.1, including a development and deployment tool.
Architecturally speaking, under what circumstances must I consider adding EJB into the mix when building web-based applications using servlets and JSP?
How can I read GET or POST parameters that were encoded in an international character set? Also, when a user fills in an HTML Form using a custom Input Method Editor for, say, Japanese, how can my servlet/JSP know which encoding was used?
What is the best way to pass objects between servlets and JSP - when do I use getAttribute and when do I use getParameter?
Why would I want to use JSP when I could use XML/XSL and a parser instead to achieve system independent results?
Is there a way to compress the result of the JSP and return it to the browser? Most browsers support GZIP and I have compressed straight HTML and also used this technique with XML/XSL. Btw, I am using a servlet-centric approach.
Without JSP generating a "Content-Length" header in response to a POST operation to a .jsp file, how do browsers know when HTML transmission (i.e. dynamic content) is done? I'm having issues with "half-pages" being sent to the browser. It works fine over a local network, but over the internet we have issues because of network latency.
How can I link from secure to non-secure pages or vice-versa (HTTP -> HTTPS) in my JSP or servlet code without always hardcoding the "https://..." or "http://..." string? I'd like to be able to use things like RequestDispatcher.forward() or relative URLs when our users go back and forth between secure and non-secure pages.
Is there a mailing list for the discussion of JSP-related issues?
How do I multiply 2 decimal values being passed from a html form to a JSP page for calculation?
How can I JSP under Apache JServ?
What, if any, are the risks when migrating from Apache JServ to jakarta-tomcat? How many changes will have to be made to existing (JSDK2.0) java servlet code?
How does one document JSP code, since javadoc doesn't really work?
How do <jsp:setProperty> and <jsp:getProperty> work internally? How does it identify the variable that needs to have its value set or retrieved?
Is there any way to determine the number of concurrent connections my servlet engine can handle?
How can I have a different httpSession object for:
1. Each browser window(s) of same instance of browser
2. Each browser instance
What's the difference between just binding objects to a session as session variables and creating a Bean and associating it to the session?
Are there any special considerations when using the <jsp:setProperty name="referralBean" property="*"/> syntax to submit blank form elements?
Can I integrate a Macromedia Flash-based application with a Jsp page?
My application is to generate HTML/WML pages having XML sheets. I am using XSLT stylesheets at the moment. Would JSP be better solution for this case?
Is ASP's "response.redirect" equivalent to the Servlet API's "response.sendRedirect"?
I am getting data which is windows-1251 encoded in my JSP page from file/DB and printing it using the implicit out variable. But I see only a sequence of '?' characters at the output. I am using the directive '<%@ page contentType="text/html; charset=windows-1251" %>' in my JSP page and '-encoding windows-1251' as JVM argument when I start up the Resin server. Why is this so?
What is the most elegant approach to inform a user that his session has timed out?
Can a JavaBean access methods/implicit objects of the JSP page which created it?
The <jsp:forward> only works within a single servlet context. Is there any way to forward the request to a page across the web server?
Is there any way to insert one taglib tag into other of the same class? The problem is that I try to use pageContext parameter in the tag body and initiate it with ExtraInfo class, the container refuses to initiate this parameter twice.
Can I access a java bean that is embedded within a jar file from a JSP page?
Can you use the "errorPage" functionality in the same page as a <jsp:include>? When an exception occurs, the JSP tries to forward to the "errorPage." The problem is that you cannot forward after the buffer has been flushed and including annother resource flushes the buffer (setting the "autoFlush" page attribute has no effect.) So, are the "ErrorPage" exception handling and the <jsp:include> mutually exclusive?
Is there a simple way to share a single Session object across multiple ServletContexts?
If my servlet or JSP contains international characters (like "Ýðüö"), how do I ensure they are displayed correctly?
Can I avoid problems with concurrent access to bean variables by implementing the SingleThreadModel? Or can the scope attribute be used to ensure that the same bean cannot be concurrently used by more than one thread?
Can I access a java bean that is embedded within a jar file from a JSP page?
I am trying to insert records to a database from jsp. The records are multiple line items returned from a Post action in a form. How do I arrange the records so that I can insert them properly? I can get one record to insert, but not more than one. Please show a code sample.
How do you get the original request url from an error page?

When processing a large amount of data in a JSP or Servlet, is there anyway to know that the user has either used the "Stop" button, or closed the window?
I would like to be able to poll for a "Connected" state while a page is processing a large result set. I seem to recall that ASP has such a feature, but I can not find one for the JSP/Servlet model.

When using a custom taglib in a JSP, what is cause of the exception ( org.apache.jasper.JasperException: Unable to open taglibrary http://www.yourcompany.com/taglibs : Unable to open the tag library descriptor: Stream closed)?
Page directives in a JSP affects the overall structure of the generated servlet. When a JSP is included statically (using <%@ include%>) within another JSP, would the called JSP's page directives gets precedence over calling JSPs page directives in the resulting servlet?
If I use the xmlhttp object provided by Microsoft to send an XML document to a JSP from within an HTML page, how do I consume the XML passed?
What will happen when I use the same bean id for different JavaBeans in a <jsp:forward> scenario?
What's the difference between the class and type attributes in the <jsp:useBean> tag.
Can I use beans that contain native methods in JSP?
In a custom tag, is it possible to access a scripting variable defined earlier in the page? I know you can set scripting variables in a custom tag with a TEI class, but what about using a variable defined in the page inside the tag?
How can I intercept the output of the JSP engine (before it is delivered to the client), so that I can manipulate it before sending it to the connecting client?
Can I have my JSP container access JSP pages which are not present in a local file system by doing a JNDI lookup?
How can I provide a print option for the dynamic page I am generating through JSP?
Can I move between http and https-based resources while sharing the same session?
Why am I getting the error "Attempt to clear a buffer that is already been flushed"?
Where can I find an example of forum or discussion group software built using JSP, along with its source?
Does JSP/HTML need to be reconfigured to allow URL rewriting?
Where can I find an example of good architecture for a high database traffic JSP application using connection pooling?
How can I display a JTree-like structure containing directory folders with support for directory browsing within my JSP page?
Which is the best way to handle WAP and HTML requests dynamically in the same JSP?
Can I use scriptlets to specify values for the "property" and "value" attributes of the jsp:setProperty action?
Can I use a dynamically generated path in an errorPage directive?
What are the multithreading and clustering issues when it comes to using beans with jsp's in differrent scopes?
If you are using the WAR archive security, and a user is authenticated, how can they be unauthenticated without shutting down their browser.
How can I schedule an operation in a JSP/JavaBean environment ? Can I use a java.util.TimerTask as a bean ? Will the "application" scope for that bean be necessary/enough ?
Where can I find documentation on jspc? Can jspc be used to pre-compile a jsp contained within a WAR file *before* it has been uncompressed?
How do I write a custom tag to substitute and modify the functionality of jsp:useBean?
Can I call a CGI program from JSP which generates name/value pair as its output? If so, how?
I have several JSP's that need to refer to gifs in the /images directory of a war file. The JSP is contained within the same war file.
Using SRC="/images/.." in the JSP refers to the root on the web server and not the root in the war file. Why?
What is the lifecycle of a JSP page? Please include details of the internal mechanisms of JSP engine.
Is there a technique for loading JSP / servlet files into memory so that they are available quickly to users?
I am generating a report using jsp. To get the output in excel, I am using the following -- <%response.setContentType("application/vnd.ms-excel"); %> However this option does not work when I am calling the jsp from a servlet. Any reason why?

I've just built a prototype with two people at work to test JSP vs. XSL. We're fetching mostly static strings out of a java object with one dynamic field that simply counts accesses. The backend is the same for both JSP and XSL.

The results we're seeing are shocking to me. In our tests, XSL performs typically 50%+ faster than XSL in our testing. I am searching to find anything that could be slowing the JSP side so badly. We are using Weblogic 5.1. Any reasons why we are witnessing such poor JSP performance?

How can I pass parameters dynamically to an applet from within a JSP page?
Is it possible to set the default contentType for all JSP pages rather than, for example, insert <%@ page contentType="text/html; charset=SJIS" %> into each and every page? (Here, I am using Japanese Shift-JIS.) If so, is this vendor specific?
Where should I put .txt file(s) to be accessed by a bean so that the results are passed to a JSP file? I am getting an "File Not Found" exception when I put them in the directory where my bean resides.
Is it possible to intercept the cleanup of session scoped objects, after a session has been invalidated either by timout or an invalidate function?
How do I display the image sent as an attachment with the mail in JSP while retrieving the mails?
How can I put raw Java code in my JSP pages?
Is there a way to retrieve the Java source code for the servlet that was created from a JSP page?
Does the inclusion of a .css file in JSP cause any problem?
Can a JSP page be "spidered" and indexed by a search engine?
From within a JSP page can I obtain the locale of the remote client?
Using JSP, how can I display a DOM object with associated XSL file dynamically. Is there any sample code available for the same?
How can you embed a JavaScript within servlets / JSP pages?
How do I detect if a browser has the flash plugin using JSP?
Can I generate Microsoft Excel documents using JSP or servlets?
What is the value in using the "<%!" scriptlet tag versus the "<%" when declaring constants? Can you just declare constants inside a regular scriptlet tag, or do they lose a property that is gained using the constant / method scriptlet tag "<%!".
Where I can find JSP coding standards?
When you move from normal protocol (http) to security protocol (https), all context attributes will be lost. How to maintain the page context in this situation?
If I look at the java code generated for JSP's within JSWDK, it looks quite different from other sample servlets. Why? Can I obtain "typical" doGet-style servlets from JSP's?
How can I use LDAP with JSP?
Can you give me an example of using XML-style taglib linking (as xmlns) in a JSP-file? So how can I write following using XML-Style (as xmlns):
<%@ taglib prefix=ct uri='WEB-INF/tld/hello.tld' %>
In PHP it is possible to use scriptlet (<? or <%) tags in a subroutine in order to relocate the output on the page. Since any <% tags are included in the service method, is it possible to get scriptlets to work in any other function besides using a hacked inner class?
I call a servlet as the action in a form, from a jsp. How can I redirect the response from the servlet, back to the JSP? (RequestDispatcher.forward will not help in this case, as I do not know which resource has made the request. request.getRequestURI will return the uri as contained in the action tag of the form, which is not what is needed.)
Could someone please define the term "relative" url with respect to pageContext.forward() or pageContext.include() or the errorPage directive? What is it "relative" to? The document root? The file containing the current jsp? The target url minus context name?
Is it possible to add a custom JSP tag that extends the capabilities of the basic HTML tags, like for forms to add an 'attribute' to automate connection to a database?
How can we make tree widgets, like in Swing, in an HTML page?
Is there an equivelent in the JSP world to Microsoft's Remote Scripting? I am trying to implement a parent-child relationship on the client page, so that when the user selects an entry in the parent list, the appropriate child entries are retrieved from the server and displayed (without refreshing the whole page).
Is it possible to publish the output of a JSP page to a static HTML file?
I would like to learn a technique to keep track the number of login attempts by a user using session variables. If the user exceed the maximum login attempts, then the account is suspended.
My JSP is displaying a table that supports sorting and filtering on different columns, and also displays as multiple pages because the table has way too many rows to display on one screen without scrolling. Assuming the user does a lot of manipulation of the table, which is better: cache the data in a bean for quick re-display or re-query the database every time the user wants a new sort/filter/page? I want the application to be as fast as possible, but does supporting concurrent user sessions prohibit the caching option?
Can we precompile all the JSP files in JRun?
Can anybody explain why setProperty on a String property has no effect if the value passed in is an empty string. I can see the point if it is null (does not exist). I can also see the point if the property is not a string since there is no logical way to convert to a Boolean etc. I know that this behaviour is as per the JSP spec but can anybody explain why this behaviour?
I'm using jsp:include -directive to include .html files as layout elements can change often. But when a form (using POST) goes to that JSP page I get error "Included servlet error: 405: HTTP method POST is not supported by this URL". That means that the included .html file does not support POST methods. When I change the form method to GET no errors are given and the file is included fine. Any ideas how I can support POST method forms too using this approach?
What's the best way to return a result from a query on a bean to a JSP page? Returning a ResultSet to the JSP page or returning an ArrayList containing the result or something else?
Can I include JSP expressions in <!-- --> style comments?
When I submit a form using the POST method, how can I retrieve the posted parameters as a string (name/value pairs seperated by "&")? If the form is posted with the GET method, I can use request.QueryString method for this purpose.
Where can I find some good tutorials for a beginning JSP programmer on the Web?
Is it possible to have a jsp page determine which bean to use at run time? For example, I have a jsp page that uses a jsp include for CA, NY, WY state questions depending on a parameter sent to the jsp page. I have three beans one for CA, NY and WY. Can I have the jsp page at run time determine which bean to use in the jsp:useBean element? For example, if the jsp page receives a parameter to include CA questions then only the CA bean is used and the NY and WY bean are not instantiated.
How to I declare a new JSP taglib (tld file + jar file) within IBM WebSphere 3.0?
Can I have a stateful session bean be responsible for storing the session information rather than a HttpSession instance? If so, how can this be done? A code example would be useful.
When I pass parameters using response.redirect("URL?Parameter1=value1,Parameter2=value2"); in a servlet, the target JSP page fails to get the values for Parameter1 and Parameter2. Why?
The request object in ASP has the .ClientCertificate(string) method. Does JSP have anything similar?
Is it possible to download or view a file directly from a database using JSP and JDBC? For example, I have a jpeg file stored as a BLOB in a database. Is it possible to place it on a page directly from the db without saving it first as a file. What about other file types (*.exe, *.pdf ...)?
How can I internationalize my JSP's without taking a huge performance hit? Java Localization imposes a performance hit on my application. Is it better to develop separate versions of the localized JSP pages instead?
If a user has their cookies disabled, are there any other techniques, in addition to URL rewriting, that enable the maintenance of state information using JSP?
How can I deploy my JSP files within a WAR file?
Can I have PHP code within a JSP page?
How can a JSP process HTML form input data to create/addto/update an XML file?
Can we detect whether JavaScript is enabled at the client from within JSP?
I'm trying to write JSP in an XML style. Basicaly, instead of <% I want to write it as <jsp:scriptlet>. In JSP 1.1 spec it's said that I need java.sun.com/jsp/dtd/jsp_1_0.dtd but I can't access it. Where is this DTD currently available?
Is there a standard way of documenting JSP pages?
Is there a way to have JRun process files with extensions other than .jsp as JSP documents? Specifically, I want the server to allow my VoiceXML documents to be processed as JSP, even though they have the extension .jsv.
Why do I get the "405 Method Not Allowed" error when I try to POST to a JSP page?
Can an Applet directly post information to a JSP page rather than a Servlet? In other words, may I use an url.openConnection() where url is "../test.jsp" in the applet?
How can I set variables from within a custom tag and make them available to the including JSP page?
How can I access a JSP bean (jsp:useBean) from an applet?
Is there any way to have a custom tag that supports a variable number of unknown attributes? I'm using XSL to transform my <form> tags into custom tags, but i need to include any and all extra attribute of the <form> tag in the resulting HTML. Since the custom tag is going to be generating this HTML, it needs to be able to output these additional attributes. (Basically I need C's variable argument list, except I need a variable attribute list to a custom tag.)

Example:

<form someUnknownAttr="1">
becomes:
<custom:form someUnknownAttr="1" someSpecialAttr="2">
where someUnknownAttr is not going to be known in time to put it in the taglib descriptor.
According JSP 1.1 spec, we can use HTML, DHTML, XHTML and XML tags within a JSP page. But sometimes, you may have a PDF template that you have to fill in with dynamic data. Can we include PDF templates within a JSP page?
Is there a limit on the length of the parameters & values submitted via post method on a form in JSP? If I have 2 fields and enter more than 2k in the first field, I am not getting the values of the second field with JSP.
Is there anything which a servlet can perform but a JSP cannot and vice versa ?
I have a production server, which doesn't have a JSP engine, but can run Java servlets. Is it possible to copy the compiled JSP pages (which are servlets) to this machine and run them without a JSP engine?
We want to make sure that our JSP development efforts are thread-safe. Is it possible that two threads will access one instance of a JSP custom tag handler concurrently?
When I submit a form using the POST method to a JSP page, about 10% of the time I get back only half the expected reply, and Netscape pops up a dialog box indicating that the "Connection reset by peer". The problem does not seem to occur when the form is submitted using GET. Any reasons why?
What are the best design patterns for communicating with a database from a JSP page? Code examples would be useful.
I am using the RequestDispatcher's forward() method to redirect to a JSP. The problem is that the jsp's url is now relative to the servlet's url and all my url's in the jsp such as <img src="pic.gif"> will be corrupt. How do I solve this problem?
How do I implement synchronization in JSP if I don't want to use SingleThreadModel interface?
Are there any standards for developing JSP pages? All I can find are Java coding standards, which does not help me much when it comes to JSP programming.
How can I invoke the remote methods of an RMI object from a JSP page?
What's a good taglib for database access that's freely available?
Is it possible to use a custom tag as an attribute... Is it possible to use a custom tag as an attribute of another custom tag? For example: <x:tag1 value="<x:tag2/>"/>.
Documenting a Tag Library Is there a standard way of documenting a Tag Library ?
If the output stream was not buffered at the time of transferring the control, the jsp:forward action will throw java.lang.IllegalStateException. Why?
How do I eliminate the spaces in the query string in a servlet /jsp combo like I would replace them with %20 ?
In a web application is Hashtable access faster or better than database access? Some developers I work with are arguing that the hashtables are faster when compared to getting data directly from the database. The size of the database is 3mb right now. If the hashtables do give a faster access time, is there any reason we should or shouldn't use them?
How can I set a JavaScript variable from within a JSP page?
Can I use a Javascript variable in the Java code of a JSP page?
I want to have both text and an png image in my JSP file. I build the image on the server side and use an encoder to get a png image. I try to put this image in the outputstream but it seems I cannot have different content types in a jsp file. How can I manage to have several types of content in a same JSP ? Example : contentType = "text/html a Title then contentType = "image/png" a png image
How can I implement global settings for a JSP application?
Our Web Application maintains the conversational state using a stateful session bean. This bean needs to be accessed by multiple JSP pages in a frame. Now, as per the EJB Specification, these pages can't execute methods on the SFSB concurrently. Therefore, I want to synchronize the access to the SFSB (the Remote object is being maintained in the HttpSession). What is the best way to do this?
Are jsps application server specific? Are jsps application server specific? I mean that if we develop a JSP on application server, can we run the same JSP on other application server without any modification?
I want to save the HTML file which is generated by the JSP at the server side. How can I save the HTML generated by a JSP page at the server side. Actually I want to send the HTML file generated by a JSP as an atttachment of a mail to a third person. So I am thinking of first saving the HTML at the server side in some folder and then send that file as an attachment. Can it be done by some other way using JSP....
Is there a way to encode session information within a form? I am using
String url = response.encodeRedirectUrl("NewPage.jsp");
response.sendRedirect (url); 
to forward to new pages. Is there any way to do this within a form so that when the submit button is clicked the new page will have access to the session information. I am trying to do this with cookies switched off.
What is the difference between the server side include (SSI) and JSP include?
How can I access JSP variables from a JavaScript function in a JSP page?
How can I stop JSP script processing using some command in this script?
out.close() causes no other output to browser, but the other Java code in scriptlets continues.
We have a requirement wherein we have to develop a JSP-based web-site which is very similar in functionality to one we have already developed. Only some attributes like page colors/fonts/images and some header text may change. What are some of the best-practices for developing sites based on this kind of scenario?
Data transfer from jsp custom tags to jsp page's java variable Is it possible to assign to a JSP scriptlet variable a value generated by custom tag? Or is there some other way to transfer parameters from tag output to JSP page?
Include files from context differents How do I include an HTML file in my JSP file when the HTML file is located within a different servlet context?
I'm getting a little frustrated with this problem. How do I change the http header "Referer" prior to a browser redirect?
How to include output of resources like (JSP,ASP,CGI,PHP,HTML) located on different physical machines into a main JSP output ? That means I want to use JSP like a facade-proxy to existing applications. Why does <jsp forward:... work only for relative path resources ? How can I simulate (perhaps extending it) it for any external URL resources? Anything relative will be welcomed...
How do I include a file in a JSP page?
How do I pass a parameter from a servlet to a JSP?
Cookie Support How can I determine whether the browser accessing my JSP page supports cookies?
I stored a HTTP request object in the session and when I later tried to use it, I noticed that the request parameters were missing from it. Why so?
How do I do handle client side validation in JSP pages that use JavaBeans and scriptlets? In particular, I'd like to unhide or display other fields/options depending on the user's actions on previous fields.
Is there any way to pass an object as part of a form post from an html page? I would like to create an object through useBean, use it to populate a form, and pass it along with the form fields on the put request object.
Can I invoke a Perl program from within a JSP page?
I have servlet which calls a jsp page. While calling it should set a object which jsp should get hold and manipulate it. If possible please send a code snippet also.
I have a field defined as a Text field. The field contains line breaks in it. I am printing this field to the screen and would like to replace the line breaks with HTML BR tags. Could someone help me with the code for this?
When a jsp compiler compiles the jsp page, in what order does it get compiled? Specifically if I have scriptlets ,tags, includes and expressions, what would be the order of compilation for these four. Is there a document somewhere that defines this?
How do I have two or more web applications share the same template file (i.e. wrapper around content) so that I would not duplicate code and have two template files?
Is there any way we can detect the Cipher Strength of a Browser using JSP?
What is the maximum available sessions for a given servlet engine?
Is there a way, one can use the new Servlet 2.3 API Filter feature across two JSPs ?
Can you tell me how to validate credit card numbers using JSP?
Where can I learn (more) about Java's suport for internationalization (I18N)?
Where can I learn (more) about Java Servlets?
I have an html page which is used to submit data into a jsp page. This jsp page invokes a bean, which may take a lot of time to execute. I need to show an intermediate page which says "executing bean", while the bean is being executed. How can I do this?
I am using a response.sendRedirect(response.encodeRedirectURL(page)) in a custom tag. As far as I know this should cause the browser to redirect to the page specified. However, instead of redirecting the browser to the new page, it appends the page which the user should be directed to, to the old page. The result is one file sent to the browser with the output from both servlets, including the HTTP headers. Clicking on "Refresh" causes the correct file to be shown. Any idea of the cause of this problem and how to fix it? Thanks, Andrew
How can I get details regarding a browser (make, version, platform, etc.) from within a JSP page?
How do I restrict an user from exceeding data of a particular length in a TEXTAREA like we do with a text box using the maxlength attribute?
Where are the servlet source files for JSPs compiled in Tomcat?
Is there a freeware or shareware Web forum application written in Servlet or JSP?
Can I access a method declared in a jsp page from another jsp page?
Inside a JSP, how to represent private methods and call them?
How can one specify use of an external compiler to compile JSP files?
In our JSP form , we are accepting user name and passwords & we submit the form using POST method to a servlet. How safe is this? Is their any way someone can use a sniffer and get this password? What is the right way to accept usernames & passwords?
How can I recognise which submit button (as images using the type="image" attribute) is pressed in a form containing multible (image) submit buttons?
How can I prevent Microsoft's so-called "SmartTags" from manipulating my web content?
I'm planning to build a content-based site (hundreds of articles) using Tomcat/JSP. My first inclination was to put the content in a database like MySQL. But I want to avoid a query against the database every time an article is displayed; it's inefficient, and the site could get high peak volumes of traffic. So, are there any caching classes (that are freely available) that will store my articles in memory once they've been retrieved from the database? Is there any performance or other reason I couldn't write and use my own caching objects, assuming the server has enough RAM?
I would like to build a dynamic HTML page including a JSP page whith the RequestDispatcher(...).include(...). But the OutputStream cannot be opened from both my servlet and the JSP. Is there any workaround ?
How can I print only a portion of the page and not the whole window from JSP? Calling a JavaScript function and performing window.print(), prints the whole window.
What is Struts? What is Struts?
Struts Tutorial Where can I find a good introductory tutorial on Struts?
Struts JavaDoc Where can I find the javadoc files for the Struts-related classes?
Struts Where? Where can I get Struts?
What is the difference between the methods encodeURL() and encodeRedirectURL()?
Struts Mailing List Are there any Struts-related mailing lists?
<html:text> problems I keep getting a Cannot find bean org.apache.struts.taglib.html.BEAN in scope null error whenever I use the <html:text> tag. What could be the problem?
While forwarding from one page to another by using RequestDispatcher, how do I avoid the error " OutputStream is already being used for this request" ?
Why do I get "java.lang.NoClassDefFoundError: sun/tools/javac/Main" ?
How do I implement a hit counter in Servlets or JSP?
How do I process gb2312-encoded characters within JSP?
I am writting an application in javabeans and jsp. When I run the application I have some output and the internal servlet error: "attempt to clear a buffer that is already been flushed". My application is running under Tomcat 3.2.2.
Why do Frames suck?
Is there a way to access the HttpSession object of a different web application which is running on the same server?
I am trying to implement a RMI server that has a static variable. Is there anyway the clients can access this static variable on the server side and modiy it. After modification, is the change visible in other clients.
What procedure must be followed to read and write encrypted cookies to the browser. What's the role of encoding in this ?
We have a large JSP from which users are taken to diffent screens and based on the values entered there , the fields in this main jsp are updated. Now, we are reloading the entire jsp each time whenever the control comes back. Instead of this is it possible to reload just that part of the jsp which has changed and read other parts from the cache?
I have an application which use a shared library libjchli.so, I have LD_LIBRARY_PATH set to the right dirctory and it works fine. When I tried to convert it to JSP, I got an error message:
java.lang.UnsatisfiedLinkError: no jchli in java.library.path
Apparently libjchli.so is not loaded. Where should the library file be located?
From what I know, I should put the path of properties file in the Classpath. While I am developing a web application, I want to host multiple sites in one machine. So how can I use two different properties file? If I specify them in the Classpath, then the first one will be used according to order of the Classpath since both properties files have the same filename.
My app is in Japanese, and I'm running Tomcat 3.2 and JDK 1.3.1. I am including a header on a main page using the <%@ include file %> directive. At the top of the main page, I first specify the JSP page directive (to set this JSP translation's content type and character set), then include the header file.
<%@ page contentType="text/html; charset=shift_jis"%>
<%@ include file="header.jsp" %>
The content from the main file renders correctly in the browser as shift-jis characters, but the content in the header is the kind of "?z?[???R???" junk that anyone who has wrestled with non-Latin1 is most likely familiar with. (Cultural sidenote- the Japanese call that "moji-bake" or "letter ghost").

Anyway, since you can only specify the contentType property once per page translation (Tomcat throws an error if you try), how can I tell Tomcat that my included page is in shift_jis too?

I found a Sun document in which the following was written:

The page directive applies to an entire JSP file and any static files it includes with the Include Directive or <jsp:include>, which together are called a translation unit.

So, is this a Tomcat bug?

My JSP page includes several scriptlet tags, like:
<%= a_picture_for_a_button_tag %>
It works fine, but when I combine several of this tags to dynamically create several buttons behind each other, I get 'linebreaks' or 'whitespaces' between them.
Is there a way to get rid of these linebreaks that seem to be coming from the servlet-engine?
I have a .jsp page with an included file (myPage.jsp, with <%@ include file = 'includedFile.jsp'>). When I delete or modify the included file on the server, the old one still shows in my browser, even if I manually refresh/reload the whole page (i.e. refresh 'myPage.jsp'). The only solution I have found is to delete the whole page ('myPage.jsp'), and upload it again - then it includes the more recent included file.
The server is running Apache/Tomcat under Linux.
How can I model a JSP page in UML? What stereotype should I use for JSP within a class diagram?
How do I stop a JSP based download adding a newline to the first character of a file? I am using JSP to set a Content-Disposition in order to keep IE from automatically opening Excel/Word/Acrobat/etc when it sees a file type it recognizes. However, when I use ServletOutputStream to do this, for some reason I end up with a newline (ASCII hex 0A) character at the beginning of my file (I discovered this with a hex editor). This causes Word and Excel to blow up when I try to open the files because they can't cope with the extra character. (I am using the ATG Dynamo Application Server and am hoping this is not an artifact of the implementation.)

This is what my JSP looks like:

<%
// fname is the file name
File f = new File(fname);
InputStream in = new FileInputStream(f);
ServletOutputStream outs = response.getOutputStream();
		
int bufferSize = 4096;
byte[] ioBuffer = new byte[bufferSize];
byte[] lastBuffer; // last buffer
long counter = 0; // how many bytes we have gotten through
long fileSize = f.length();

response.setHeader("Content-Disposition", "attachment;filename=" + shortname);
response.setContentType("application/download");	

// in a big file, use big buffer chunks
while (fileSize > (counter + bufferSize))
{
	in.read(ioBuffer);
	outs.write(ioBuffer);
           counter += bufferSize;
}
		
// add final chunk if the fileSize does not happen to be divisible by the bufferSize
if (fileSize > counter)
{
	lastBuffer = new byte[ (int) (fileSize - counter) ];
	in.read(lastBuffer);
	outs.write(lastBuffer);
}
		
outs.flush();
outs.close();
in.close();
%>
I also tried to do this:
String headers = "Content-Disposition:attachment;filename=" + shortname + "\r\n" +
		 "Content-Type: application/download\r\n\r\n";
		
outs.write(headers.getBytes());
in place of the setHeader() and setContentType() but I end up just opening a webpage with that string followed by the bytes from the file I want downloaded.
Is it possible to view which web server or servlet engine is used: IIS, iPlanet etc. on a JSP page? Just like System.getProperty(os.name) for the operating system?
How can I create complex, pretty reports which can be printed at the client from JSP?
Does anyone know how I could display an rtf string from JSP? I have resumes stored in a database and want to display them in a browser.
I need to trap all kinds 500 error on my jsp page. I have tried the <%@ page errorPage="myerror.jsp"> but it only works on selected errors. How can I trap all errors, including syntax errors?
Can I submit multiple forms, say form1 and form2, to a JSP page by clicking a single submit button?
How can I prevent user from viewing a page that he already passed. i.e I have a form that contains some textboxes to fill some info..after submited the form it will redirect to another page. I need to prevent user to view the page again by pressing back botton.
I am using a JSP page to submit data for insert into a database.
If the refresh button (in the browser IE5) is clicked, the data is resent and inserted into the database again.

How can this be prevented?

How do I load an applet from a servlet or JSP? Where do I place my applet class files?
Why do I get the error "IllegalStateException" when using the RequestDispatcher?
Can my JSP pages be "transctive" and initiate a transaction or is this possible only with EJBs?
I want to create a dynamic tree menu from JSP to help with navigation. Is there any open source code out there to help me get started with this?
I would like to deploy the compiled jsp files rather then the jsp source. Can I precompile them and put them in a WAR file?
What calls can I make on the implicit exception object?
From a JSP page or servlet, how may I know the root context of the current web application ? I need to know this to specify the correct href even if the context may change when my app is deployed in the production environment.
Can I print the dynamic content output to my browser from a JSP page without showing the address URL?
Where can I find some example source code for transfering arbitrary files to the client browser using JSP?
Depending on circumstance, there are 2 different params that can be passed with my jsp:include. Is there any way that I could use a conditional of some sort to determine which param is passed?
How can I send a POST request from a Servlet or JSP?
Can two web applications (servlet contexts) share the same session object?
How to return a value from a servlet to a JSP?
How can I get the JSP container to realize when I've modified a file that was included using <%@ include file="XXX" %>, and to recompile files that include it?
From within my JSP page, how do I know whether the user performed a GET or POST request?
I have trouble displaying a string like "<some data>" via JSP, since they interfere with HTML tags. For example, when displaying "<user@domain.com>", the <user@domain.com> disappears. Is there any workaround for this?
How can I prevent data to be added into my database twice when using a form on a JSP page? On Browser refresh, the same data is added to my database table.
Does anybody could explain me the use of pageContext.include(String relativeUrlPath);? What is the difference with <@ include file="..."> tag?

I have a JSP which does some intensive I/O and consequently takes approximately 20 seconds or so to load. How can I create a "loading...." message/HTML page which is invoked while the page is processing and then gives way to the JSP?
Can I use either the include directive or include tag to bring in a static HTML file that is residing on either a different server or on the same machine but outside the directory structure of the web server?

I need to do a lot of background work in my jsp and i do not want to keep my client waiting. Hence i want to redirect my client to main menu page and continue with my processing. Is it possible to implement this using multi-threading in a JSP?
Is there a way how the output of a JSP page could be compressed by removing all CR, TABs, SPACEs from the HTML?
How can I send email from a JSP page with HTML format?
In my JSP file i am trying to use getRemoteHost() method to retrieve the computer name. It works in all the systems. but in one machine instead of displaying that computer name it is displaying the IP address of that computer. I dont know why it is displaying like that. do i need to change any settings in that particular machine ?
Can my JSP application validate users against an LDAP server which contains the userid's and passwords for all the employees? If so, how can I connect with the LDAP server and perform this authentication?
I want to download files within a client browser from a web server using JSP. How can I do this?
I have a problem and I'm hoping you can help me. I have a jsp that's displaying data, which length depends on the user. It takes up to 10 minutes sometimes to display a page. I don't want to break my page into multiple pages, but what I want to do is to display line by line on the screen as the data is being read. What happens now, is the browser waits until all the data is processed and then displays a page. Any ideas how to do this?
Are global variables in the included file (using <jsp:include/>) available in the file that includes it?
How can I read a text file from a JSP page?
How do i specify Application-level variables in JSP?

I want to do something similar to the global.asa in ASP, where I can specify application and session variables.

I have developed a site in JSP. Whenever I type www.name.com in address bar the url changes to www.name.com/index.jsp. How do I prevent the index.jsp from showing up in the address bar?
I'm working on the chinese version of our project. I already set the charset to GB2312 for all jsp pages to display simplified chinese correctly. Now I need to pass data within forms between jsp pages. In the english version, we used request.getParameter to receive these data, but after changing the charset setting, it causes the get data to be unreadable. Any solutions on how I can overcome this problem?
My JSP application runs fine sometimes, but on other instances, when i try to refresh the page, the server outputs only a part of the page. In the Tomcat Console, I see "IOException, Connection reset by peer". If I keep refreshing the page, it loads the complete page at some point. Otherwise I have to restart the server and try again. Any suggestions on how I can overcome this?
We are building a series of JSP pages, each of which is responsible for producing a different area of the screen. Any given screen that the end user sees, therefore, is made up of a number of "blocks", each of which has been generated by a single JSP. The top level JSP calls in the "blocks" using a jsp:include. We are trying to use the JSP errorPage directive on every JSP to display an error to the user if something goes wrong with any of the "blocks", but are finding that we end up with the error page only taking up part of the screen (for the block which had an error), whereas we would like the whole screen to be filled up by the errorPage. In other words - if something goes wrong with any of the blocks that comprise a screen - we would like to display nothing but the error page. What is the best way to do this ?
I'm working on the JSP - Tomcat model, I'm using JSPC to pre-compile my JSPs, Is there a way to prevent any new (non pre-compiled) JSPs from being executed (compiled) in tomcat? ie. I do not want any new JSPs , which have not being pre-compiled to be executed via tomcat on the browser, Is there any property/configuration file which I need to change in Tomcat??
Here is what I have:

1. My application is under /opt/tomcat/webapps/myApp
2. My jsp file is : /opt/tomcat/webapps/myApp/web/test.jsp
It contains;
. . .
<%
String configFile=getInitParameter("configFile");
System.out.println("configFIle="+configFile);
%>

3. My web.xml is: /opt/tomcat/webapps/myApp/WEB-INF/web.xml
It contains: <web-app>
<servlet>
<servlet-name>test</servlet-name>
<jsp-file>/web/test.jsp</jsp-file>
<init-parameter>
<param-name>configFile</param-name>
<param-value>TOTO</param-value>
</init-parameter>
</servlet>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/web/test.jsp</url-pattern>
</servlet-mapping>
</web-app>

What am I doing wrong?

How can I distinguish b/w 2 buttons which are submitting the same form from within my JSP page? I'd like to solve this problem without using JavaScript.
I have included some audio files in a jsp page. The audio files are in .rm extension. When I click on the hyperlink for the audio file in the browser, instead of playing the audio, it shows some junk data in the web page. How do I remedy this?
If I have a URL (GET) param and hidden (POST) field in a form with the same name, how can I get and differenciate them? I have the following code:

<form name="someForm" method="post" action="somePage.jsp?id=100">
  <input type="hidden" name="id" value="200">
</form>

I need to differenciate between the id in the URL parameter and the id in the form. I know you can use getParameterValues() to get multiple values but I need to know which one belongs to the URL or form because sometimes I will get only one of them. Is it possible?

Can someone explain to me what this code does and what situations it needs to used? <head> <meta http-equiv="refresh" content="0; url=/targetpage.jsp" /> </head>
How can I get the complete URL address (like "www.jguru.com" (with or without "http://")) from a HttpServletRequest?
My Jsp file need to forward a request to another servlet which is located in another Web Application on another machine. How can I do that? If I also want to add more parameters to the original request from the jsp file, what should I do?
I need to allow users to upload files and pictures.
When they upload pictures, I need to create thumbnail for them on the fly.
Is there any taglibs or java source to do this from JSP or servlets?
I need to allow users to upload files and pictures.
When they upload pictures, I need to create thumbnail for them on the fly.
Is there any taglibs or java source to do this from JSP or servlets?
How can I make a JSP page implement the SingleThreadedModel interface?
I have several jsp pages that are referenced in an SSL server, and non-SSL server. To avoid the "this document contains some unencrypted data" error, I want to have it look at the HTTPS variable apache sets and see if its in secure mode.

So, if $HTTPS == on, I want to write:
img src="https://content.domain/images/foo.jpg"
else I want to write:
img src="http://content.domain/images/foo.jpg How do I do this?

How to close database connection explicitly when session is ended?
In my jsp page I have 2 combo boxes--data of 2nd comboBox is dependent on the 1st. The data for both is previously obtained from a database.

I'm kind of new to JSP, and am working on putting together a framework wherein I include common elements of a page (title bar, menu, etc.) in a single WAR file and then attach those elements to my content pages that belong to another WAR file.

The problem I'm running into is that my include statements in my content pages don't work when I try to include items from the different WAR. I can bring the included pages up, but can't get a JSP to include them.

<h4>Example:</h4>

In shared.war, I have the file /htmlcommon/header.jsp. In search.war, I have the document /search.jsp

In search.jsp, I have the following include statement:

<jsp:include page="/shared/htmlcommon/header.jsp"/>

However, when I load the page, the header doesn't come in and I get an error 404 - not found.

I'd appreciate any thoughts on this. Thanks much

Michael Lundin
michael.lundin@summitsite.com

How can I find out the name of the machine on which the JSP is executing?
I am aware of the technical differences between response.sendRedirect() and <jsp:forward...> i.e. that the first one sends an instruction to the browser to request the specified page, and the second simply sends the specified page.

However, can anyone tell me why one should be used instead of the other?

Does Buffer size affects the performance in any way? I am using buffer size as 100kb.will it in anyway affect the performance? If yes what is the optimum size that can be used? If no why?
Are Page scoped variables available across multiple requests to the same page? If this is not the case, what is the difference between request scope and page scope for JSP? Also, is this data available even when something like a query string is changed?

Does anyone know the pro's or con's between developing a site for 2k users in either JSP or ColdFusion? What is faster development done in? How well does JSP scale when compared to coldfusion?
In one of my applications i am using jsp for all reporting. But the problem here is that the window.print() command will print everything on screen.
Is it possible to print only a part of the scrren, say the data displayed in a table?
I have taken parameters of a form from a jsp. I need to pass that parameters to another jsp. How can I do it without writing that manually using string like another.jsp?name=value. Since there are many paramters, passing through URL is inconvenient. Is there a way to do it ?
I have to deploy a war file. 
the structure is
/contextroot
  jsp
    test.jsp

  web-inf
    classes
      util
        Connect.class
        connect.properties
 
The Connect class has to load the properties file. 
howeever i get error reading the file using getClass().getResourceAsStream("connect.properties");

I am deploying it in tomcat.
It reads the file if i put it in /bin folder ..
how do i avoid this ?? 

Can u please post a code example
I have to deploy a war file. 
the structure is
/contextroot
  jsp
    test.jsp

  web-inf
    classes
      util
        Connect.class
        connect.properties
 
The Connect class has to load the properties file. 
howeever i get error reading the file using getClass().getResourceAsStream("connect.properties");

I am deploying it in tomcat.
It reads the file if i put it in /bin folder ..
how do i avoid this ?? 

Can u please post a code example
I am calling my EJB method "transfer(request,destination)" from inside JSP page.

"request" is a HttpServletRequest object
"destiation" is a string

it is throwing following exceptions.....

java.rmi.MarshalException: failed to marshal public abstract void project.upload.Copy.transf er(javax.servlet.http.HttpServletRequest,java.lang.String) throws java.rmi.RemoteException,j ava.io.IOException; nested exception is: java.io.NotSerializableException: weblogic.servlet.internal.ServletRequestImpl java.io.NotSerializableException: weblogic.servlet.internal.ServletRequestImpl


actually i am trying to uplaod files and in JSP i use <input type="file"> tag to select a file inside a form.the logic is this that request object also have the file stream and using ServletInputStream in = request.getInputStream();

i can get the file stream and then save this stream in a new file

Why it is giving exception and any other way to upload files?

Can my JSP page access initalization parameters from the servlet context?
What is the easiest way to convert the output of a JSP to PDF?
Can any one post a - code snippet - which can create a .txt file on the application server - using the text from a "textArea" on a JSP page. (Basically the user types some text on the JSP on a client and the text should be saved to a txt-file on ap-server.)
Need some assistance on this one. I am very new to managing a java environment and a production application appears to be having a major memory leak. Am currently using JDK 1.3 on a Sun box running Sol 2.6, with 2GB of RAm, and using Orion 1.5.1. I have -Xmx set to 756MB. When Orion is started the heap immediately grabs 512MB, then over the next 6 - 8 hours the heap slowly consumes all but 30 or so MB of RAM on the box, totally disregarding the -Xmx setting. Additionally, if we run a bootstrap of our a client during this time memory consumption is accelerated drastically. Any insights would be greatly appreciated.
I have a Jsp page that accepts some parameters from the user. Now if the user clicks on the Submit button in rapid succession, multiple entries are inserted in DB, though I am checking for duplicate entries. This works fine if the user enters the same data after some time. It gives appropriate message saying "Duplicate record".

Please use html tags to format code blocks.

I am using Resin2.0. In our Intranet, all the user requests are directed to a servlet which does the authentication and redirects to the respective jsp files. Users are not supposed to access the jsp files directly. How to prevent, if a user access the jsp file directly by typing the url...This is possible after establishing the session...Is there any way to check this in the resin configuration, so that automatically redirecting to the servlet....In resin.conf some mappings can be done for servlets..Is it possible for jsp..?
I'm running into a problem when I encounter a coding error in my jsp file, go and fix the error, save it, and try to access the page with my changes. The server (Tomcat 4.0) persists in giving me the old version of the file.

I tried 1) shutting down and restarting Catalina, then 2) shutting down, deleting the .java file for the page from work\myWebApp, and restarting. I'm still getting errors related to code that no longer exists in the page.

Does anybody know of any available classes that can create word documents on the fly? (or RTF format)
I am trying to pass some parameters from one server to a JSP page on another server, and the receiving JSP page writes those parameters to a text file. I know the JSP works because if I put the following URL in a browser window, it works:

http://www.myapp.com/remote/mainpage.jsp?ddl=8766&com=comment&opr=OP000

But if I try to pass those parameters to the JSP from an application on another server, it doesn't work. This is the code I am using to send the parameters:

HttpURLConnection con = (HttpURLConnection)new URL(url).openConnection();

con.setRequestMethod("POST");
con.setDoOutput(true);
OutputStream out = con.getOutputStream();

// data is the line ddl=8766&com=comment&opr=OP000 as in the URL above
out.write(data.getBytes());

out.flush();
out.close();
con.disconnect();

I used getOutputStream() of response object in JSP. Below is the code for download a file in JSP.
%>
<%@ page import="java.util.*,
				java.io.*"
%>
<%@ page language="java"
		 session="false"
		 contentType="text/html; charset=8859_1"
%>
<%
	//read the file name.
	File fFile = new File ("D:/Ibs/outdir/batchres.conf");
	String stFileName = "batchres.conf";
	//the content type set as excel
	response.setContentType ("application/excel");
	//the header and also the Nameis set by which user will be prompted to save
	response.setHeader ("Content-Disposition", "attachment;filename=\""+stFileName+"\"");

	//Open an input stream to the file and post the file contents thru the
	//servlet output stream to the client m/c
	InputStream isStream = null;
	ServletOutputStream sosStream = null;
  	try
  	{
  		//response.flushBuffer();
		isStream = new FileInputStream(fFile);
		sosStream = response.getOutputStream();
		int ibit = 256;
   		while ((ibit) >= 0)
   		{
        		ibit = isStream.read();
        		sosStream.write(ibit);
                      }

	}
	catch (IOException ioeException)
	{
             }
    sosStream.flush();
    sosStream.close();
    isStream.close();
%>
If run this code in Tomcat i am getting following error.. ÿ<h1>Error: 500</h1> <h2>Location: /imu/jsp/ibUTLCmnDownloadView.jsp</h2>Internal Servlet Error:
java.lang.IllegalStateException: getOutputStream() has already been called
	at org.apache.tomcat.facade.HttpServletResponseFacade.getWriter(Unknown Source)
	at org.apache.jasper.runtime.JspWriterImpl.initOut(Unknown Source)
	at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(Unknown Source)
	at jsp.ibUTLCmnDownloadView_12._jspService(ibUTLCmnDownloadView_12.java, Compiled Code)
	at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
	at org.apache.tomcat.core.Handler.invoke(Unknown Source)
	at org.apache.tomcat.core.Handler.service(Unknown Source)
	at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
	at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(Unknown Source)
	at org.apache.tomcat.facade.RequestDispatcherImpl.forward(Unknown Source)
	at JP.co.Hitachi.soft.IBS.Common.Servlet.ibUTLCmnDownloadScrGenServlet.doPost(ibUTLCmnDownloadScrGenServlet.java:75)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
	at org.apache.tomcat.core.Handler.invoke(Unknown Source)
	at org.apache.tomcat.core.Handler.service(Unknown Source)
	at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
	at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
	at org.apache.tomcat.core.ContextManager.service(Unknown Source)
	at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Unknown Source)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Unknown Source)
	at java.lang.Thread.run(Thread.java:479)
Can any one help me out? -Rangaraj
Is it possible to have a vertical scrollbar with a jsp which in tern is a part of some other jsp? I don't want to use frames.

I thought if we set the size of the included jsp with <jsp:inlcude> tag it may create an automatic scrollbar. Do anybody have idea about this?

Thanks, Anshul.

I'm looking for a complete list of the "User-Agent" params in thge request header from all browsers. I don't have all browsers running on my machine, and IE doesn't even let you run multipe versions anyway.

Thanks very much,
Joost

I have a question about how I might call/invoke a JSP from another Java class (which is not itself a Servlet) using the Servlet/JSP container.

For instance, I'd like to use a JSP to automatically generate the body of an e-mail message on a scheduled basis. In this situation, there wouldn't be corresponding Request or Session objects.

Are there any methods that can be called on the Servlet/JSP container which would (a) trigger the compilation of the JSP page into a servlet (if needed) (b) return the response stream of the JSP (i.e.: service method).

Alternatively, is there anyway to use the getRequestDispatcher or getNamedDispatcher methods to get a handle to a JSP.

While, I'd like to use a standard container-neutral facility for doing this, I'd also like to hear about container-specific alternatives which might only work on Tomcat, BEA WebLogic, etc.

Any help is much appreciated.

I need to see the servlet (.java) code of a simple JSP code like this:
<HTML>
<BODY>

<% out.println("Testing."); %>

</BODY>
</HTML>
I installed Ant 1.5 and Tomcat 4.1.12.

build.xml file for Ant is like this:
<project name="Test" default="compile" basedir=".">
    <description>
        simple JSP compile
    </description>

  <target name="compile" description="compile the source " >
    <jspc srcdir="."
          destdir="."
          verbose="9"
          classpath="C:\temp\Tomcat-4.1.12\common\lib">
      <include name="**/*.jsp" />
    </jspc>
  </target>
</project>
that common/lib includes jasper-runtime.jar and jasper-compiler.jar.

and when trying to compile:
C:\temp\test>ant
Buildfile: build.xml

compile:
     [jspc] Compiling 1 source fileC:\temp\test
  [jasperc] java.lang.NoClassDefFoundError: org/apache/jasper/JspC
  [jasperc] Exception in thread "main"

BUILD FAILED
file:C:/temp/test/build.xml:10: Java returned: 1

Total time: 3 seconds
C:\temp\test>
Any ideas?

Is there any other way to compile single or few JSP pages, so that I would see the servlet code? I'm using JBuilder6 and as far as I know its not possible to see servlet code in JBuilder.

TR
How can I access an NNTP newsgroup using JSP or Servlets?
Usually, while developing applications, there is a common header and footer for all pages.Such header and footer pages can either be saved as a jsp file or as a html file. If there are no dynamic contents in the header & footer file, then,is it advisable to save them as html pages and then use the <% @ include file="header.html" %>. Or is it advisable to have it as a jsp file and access it using the tag <jsp: include page="header.jsp">.
What is the best practice for providing "in-page" security. Let me define what I meant by "in-page" security:- Ability to view buttons and other field elements if users are in certain groups and the inability to see them if users are in some other groups

My setup in DB is such that, users who can belong to 1 or more groups. And I have in place a permissions table which was made to accommodate permissions for groups(a group can have zero or more permissions.)But dunno whether to use this table or not because permission-ids may have to be hard-coded in logic

Have thought :
a)of giving separate pages for separate groups.
Which would be a maintenance nightmare, to say the least.

b)of using logic that queries the DB and gets the perm-ids and then finds out if a something should be visible or not

e.g:-To see an "Update" button on a page I will do the following...First get the perm-ids of the group the user is in and store in an ArrayList/Vector. Then see what the "update" perm_id is in the DB. if(update_perm_id is in ArrayList){then..show the Update button}
Two downsides I see:-
--Worried that if somebody screws with the perm ids in the DB(change an id, for example by mistake) this could break logic.
--Also there would be lots of "ifs" in the view page(the jsp page) which would go against MVC

c)of making in db, tables connecting user interface and field elements and user-groups..and thus enabling a bit field to say if a certain field is visible or not visible.

Confused as to what the best way to provide in-page security is...What is the best practice out there for "in-page" security for web apps?

I need to display pictures (to the client browser) that are located elsewhere than in my application directory.

I cannot succeed so far because, as I understand, the tags use a path relative to the webapp directory and do not see anything elswhere - Anyone, any idea????

Many thanks for your help

I want to redirect users to a secure site. Below is serverside code written in ASP. I would like to know how I can do the same in JSP.
<%
if (Request.Servervariables("SERVER_PORT")=80 then 
path="https://"
path=path & Request.ServerVariables("SERVER_NAME")
path=path & Request.ServerVariables("URL")
if (Request.ServerVariables("QUERY_STRING")<> "") then
path=path & "?" & Request.ServerVariables("QUERY_STRING")
end if
response.redirect path
end if %>
When the user tries to access the document, the web server will check to see if he/she is using https, if not the user will be immediately redirected to the SSL Secured site.
   This is a post the goes along with my previous message. I have a servlet in which I need to forward the request, however, I need to remove some of the values.

   For instance, if I have request.getParameter("txtLogin"); After this value is received by the servlet, I need to set that parameter to an empty string. I tried using request.setAttribute("txtLogin");, However, must not understand the setAttribute method properly becuase that didn't do it. In fact, I tried to print out all available attribute names, and the getAttributeNames() method returned an empty Enumeration.

   In short, how do I empty out values from an HttpServletRequest object. Thank-you

I'm working on a web application.in the login page,I have to check the user password and compare with the encrypted password stored in database. anybody can recommand some easy encryption sample to encrypt and decrypt password
How can I set parameters in a JSP, something equivalent to setAttribute on a request object? That is, I need to do setParameter in order to read it as getParameter in the servlet.
How can I optimize my JSP pages for better search engine placement?
How to show money format on the JSP page? In a Bean i have some this like this:
public vector getIncomeReport(){
     conn
     sql statement
     while(rs.next()){
     incomeReports.frBeginningBalance = rs.getDouble(1);  
}
so i am getting the Amount value from the Oracle DB as getDouble, but actually in Oracle Column the value is something like this: 29383060.16 but on the JSP page it display as : 2.93830602E7. So how to get the money mask on the JSP page like:
2,93,83,060.16 Any help greatly appreciated. Thanks in advance.

I have some small jsp fragments stored in a database. The fragments are templates that are used to display objects in my system.

I need to have a jsp page that will list all these templates and provide a preview of each. As a result, I need to find a method of embedding them in the jsp page and having the fragments evaluated.

I originally attempted this by using a custom tag that returned the jsp as its body. However, I read somewhere that the bodyContent was evaluated before it was provided to the tag.

I also attempted to do this by dynamically including the fragments from a servlet, but that didnt' seem to work (threw a java.io.IOException: Stream closed). This method may be possible, but I would really like to handle this without doing it this way. (However, I will if I have to).

Does anyone know of a good way of doing this?

How to output/dump JSP data into a pdf file???

The mime type for word is the following <%@page contentType="application/msword" %> and works fine.

On using the mime type of PDF , it is not working
What might be the problem???
I got the following email from the project manager:

"The issue of security and firewalls has creeped up on us. 'Someone' has pointed out that JSP is a security sieve. Jie, what we are trying to determine is, 1. Have you been using JSP for your applications? 2. If so, are some of them older/not used anymore, and are others at a stage where conversion to PHP can be down with a reasonable amount of back-coding?"

Can someone tell me if the above statement makes sense??
In my JSP page i want to provide dynamic path substitution of HREF value in anchor tag .... Instead of giving like following:
link to test JSP
i want to subtitute the value for HREF through a string variable declared and populated based on some valid input within the JSP... How to handle this case....... I will be glad for getting a way for this..

I have to implement a download module wherein I have to
give only registered users the requested files.
The catch is, it has to be implemented in a manner, such
that, the user should not actually make out the link.
i.e., the user should not get the href links.
I think, it is somewhat similar to how BEA implements their
WebLogic downloads.
And it has to be secure with session tracking facilities.

Can I have any code snippets or any methods / algorithms
or any links to the websites explaining how such downloads
can be implemented?

Thanks in advance.
I want to download the file, whatever the type of the file may be. If i select to download the doc type file, it should open in the word doc only, but not in the notepad. similarly for images also.and for txt files it should open in the notepad. anyone have the coding for the above?
Please can anyone tell me how i can tell if the remote browser has been closed half-way through the execution of a jsp program. I must be missing something very simple as it is a very important feature of jsp, so could someone please educate this poor peon on this topic.

i need a solution that is not ie only or netscape only if possible.
Thanks

Can I get a code snippet or a reference to any website on how to run and close an external application from the JSP page or through a servlet? Like, Is it possible to run MS-WORD through a click on the JSP page?
I have a jsp with a textarea field. The user can enter any text inside that . The problem here is when the user enters any html tags inside that ,then the format of the output is changed .So I want to restrict the user / remove the html tags inside the textarea .
I have written a static method in java class to read application specific properties from property file. This static method can be used by JSPs and other java classes. In order to load properties, I have to provide real path of the properties file. Since, this path is different on dev, staging and production m/c, I would like to use ServletConfig.getRealPath("/") in java class. I tried to get this by adding following statement:
String path = javax.servlet.GenericServlet.getServletContext().getRealPath("/");
It gave me the following error at compilation:
non-static method getServletContext() cannot be referenced from a static context

Please help me to resolve this problem.
Thanks in advance.
Rakesh.

Whenever I send a € (euro) sign to the server, I receive a ? at the server. How do I solve this problem?
What is the scope of <%@ page errorPage="" %>? Does it get passed to jsp:forwarded pages? Does it get passed to jsp:included pages?
How can I prevent my public JSP page from appearing within the search results of an engine like Google or Yahoo?
Retrieving values from HTML form input elements in JSP.

How can I display different currencies in my JSP pages according to the location of the client.

How can I serve Word/Excel documents to a web client from JSP's and/or servlets?

What is the JSP equivalent to header("Location: login.php"); in PHP? I want to open a new page in the same window.

How can I print the stack trace of an Exception out to my JSP page?

What is the difference between request.getParameter() and request.getAttribute() ?

How do I import my own java packages and classes for use in JSP pages? In what directory should they reside? How do I put them on the CLASSPATH?

What is the difference between RequestDispatcher's forward(ServletRequest request, ServletResponse response) method and HttpServletResponse's sendRedirect(String location) method?


Java:API:JSP:Architecture
Where can I find more information on "Model1" and "Model2" JSP architectures?
How different is JSP architecture from ISAPI architecture?
Could you describe the architecture behind jGuru.com: JSP, Servlets, database, servers, transactions etc...?
What is the recommended, "best" architecture for JSP applications?
What is the best way of implementing a web application that uses JSP, servlet and EJB technologies all together following a Model View Controller (MVC) architecture?
What are some strategies for developing 24x7 applications using JSP?
What is meant by the term "business logic"?
What is a three-tier architecture?
What is the Command Pattern? How can it be used with designing web applications using servlets and JSP?
Where can I learn techniques for building Internet applications using servlet and JSP technology?
Are there any web portal frameworks featuring login forms, personalization & membership, etc. that are built entirely using JSP custom tag libraries?
Could you discuss some guidelines to determine when it is best to use JSP vs. XML/HTML from a performance point of view, and some of the pitfalls?
How can a JSP on server X access/create a remote EJB running on another server Y?
How should I model parameter passing in JSP and the relationship between JSP and JavaBeans using UML?
How can I create a protected, "restricted" website? I.e., where someone can only access the site by e.g., entering a password.
Is there a recommended way to validate form data entered by the user? Should I do it on the client or the server?
I have a requirement to design a JSP forms-based application that uses at least 700 data fields. How can I design my application for something like this?
In order to find the proper URL to which to submit forms, I need to manually set the context name in every URL, using somthing like:
<form action="<%=pageContext.getServletContext()%>/doThis" method="post">

But this seems like a round about way to go for something so simple. Am I missing something here?

How can I implement the MVC design pattern using JSP?

In an MVC architecture how can I pass a bean to my JSP page from my controller?


Java:API:JSP:Custom Tags
Is there a standard set of tags for JSP?
How do I use the taglib directive to add custom tags to JSP?
Custom tag libraries and Java Beans are both ways to seperate logic from the content in JSP pages. Can you illustrate particular scenarios where it may be beneficial to use one over the other?
Where can I find an example showing a JSP taglib attribute that takes a scriptlet expression(i.e. value is not a quoted string, but a variable evaluated at run-time)?
How do I parse custom tags in an HTML file? eg:<mytag name="aaa">xxx</mytag>
Is there support for tag libraries in an IDE like Forte or JBuilder? If so, how do you deploy tag libraries in the IDE?
Are there any (GUI based) tools avail for taglibraries (.tld - files), that support editing of them (adding/deleting tags/attributes, editing properties, etc.)?
When using a tag from a tag library, is the body allowed to contain another instance of the same tag? For example:

<lib:tag>
  some stuff in the outer tag's body
  <lib:tag>
    some stuff in the inner tag's body
  </lib:tag>
  even more stuff in the outer tag's body
</lib:tag>

I have a simple tag that I have created, and I get an error when the jsp engine trys to compile something similar to the above. The errors says that it did not find the end tag for the first tag. Is there something special I need to do in my tag handler?
Is there a custom tag which can be used to implement iteration within JSP pages?
Can anyone show me how to include a servlet within a tag? I wrote a custom tag and in the doEndTag() method I want to include a servlet. I tried doing this with a RequestDispatcher object, but it did not work.
Can anybody point me to any example of a taglib and tld packaged within a jar, and some jsp code using that taglib?
Is it possible to use
<jsp:getProperty name="aBean" value="aProperty" />
inside a customg tag attribute?

I would like to be able to use something like:

<mylib:mytag key="myKey" arg0="<jsp:getProperty name="aBean" value="aProperty"%>" />

(In the tld I've setted arg0 to be rtexprvalue=true.)

Does making a significant use of taglibs affect performance? I am especially worried about the effect of all the object instantiations in the background on a high volume site.
Using TagLibraries in Tomcat, Where should I include the taglibrarydescriptor files (.tld file)?
Can someone please give me a very simple but comprehensive description of using the Tag Extra Info classes for Tag Handlers?
How can I use the the result of isValid() method of TagExtraInfo class in my application to validate the attributes of a custom jsp tag since my tag class and the class which extends TagExtraInfo are different classes?
Is it possible to process JSP code written by a custom tag? I have a custom tag that performs a xsl transformation. This tag writes the output to the jsp page that's including the tag. My problem is the result of this transformation may contain scriptlet code or calls to custom tags. Since this result is being written to the jsp page by the tag, this code is not processed by the JSP engine and is output "as is". I'm looking for a way to process the scriptlet/custom tag code after it has been written by the transformation tag. Is there a way to do this on the main JSP page, or possibly in the transformation tag itself? Any help is appreciated, thanks!
When should I use a JSP tag library and under what scenario must I use JavaBeans?
I am tring to use a jsp file with custom tags as the src for a frame. While the file works fine when being included via a jsp include, it does not work when being included as the src for a frame:
<frame src = "myjspwithcustomtags.jsp" >

It doesn't successfully process the tags, but instead replaces every starting "<" of a tag with the string < and leaves the rest of the tag def alone. So the resulting view source looks like:
<%@ taglib uri="struts-html.tld" prefix="html" %>
<%@ taglib uri="jakarta-utils.tld" prefix="utils"%>

Any ideas on how to successfully use jsps with custom tags with a frame?

How can I use a variable defined in a tag library inside a declaration? For example, in:
<jsp:useBean id="dbCon" class="com.vignette.cds.client.beans.DBConnection" scope="page"/>
I need to use the variable dbcon inside a method that is in a declaration:
<%!
   void mostrar_canales (int canal) {
      Connection con = null;
      con = dbCon.getConnection ("content");
...
%> 
I know I can get JP tag attributes with setXXX() method but I want to know if it is possible to modify attribute values within a tag handler.

For example:
I want to do iterator tag that iterates over a list and at each iteation it can assign the current iterated value to one of its attributes and cause the JSP page to display different values at each iteration. Is there any way to do this?

Is is possible to conditionally output some text in a JSP custom tag body? I'd like to be able to, on the first loop of the JSP custom tag body, add a line of text to the top of the body, than for each successive loop of the JSP custom tag body, output the text without the added line.

For example:

<info:x query="Doe">
<%= name %>
<%= address %>
<p>
</info:x>

In the above example, the first time the body is outputed, I would add the string "items returned: [count]" and the name and address of the first item returned. Than for each additional time the body is printed, only the name and address are outputed.

For example, say the query returned 2 results...

items returned: 2

John Doe
123 Anywhere St.

Jane Doe
1234 Some Other St.

Notice how the "item returned..." line is outputted with the first item returned? That's what I'd like to do.

I want to use the logger taglib from Jakarta which uses log4j. Does anyone have a sample log4j properties/initialization file that they would post so that I could take a look?
Using Jasper and taglibs, how do I avoid the error "Code of a method longer than 65535 bytes"? I am working with Tomcat 3.2.x. I made a taglibrary (that includes just one tag, for testing) and implemented the tag in java (a simple one, it's just writing a text). I put that tag into a JSP page and when I go to that page, the tag displays a text on the screen. Everything works just fine, but if I have a greater number of tags inside the JSP (about 170), then I get an error message. Tomcat makes the .java -file, compiles it to the .class file, and then just before displaying the text, I get the following err.msg: "Code of a method longer than 65535 bytes..." Thanks for any help I get ! Bye, Nico
Is it possible to invoke customtags onEvents like onClick?
Can I make a jsp custom tag to return a value in to a jsp variable.

I want a jsp custom tag to evaluate some condition based on the parameters I pass and return a boolean to the jsp page in a java variable (type boolean).

Can anybody give some sample of the code using similar functionality.
Can we some how use the get methods in the tagHandler in our jsp to retrieve the values?

Can Tag Libraries be used to internationalize an application? If yes, then what are the advantages and disadvantages?
Where can I find a JSP tag library for sending mail from JSP pages via the JavaMail API?
Is it possible to call a custom tag from another custom tag? If so how?
What are the different ways of declaring a tag library to use from a JSP? Which methods are compatible from any JSP container? What are the different ways of declaring a tag library to use from a JSP?
Which methods are compatible from any JSP container?

Assume the following directory structure of a WAR deployed under Tomcat 4.0:
Files in / directory:
test.jsp

Files in /WEB-INF directory:
web.xml
ha.tld

Files in /WEB-INF/lib directory:
ha.jar

Files in ha.jar:
/meta-inf/taglib.jar
class files for tag handler(s)

I have these files in folder /lab/reports:
a.xls
b.pdf
c.txt

How can I display the filenames(b.pdf)in a page using JSP?

Can JSTL use connection pool? Can anyone give an example scripts and configuration files?

Java:API:JSP:Custom Tags:Open Source
Are there any custom tag libraries available for JSP?
Are there any sites that maintain libraries of useful JSP taglibs?
What is JSP Standard Tag Library (JSTL)?
Can I make use of scripting languages like Tcl, Perl, Python, Rexx, etc. within my JSP pages?
Can I have Perl syntax regular expressions within my JSP pages?

Java:API:JSP:Debugging
How does JSP handle run-time exceptions?
How can I get to view any compilation/parsing errors at the client while developing JSP pages?
Can I invoke a JSP error page from a servlet?
How can I get to print the stacktrace for an exception occuring within my JSP page?
Are there any IDE's which will help me debug JSPs?
How can I use JUnit to ensure that my servlets/JSP are producing valid HTML?
How do I write to a log file using JSP under Tomcat? Can I make use of the log() method for this?
How can I write an "error page" -- that is, a servlet or JSP to report errors of other servlets?
How can I profile servlets or JSPs in Tomcat using JProbe?
I have a JSP file with about 100 custom tags and when it compiles in the JSP container (tested with Tomcat and Jetty) the JVM takes up to 100Mb of RAM (peak) and crashes if no more memory is available. To solve the problem temporarily I choose to work with tags without body and using the pageContext.getOut().print() methods for single values. Is there any way to make this procedure take less memory? When it's compiled it takes about 20Mb of memory on each request which is ok.
How can I use a JSP as an Apache ErrorDocument -- so Apache will display its errors using my JSP?
I have an error page that is handling my exceptions. Is it possible to access session data from within the error page when the request is forwarded to it upon an exception? I am getting a null when I do a session.getAttribute().
Is it bad form to put most of your code in a try catch block? I am using an error page to catch my exceptions but some of them are slipping through.

I am tempted to wrap everything in the try catch so my users never see an ugly "null pointer exception" again.

Any suggestions?
I'm specifying the error page as a page directive in a page. When there is an exception in the JSP page, the error page is called. I want to pass a parameter from the current page to the error page when there is an exception . Is this possible?
I want to create a Error Page and save the StackTrace within a String type variable.

My code is:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="java.lang.Exception,java.io.*"%>
<%@ page isErrorPage="true" %>
<html>
<head>
<title>Untitled</title>
</head>
<body>
Fehler!!!!

Fehler: <%=exception.getMessage()%>

<% PrintWriter writer = new PrintWriter(out);%> Stack: <% exception.printStackTrace(writer);%>

getLocalizedMessage = <%=exception.getLocalizedMessage()%>

toString = <%=exception.toString()%>
</body>
</html>

But here, the StackTrace is printed directly within the Page. How do I save it in a String variable? I want to send myself an automatic report if there is any error.

Using JSP I can use implicit object exception when my JSP page is declared with <%@ page isErrorPage="true" %> directive. But how to get this reference programmatically, for example with a servlet ?
I am trying to use Log4j with jsps. I am using the log taglib from jakarta along with Log4j.

I wants to do the logging for any kind of exceptions also. I tried to use the log tags in expection. But, it didn't work.

How can i use the same for logging expections too. Please reply.

Thanks and regards,
Can anyone tell me where to get the response information for an error condition.
I have a JSP that handles all my errors and I would like to get the "404 - File not found"
text (or whatever other text there might be for other conditions).
If anyone has some sample code I would appreciate it.


Java:API:JSP:JavaBeans
My JSP file compiles just fine...but I always get a NoClassDefFoundError when I try to access a bean via the useBean tag. Why?
How does a servlet communicate with a JSP page?
Show me an example of POST request chaining using JSPs and servlets.
Can a JSP page instantiate a serialized bean?
How do I use a scriptlet to initialize a newly instantiated bean?
How can I maintain "application scope data" in Servlets or JSPs as ASPs do?
How do I instantiate a bean whose constructor accepts parameters using the useBean tag?
Is it possible to use visual JavaBeans with JSP?
How can I access the same JavaBean instance from different JSP files?
What are the advantages of using beanName in the jsp:useBean syntax?
Why should I use the <jsp:useBean> tag, instead of just instantiating beans directly inside scriptlets?
What servlet code corresponds to the various "scope" values for the <jsp:useBean> tag?
Is there any difference between the attributes class=com.myco.MyClass and the beanName=com.myco.MyClass attributes in the <jsp:useBean> tag?
Is there a way for JavaBeans (not EJB) to communicate directly with each other, or to know what other beans are currently in scope? Is it necessary for me to use a JSP to tie two beans together?
How do I pass values from a list box (with multiple selects) to a Java Bean?
Why does jsp:useBean ignore packages that are imported for the classname?
How can one access the servletContext object from within a bean that was instantiated using <jsp:useBean ... />?
How can I access an already initialised (in a jsp) JavaBean with "application" scope in a standard Java class. When I try to create the bean it creates another instance of the application scoped JavaBean rather than using the one that already exists.
Can JavaBeans used through JSP use BeanInfo classes? For instance, if I have a class that doesn't use the set/get naming convension, I'd like to be able to provide a BeanInfo to map the appropriate methods to these capabilties.
What happens when a session times out in a JSP page and I then try to access a session-scoped bean?
Can I remove a bean from a session in JSP when the bean was set up using the <jsp:useBean ... scope="session"/> tag?
How can I instantiate an object of a class(MyClass) within a JSP page ?
How can I import bean that is made up of multiple classes (inner classes) wthin a JSP page?
Where can I learn (more) about Java's reusable software components, JavaBeans?
Suppose a JSP form has, among other elements, a listbox that allows the user to make multiple selections. After the form is submitted, I want to send the request parameters to a bean via <jsp:setProperty ... property="*"/>.

Is there a way to have the * populate the bean's corresponding String or String[] with ALL the selections from the listbox, instead of just the first? (As if the setProperty/* did a getParameterValues instead of getParameter).

Suppose a JSP form has, among other elements, a listbox that allows the user to make multiple selections. After the form is submitted, I want to send the request parameters to a bean via <jsp:setProperty ... property="*"/>.

Is there a way to have the * populate the bean's corresponding String or String[] with ALL the selections from the listbox, instead of just the first?

I am creating my dynamic content by invoking multiple <jsp:includes>. Do I need to call <jsp:useBean>; in all the JSP's or will a one time initialization within the holder JSP suffice?
Can I instantiate the same JavaBean multiple times within a JSP page by associating each instance with a different scope?
Why is it strongly recommended that any JavaBean used within a JSP page belong to a named package?
   How to pass parameters to a bean constructor. I can create a bean constructor with parameters. but bow do I pass values to the bean from a JSP page on creation..Is there any way to do this..
   Also, is there any way to access bean properties which are set using jsp:setProperty, from another bean. I am able to access properties which are initialized in the bean itself.
I'm a bit confused with the term bean in JSP eg. the tag <jsp:useBean ... > From what I understand, the term bean used here is referring to a simple java object.

When I look through the JavaBean resources, their definition of bean seemed a bit different.

Any comment ?


Thank u ...


Java:API:JSP:JavaScript
How can you copy a JavaScript variable to a JSP session variable without using cookies?
I am trying to store the value of a SELECT object in a session variable so it can be accessed in other JSP's for use in database lookups.
Can JavaScript be used to access JavaBean properties within a JSP page?
I want to pass an array of values that I have built within a JavaBean to a JSP, and for JavaScript within the page to process it and display it. The Bean sets the array, and the JavaScript has an identical array defined. I have tried
javascriptArray = "<%= myJavaBean.getArray() %>";
but this doesn't work. Any ideas, anyone?
Why use JSP? All that we can do with scriptlets we can do with JavaScript as well, I think. Can somebody explain?

I have a framed JSP application and would like to make it so pages meant to be viewed as a frame can only be viewed as a frame.

So, if they type the direct URL to that frame, I would like that page to check to see what frame it is in, and if it is in, say, _top, then redirect to the main (framed) page.

Is this possible?

Is it possible to press a button in one frame and caused a form in another frame to be submitted?

I have a scrollable jsp in one frame and another frame with just buttons. I want to be able to press a button and sumbit a form from the jsp page. Thanks for any replies.

I have a JSP that uses frames inside frames. How can say to the browser to open the Error Page in the main frame (the topmost frame)?

I have a html file where i have 2 frames. (1) in first frame(let us call it navigation frame) i have a html file for navigation and (2) in another frame(let us call it jsp frame) i have a jsp page which asks for login.and based on who logs in , i want a different navigation frame and also a different jsp page in jsp frame. i can get a different jsp page in jsp frame by having the following code in a jsp file that comes after login. But how do i also make a differnt navigation frame in place of original navigation frame? Basically i need a functinality like Target=_top as in html links which take to a differnt file replacing all frames in the page. -------------------------------------------- findpos is a string which gets who logged in from a javabean.
<%if(findpos.equals("member"))
{%>
<%@  include file="link.html" %>
<%}
else if (findpos.equals("staff"))
{%>
<jsp:forward page="staffindex.html" />
<%}%>

<% } else { %>
   We are sorry, but you are a illegal user!
<% } %>

I would like to make sure that my users only enter any combination or letters or numbers for a particular field in my JSP (case insensitive). What is the best way to do this? I see that there is method "isLetterOrDigit" for the Character class, and I suppose I could use a for loop and apply this method to each character of the string, but I'm wondering if there is a better way .... Thanks, jv

I have a jsp page(a view). It is actually a popup to a main-page. This popup is to email people. The popup has a 'Send' button. On clicking 'Send' button, I want the popup to close immediately(which I can accomplish via javascript...onclick submit form and close popup) and leave the processing to the server. I am using Struts, so the ActionServlet will direct it to an Action perform() wherein I have Stateless session beans going to handle the emailing of input data.

I have not done this, but contemplating such a design. Now my doubts are:-
a)will the popup close(or will it wait for all the backend processing to finish....
b)will the popup close..but the backend processing bomb.

I was wondering would it be possible for JSP pages to update the value of the a combobox without reloading the page. Like for example with javascript I know you can do it there where ONCHANGE you call a function to change the values of the combobox and taht would work. But I was wondering can you do something like that with JSP maybe using some kind of custom tag or something.
I need more screen "real-estate" for my JSP application. How do I remove the toolbars in IE and netscape to increase screen "real-estate"? Need it for evey screen of the application.
I am trying to display a set of records and each
record contains 2 or 3 fields along with a submit button
and whenever the user clicks the button i would like
to track the contents of the respective record and pass it as the paramter to the next jsp.

By using innerHTML in jsp page which need to populate the data from database in to that page without refreshing that. Here is the actual problem i'm having. i have a jsp page which contains 6 dropdown boxes, if user selects first one, onChange event will fire and it will get data from database and the jsp page is refresing and the data in the remaining 5 dropdown boxes are populated based on the data from database. i would like to do this without refreshing the jsp page, i have an immediate answer that is 'innerHTML' and 'IFRAME' concepts. but i don't know how to implement this, can anybody show me some direction in this. this is an urgent one. thanks,

I have a page that has an Add button. On clicking that, a child window opens. When the child window form is submitted by the user the (child)window should close and the parent form should be reloaded. (And this should not happen before the child form does its processing..or else the updates wont be seen:)

I tried a javascript after the child window </form> tag to reload parent and close child...but did not seem to work

How would you set this up?

I am using struts(Jakarta's) framework, when I click on a link from one jsp, the form is getting submitted multiple times. I am using only one form, and only one javascript method to submit that form. Is there any way to fix that problem?
I have a JSP which is divided into 2 side-by-side frames.

The left frame contains an applet which displays a JTree and the right frame contains buttons like "Add Node", "Remove Node".

When "Add Node" button is clicked, a Tree Node has to be inserted into the JTree component in the applet on the left frame. How do I access this component in the left frame.

Basically, what I am asking is how do I access a component in the left frame from an action in the right frame? Is there a way to add the JTree object or the applet to the session as an attrbute? If yes, then how do I do it? If I can somehow add the applet to the session, then I can access it from the Session and invoke the appropriate "add" method!

Here is the code for the left frame that holds the Tree applet:

<html> <head> <title>Study Tree </title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body bgcolor="#FFFFFF" text="#000000"> Study Tree

The tree displays all the Surveys, Questions and Responses in this Study

<div align="center"> <jsp:plugin type="applet" code="StudyTree.class" jreversion="1.3" align="center" height="60%" width="90%" nspluginurl="http://java.sun.com/products/plugin/1.3.0_01 /plugin-install.html" iepluginurl="http://java.sun.com/products/plugin/1.3.0_01 /jinstall-130_01-win32.cab#Version=1,3,0,1" > <jsp:fallback>

Unable to start Java Plug-in.

</jsp:fallback> </jsp:plugin> </div> </body> </html>

Please help, its urgent!

I am writing a simple jsp to retrieve and save from/to my MySQL db. My retrieve and save functions work great. Now, depending on the action in the browser, I would only like to invoke one of the methods. For example, for the onChange event, I would like to get the info from the db. For the onClick event, I would like to save the info to the db. Considering these actions are on the client side and jsp is on the server side, is there a way to do this? If not, does anyone have a suggestion on how this can be done?

Thanks,

- Mike


Java:API:JSP:Lifecycle
What JSP lifecycle methods can I override?
How can I override the jspInit() and jspDestroy() methods within a JSP page?
Please explain the lifecycle of a JSP page in detail.
I have a jsp page that opens a database connection as part of its logic. The last part of the page destoys the connection. I've noticed that hitting stop on the client causes the jsp page to stop loading and a connection is left open on the server. What actually happens when a user hits stop on the browser while a jsp page is loading? Does the jsp page (servlet) finish processing the _jspservice method? Does the compiled jsp servlet still destroy itself? Is the memory used from the page released? Will the page halt like it does when a jsp:forward tag is encountered?
If we declare a variable, say int i=3 in jsp file, then in what method does this variable reside? Is it within service() or the init() method? If this resides in service(), how can I make to be in init() and vice versa?

Java:API:JSP:Open Source:GNUJSP
Where can I get an open source implementation for a JSP-based shopping Cart (something on the lines of www.opencart.com)?

Java:API:JSP:Open Source:Tomcat
Using TagLibraries in Tomcat, Where should I include the taglibrarydescriptor files (.tld file)?
Do have to restart Tomcat every time I recompile a bean?
Using jsp:forward on Tomcat, why do I get the error java.lang.IllegalArgumentException at javax.servlet.http.HttpUtils.parseName(HttpUtils.java:285) ?
How can I protect my JSP resources using security realms under Tomcat 4?
I have downloaded the Tomcat 3.3a. After I start up the server.. it puts out this strange message: embeded Tomcat: exception initializing ContextManager. What do I have to do to start my Server without any error messages?
I am designing a webpage using jsps and i am trying to set up my login page. when the user clicks on the sin-in button they are taken to a screen aking them to enter their username and password,which i have stored in a MySQL database. I want to compare the username and password in the database with the username and password entered in the webpage. If they match a message such as "Login Successful" should be displayed, if not then a message such as "Login Failed" will be displayed. The fields in my database are called "username" and "password". The following is the code i have for setting up the page asking the user to enter their username and password:-

-----------sign_in.jsp------------------
<%@ page language="java" contentType="text/html" %>

<html>

<head>
<meta http-equiv="Content-Language" content="en-ie">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Sign In</title>
</head>

<body>





<form method="POST" action="signin_result.jsp" >
Username: <input type="text" name=username_signin">
Password: <input type="password" name="password_signin">
<input type="submit" value="Log In">
</form> </body> </html>

--------------signin_result.jsp-------------

<%@ page language="java" contentType="text/html" import="java.sql.*,java.awt.*" %>

<html>
<body>

<%
	//load the MySQL JDBC driver
	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

	//open a connection to the "fantasyfootball" database
	Connection con = DriverManager.getConnection("jdbc:odbc:fantasyfootball","","");

	//create a statement object for sending SQL queries
	Statement stmt = con.createStatement();

	//place query results in a ResultSet object
	ResultSet res = stmt.executeQuery("SELECT username,password FROM personal_details WHERE username='"+request.getParameter("username_signin") + "' AND password=PASSWORD('"+request.getParameter("password_signin")+"')");

	//assign ResultSet's column 1 to a String variable
	
	while(res.next())
	{
	  String username= res.getParameter("username_signin");
	  String password= res.getParameter("password_signin");
	}

	//clean up all objects
	res.close();
	stmt.close();
	con.close();
%>

<% 	if (username=username_signin ){
		if(password=password_signin)
	  		System.out.println("Login Successful");%>
	  
	<%} else {%>
	  System.out.println("Login Failed");
<%	}%>

</body> </html>
This code is not working. I would be very grateful if someone could either correct my code or provide me with code to perform the check.

Thanks Patrick

i have this problem of refreshing my updated .jsp page. It seems that even if i updated my .jsp with a new file. Tomcat will still load the old page. I am very sure that i have updated the file with the new one.Currently to solve this problem, the only way i can do is to restart my whole linux server and reload the client page again. Please advice me on what i should do and i have been trying a lot of ways but in vain.

Method that i tried so far but still failed:
1) Deleted the file, doing a refresh and copied the new file over.
2) Putting the following into my jsp page, as adviced by other experts:

<% response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server %>

Helpless, Joe Configuration: Tomcat 3.22 runnining on Linux 8


Java:API:JSP:Performance
What's a better approach for enabling thread-safe servlets and JSPs? SingleThreadModel Interface or Synchronization?
How does JSP compare to ASP in terms of connecting to databases such as MS SQL Server from the web?
How can I stress test a servlet / JSP page?
Which is faster -ASP or JSP? Why?
How can I improve the performance of a JSP Page which contains many session variables?
Does making a significant use of taglibs affect performance? I am especially worried about the effect of all the object instantiations in the background on a high volume site.
Which is generally faster at creating dynamic output: A JSP included in a JSP with params or a custom JSP tag with attributes? I would like to keep the logic in a custom tag rather than in scriptlets in the JSP.
Is there a common way (not servlet-container dependant) to precompile a jsp file without waiting for the first hit?
How does it affect the performance if we use a try catch in a jsp page to catch an error?I want to use this as the error page call is not that effective. Is there any other way of catching exceptions in jsp ?
How can I interrupt a request already sent to a JSP servlet engine, and thus stopping or altering the thread the server is executing for that request? For example I want to use a cancel button on my form's page to interrupt an already submitted request which may take a while to finish.
Is it true that servlet containers service each request by creating a new thread? If that is true, how does a container handle a sudden dramatic surge in incoming requests without significant performance degradation?
Is there any justification in creating a cache that maintains values pulled from a given property file so that your app does not have to continually getProperty() on the same property over and over again?

I suppose the key question is: How much of a performance hit is it to access a property file as opposed to maintaining a cache (HashMap) of key / value pairs?

How can I avoid making multiple HTTP calls for content that hasn't changed? Is it possible to cache it? Is there a way to set this in the header?


Java:API:JSP:Sessions
Is there a way I can set the inactivity lease period on a per-session basis?
How can I enable session tracking for JSP pages if the browser has disabled cookies?
How can my application get to know when a HttpSession is removed (when it time-outs)?
How can I find out the number of live sessions within my servlet engine using either JSP or servlets?
How can I get the value for the Session Identifier (i.e. JSESSIONID) from a JSP-Page?
How does session management work internally within the servlet engine?
What is "Session Migration" ?
Assume that the web server creates a new session for a user, and later, the user does not "log out", but rather just closes the browser. How can the web server determine that this session is no longer active and prevent it from consuming valuable server resources?
What is the difference between using getSession(true) and getSession(false) methods?
Someone just told me that when you close your browser, your JSP session (login in this case) is not ended, so that if you start up another browser and go to your site, the JSP engine still thinks your logged on. Is this true? If so, how to end that session before shutting down the browser?

I understand that a JSP session cookie is not persistent. Once all browser instances are closed, the session cookie is gone.

Is there a way to make the session cookie persistent like a regular cookie?

Using Jigsaw, W3C's Server, I have to find out how many sessions are there at a given time. Any help will be greatly appreciated
How can I retrieve an expired session?
I have two webapps which I would like to pass information between.

I would also like to pass all the session information between the webapps.

An example would be helpful.

Is the HTTP Session maintained even when the network connection goes down? Can the same browser instance resume a previous session after re-establishing the network connection?
Is the HTTP Session maintained even when the network connection goes down? Can the same browser instance resume a previous session after re-establishing the network connection?
Is it possible to give different session timeouts for different groups of users? I think session timeouts are set in the server and is the same for all users...meaning if you dont use something the web app for 30 mins yr session expires...and it is the same for all users.

I have a cookie customer(aren't they all..I need to bash them somewhere;) who wants different session timeouts for different groups of users...CEO,CIOs aka the elite group need only 30 mins and the John-Q group needs 120 mins before their session times-out/expires.

Possible?

I am sending form post variables thru HttpURLConnection class then i am not able to access existing session. How can i send variables as form post without breaking my existing session.
I want to know how can I redirect to a jsp Page whe session of the page expires. I use Resin 2.1.5.
In a JSP session object, why is there the restriction that any object put into the session must be a serialized objects?
What can be done using the session object once it has been invalidated? What can be done using the session object once it has been invalidated? The JSP spec is not very clear on this. Can I use it further down in the same JSP page in any meaningful way? Can I use it in a forwarded page in any meaningful way? Will the forwarded page get new session? Can I use it in a jsp:included page in any meaningful way? Will the jsp:included page get new session? Can I ask JSP container to refresh my session? Can I simply do:
session = request.getSession(true)
in a scriplet to get a new valid session? How do I tell the pageContext about this new session?

What is the difference between
HttpSession mySession=request.getSession(true)
and
HttpSession mySession=request.getSession()


Java:API:JSP:Specification
JSP 0.91 and 0.92 specifications are no longer available at java.sun.com. Is there somewhere else I can download them?
What's the difference between the JSDK and the JSWDK? And what's the current version?
What work is being done towards JSP API v1.2?
What are the differences between the JSP 1.0 and JSP 1.1 specifications?
What version of the Servlets or JSP specification is supported by my favorite servlet product? (JSDK, JSWDK, Tomcat, J2EE, etc.)
Is there any document about migrating from JSP 0.92 to 1.0?
What are differences between JSP 1.0 and JSP 0.91?
What are the major enhancements/changes in JSP1.2 PD spec?
What are the differences between JSP 1.1 and JSP 1.2?

Java:API:JSP:Vendors
Are there any JSP engines which support JavaScript?
Where can I find the complete list of commercial vendor support for JSP?
With Sun's JSWDK 1.0, I can access only the class file for the servlet generated from my JSP page. Is there a way to see the Java source for the generated servlets?
I'm running JRun 2.3.3 on NT4 with IIS4, and I'd like my .shtml files to be handled by IIS, but JRun is handling them exclusively. Is it possible to turn off SSI in JRun? If not turn off, at least disable SSI for a particular file extension?
In JRun, under which directory do I place Javabeans so that my JSP page access them?
I need to include an ASP file from this server in a JSP. I believe this in theory can be done, because the JSP specification indicates that the jsp:include action can be performed on "any" dynamic object. However, Resin 1.1.4 includes the ASP source code, instead of the result of the execution of the ASP. Why?
How to configure J2EE RI for JSP? Where should I place the JSP source files?
List of jsp and servlet engines supported by Apache webserver What are the various servlet and jsp engines which can be integrated with Apache webserver. Please provide a list of their names and prices.
Where can I learn (more) about Application Servers?

Hello! I am trying to include a JSP page that contains commonly used html/java code, into another JSP page multiple times using the jsp include directive.

This causes the parser in Websphere Appl. Server 3.5.3 to display an error page that says
org.apache.jasper.compiler.ParseException: Seen file include.jsp already, maybe this is a recursive include?!

However, when developing and testing the JSP page in Visual Age's 4.0 Websphere Test Environment, everything works fine....Why?

If Websphere Application Server is right about not allowing me to include the same JSP page several times, is there some other way perform this task?

We have multiple RquestDspacter.forward() in a single JSP file. This JSP runs OK with JRun 3.0 but gives Error 500 (response has already been commited) with Web Sphere 3.4. Is there any restriction in WebSphere that we can have only 1 RequestDispatcher.forward() call in a single JSP?
Iam looking for the tool which converts JHTML files into JSP files, is anybody using any tool or is there any way to convert it , if so kindly share the knowledge with some examples.
I have got a problem using <jsp:include page="/access/template.jsp" flush="true" /> tag in WSAD. Above url is located in another web project. So when I validate my web project, I am getting broken link error message in the task console. Eventually browser throwing following message: The system cannot find the path specified. My web project context root is "/SRA" and another web project context root is "/". How I have to refer the url located in another web project in the jsp tag.
How to make jsp work in IIS server.Is there any plugin?

Java:API:JSP:Vendors:GNUJSP
How can I JSP under Apache JServ?
It is possible to have jsp's served from the document root, with multiple virtual hosts? All we want is to be able to serv .jsp files from anywhere under the document root. If we mount "/", then jsp works correctly, but EVERY request, including requests to "/cgi-bin/" will also be redirected to jserv, which obviously is not what we want to happen. It seems that jserv need to have SOMETHING mounted, and jsps needs to be in a mounted servlet area. Are we correct on this?

Java:API:JSP:Vendors:Tomcat
I am using Tomcat under Linux. What file ownership/permissions should I use for my java classes and JSP pages?
How do I prevent Tomcat from displaying the directory contents?
I want to use jspc with Tomcat to precompile my whole web-application. But if I use the -webapp switch I always get a NullPointerException. What's wrong? Compiling every file on its own seems to work. If I do this, does it mean that I have to map the jsp-names to the servlets in the web.xml file?
Configuring Tomcat question: How can I configure Tomcat such that I can move my jsp files (that I'm developing) to a directory other than .../tomcat/webapps/examples/jsp/servlet/? This all works well and good, but I'd like to move the files to a more appropriate location.
How can I define search paths for jsp files? In the server.xml context I can only define one docbase. I would like to have one custom path and one default path. If the files are not found in the custom path then the files in the default path should be used.
In Tomcat 3.1, I have many web applications, each set up in its own separate context. To maintain a consistent look across the entire site, every JSP includes template files found in a templates context via <jsp:include page="/templates/header.jsp" flush="true">. This worked fine until I started using tomcat 3.2; suppose I had a /login-app context. I get an error saying 'jsp not found in /login-app/templates/header.jsp' ... is there anyway to disable the JSP's engine context when using the page attribute of <jsp:include> so that it won't include the path of the context when looking for another file?
Why does Jasper crash with the java.util.EmptyStackException when I try to precompile a simple .jsp file to obtain servlet code? It happens on Windows 98 with JDK 1.3.
Under Apache Tomcat, how could my JSP files can access Beans under directories other than 'WEB-INF/classes' or 'WEB-INF/lib'?
The latest milestone release (m5) of tomcat does not contain tomcat.conf or tomcat-apache.conf. What file do I include from httpd.conf? Can I use the old tomcat.conf ?
How can I use Jikes with Tomcat?
When using a custom taglib in a JSP, what is cause of the exception ( org.apache.jasper.JasperException: Unable to open taglibrary http://www.yourcompany.com/taglibs : null?
Where can I find help to configure Tomcat to run with IIS?
Is it possible to automatically clear the "work" directory in Tomcat which contains the Java source files for JSP pages?
Is JavaScript supported as a JSP scripting language under Tomcat?
Where can I learn (more) about Apache's Java-based server, Tomcat?
What is Ant? Do I need it to run Tomcat?
Why do I get "Note: sun.tools.javac.Main has been deprecated" when compiling my JSP?
I have got this error when I tried to access the Tomcat welcome page at http://localhost:8080 using Tomcat 4.0.

Starting service Tomcat-Standalone
Apache Tomcat/4.0.1
Starting service Tomcat-Apache
Apache Tomcat/4.0.1
java.lang.NoSuchMethodError
        at org.apache.catalina.connector.ResponseStream.flush(ResponseStream.java:244)
        at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:245)
        at java.io.PrintWriter.flush(PrintWriter.java:120)
        at org.apache.catalina.connector.ResponseWriter.flush(ResponseWriter.java:125)
        at org.apache.catalina.connector.ResponseBase.finishResponse(ResponseBase.java:481)
        at org.apache.catalina.connector.HttpResponseBase.finishResponse(HttpResponseBase.java:229)
        at org.apache.catalina.connector.http.HttpResponseImpl.finishResponse(HttpResponseImpl.java:288)
        at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1038)
        at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1106)
        at java.lang.Thread.run(Thread.java:484)

The server starts up fine. The error comes up when I access the welcome page. All my other JSP codes residing in Tomcat cannot be access as a result of this problem.


I have tried to reinstall the entire Tomcat Server and JDK 1.3 to ensure that everything is the default setting but the problem still persists. This problem came all of a sudden. There was no problem at all in the first place.

I am getting an "Out of Memory" error running my JSP applications under Tomcat. How do I increase the default JVM heap size settings that Tomcat uses upon startup?
I want to ship my JSP-based application to my customers by bundling it with Tomcat. Is Jakarta Tomcat 4.0 freeware?
Is there a way to run a JSP that will give me the current classpath used by Tomcat?
I'm using jboss(2.4.1) +tomcat(3.2.3).
I need to share the same directory structure of jsp's for different applications (I have deployed the jsp's as they are not in a war). Also I need to use the same libraries for all the applications. So my questions are:
Does a declaration in server.xml like this:
<Context path="/app1" docBase="/path/WebSites"/>
<Context path="/app2" docBase="/path/WebSites"/>
means really different applications?

2. Is there a way, if the above is true, to have different web.xml for each of them, I mean to make Tomcat to look for web.xml elsewhere WEB-INF for any of the app's?

3. Another issue is how to share the same libraries, (without affecting the .bat files of jboss/tomcat) between different applications that don't have the same docbase? Is there a way to instruct Tomcat to search for application libraries elsewhere WEB-INF/lib?

Using JSP with Tomcat 4, I've noticed that using the response.sendRedirect() method, or jsp:forward tag to another directory on the same server is loosing all the session variables. Does anyone know the reason for this and a work around?
If a directory does not have one of the welcome-file I want to redirect to a page, not show the subdirectories and files. How could I do it?
i have placed the class file in the WEB-INF/classes in the project directory and the whne i run my aplication this is what comes...
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.


An error occurred at line: 2 in the jsp file: /techSupport.jsp Generated servlet error: C:\Program Files\Apache Tomcat 4.0\work\localhost\JSPTechSupport\techSupport$jsp.java:60: Class org.apache.jsp.TechSupportBean not found. TechSupportBean techSupportBean = null; ^
An error occurred at line: 2 in the jsp file: /techSupport.jsp Generated servlet error: C:\Program Files\Apache Tomcat 4.0\work\localhost\JSPTechSupport\techSupport$jsp.java:63: Class org.apache.jsp.TechSupportBean not found. techSupportBean= (TechSupportBean) ^ An error occurred at line: 2 in the jsp file: /techSupport.jsp
Generated servlet error: C:\Program Files\Apache Tomcat 4.0\work\localhost\JSPTechSupport\techSupport$jsp.java:68: Class org.apache.jsp.TechSupportBean not found. techSupportBean = (TechSupportBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "TechSupportBean"); ^
I've been using Tomcat for some time however, i only started to explore the in-built Manager. I can't seem to get it to work and it produce this error when i tried to login with my username and password:

HTTP Status 403 - Access to the requested resource has been denied

This is what i have for my tomcat-users.xml
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<role rolename="tomcat"/>
<role rolename="role1"/>
<user username="admin" password="secret" roles="manager"/>
<user username="tomcat" password="tomcat" roles="tomcat"/>
<user username="role1" password="tomcat" roles="role1"/>
<user username="both" password="tomcat" roles="tomcat,role1"/>
</tomcat-users>

Can anyone tell me what's wrong with it ?

Regards,
Joe

I have the same JNDIRealm used for authentication in different webapps. I would like to be able to "persist" user login between different webapps. In other words if user logs in to one %TOMCAT_HOME%/webapps/app1 and then clicks on a link that leads to %TOMCAT_HOME%/webapps/app2 I want to make sure that user does not need to re-authenticate. Is this possible? Thank you Val

I want to run JSP files using the Tomcat server, where should I place my JSP files?


Java:API:JSP:XML
Where can I find a DTD for JSP?
Can we maintain an XML data structure on the client side using JavaScript? Is there any parser to parse the xml data on the client side? The xml data will be passed as an string.
How do I use XML and JSP together?
Could you discuss some guidelines to determine when it is best to use JSP vs. XML/HTML from a performance point of view, and some of the pitfalls?
How can I pass XML generated by JSP to Cocoon for further processing?
How can I have my JSP page generate XML content after obtaining the data from JavaBeans?
I'm quite new to XML and JSP so here goes. I want to pass an XML message to a jsp via the URL (i.e. GET method). My questions: 1) What will the actual URL end up looking like? 2) How can my jsp retrieve the XML? (I know how to retrieve XML from a file in the jsp, but don't know how to retrieve the XML from the URL). A quick example would be greatly appreciated.
How can i use xslt and jsp to generate multiple views?

Java:API:JSP:XSL
While generating a dynamic XML stream from within the JSP page, how do you reference XSL file to be used for processing this XML ?
How do I include a link to an external style sheet from JSP?
Using Tomcat and Xalan, why do I get the exception:
java.lang.IllegalStateException:
Response has already been committed

when trying to pass "out" to the XSLTProcessor as a XSLTResultTarget?
I need to find out how to transform a xml document and save the results using JSP. The JSP will request the source documents of the xml and xsl from a form (ie file already exist on the server) and the JSP would save the results to a file on the server. I can achieve this though a GUI and applying the templates and saving the results to a file bit the same code doesn't work with the JSP. I am using the Java API for xml woth Xalan XSLT processor.
How can I pass XML generated by JSP to Cocoon for further processing?
I have a web report which is done using JSP & HTML its a
simple retrieve from database on generating this report
i am also creating same format data, like
heading and columns and data in a excel sheet and
saving it to C:\exceldata.xls
and alone with this web report there is a anchor which
will point to C:\exceldata.xls every time
(hard coded in the jsp page) every thing works fine as expected
as soon as jsp page retrieves data from the database
along with the jsp report there is a anchor at the top
which points to C:\exceldata.xls. onclick on this link
retreives the same report in excel format, so i am
doing this on jsp page load (saving excel sheet to
locate c:\ and jsp page generation)but when i change the
parameters in the parameters page and trying to
generate a new jsp report so it should over write the
current saved file C:\exceldata.xls, its not
doing that and also if file was open and trying to generate
it again it gives error, so what i want to do is
before saving execldata.xls to C:\ i want to check
whether file is already exists if not create new else
delete the existing and create new, this will solve
my problem. Any help, greatly appreciated, Thanks in
advance.
How can i use xslt and jsp to generate multiple views?


Ask A Question



Related Links

JSP FAQ

JSP Forum

Sun's JSP home page

SUN's JSP-Interest mailing archive

IBM's "Introduction to JSP" online course

JSP Insider

Wish List
Features
About jGuru
Contact Us

 



The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers