jsp

Struts JSP previous link

Hi, Does anyone know how I can retrieve the previous JSP URL that a page has come from within a JSP? Can I retrieve this from the session/ request/ response object? Hope this makes sense, Thank you ...

Strip whitespace from jsp output

How can I strip out extra whitespace from jsp pages' output? Is there a switch I can flip on my web.xml? Is there a Tomcat specific setting? ...

JSP struts

Hi, How would I assign a variable within scriplet code in JSP <%> and then use struts logic tags to do stuff based on the value of the variable assigned in the scriplet code block? I have tried using struts:logic equal and greaterthan to no avail.... Many Thanks, ...

JSP: How can I still get the code on my error page to run, even if I can't display it?

I've defined an error-page in my web.xml: <error-page> <exception-type>java.lang.Exception</exception-type> <location>/error.jsp</location> </error-page> In that error page, I have a custom tag that I created. The tag handler for this tag e-mails me the stacktrace of whatever error occurred. For the most part this works great....

Is there a good JSP editor for Eclipse?

I need a nice JSP editor plugin for Eclipse. What are my choices? ...

Passing parameters between JSPs

Hi. Please bear with me here, I'm a student and new to Java Server Pages. If I'm being a complete idiot, can someone give me a good link to a tutorial on JSP, since I've been unable to find info on this anywhere. Okay, here goes... I'm using Netbeans and trying to pass an object that connects to a database between the pages, otherwi...

How can I show a "temporarily out of service" page to web-app users during maintenance?

I develop and maintain small intranet web apps written in JSP and Java. They run on a Resin web server, without dedicated httpd like Apache. Before performing maintenance, I activate a very simple Ajax message to urge users to logout. What I want is, while I do maintenance, a user trying to log in to that particular app to see a "Sorr...

Returning a PDF file from a Java Bean to a JSP

EDIT: See my working code in the answers below. In brief: I have a JSP file which calls a method in a Java Bean. This method creates a PDF file and in theory, returns it to the JSP so that the user can download it. However, upon loading the PDF, Adobe Reader gives the error: File does not begin with '%PDF-'. In detail: So far, the JS...

Is it really a best practice to use jstl out tag?

I remember working on a project with a group of developers and they always wanted static html text to be inside of an out tag (<c:out value="words" />). I don't remember why this was the case. Is this really a best practice when building jsp pages? What are the advantages/disadvantages of such an approach? ...

Managing file uploads in JSP/Servlets

Once again a very beginner-ish question, but here I go: I would like to use a servlet or similar to copy an uploaded file (from an html file select) to a permanent location. This is all I need to do with the file. I am currently going with using the Apache Commons FileUpload and IO libraries. Is there no easier or more elegant solution?...

How comment a JSP expression?

How can I comment a JSP expression like: <%= map.size() %> Is there something like <%= // map.size() %>? ...

jsp chatting with ajax

Hi sirs, I am writing one web chat program using AJAX (a little bit). It is working when both users open a chat page, but I want to open a window when one user send data to others. ...

Using Apache commons FileUpload

This just won't work. The problem is that I do not know enough to even know what is supposed to happen. I can't debug this code. I'd like to store upload to temporary folder "temp" and then to move them to "applets". Please help? The servlet is obviously being accessed, but I can't find the uploaded files... Thanks in advance. Form (wh...

declare JSP taglib directives in web.xml

Hi, I seem to remember reading that it's possible to declare taglib directives such as: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> in web.xml. This eliminates the need to duplicate this directive in every JSP file where the taglib is used. Could someone tell me how these directives can be added to web.xml? Chee...

JSTL, Beans, and method calls

I'm working on a JSP where I need to call methods on object that come from a Bean. The previous version of the page does not use JSTL and it works properly. My new version has a set up like this: <jsp:useBean id="pageBean" scope="request" type="com.epicentric.page.website.PageBean" /> <c:set var="pageDividers" value="<%= pageBean.getPag...

Importing the content of another web resource using JSTL

I have a JSP page that will display the exact content of another web page on a different server. My understanding was that c:import from the JSTL should be able to include content from files that are not part of the current web application. I added c:import url="page on my server in a different application" and it works fine, but when ...

JSP Custom Tag Library vs JSP2 Tag Files

Can anybody gimme the idea about the JSP custom tag library and the JSP 2 Tag files.. Are this two are alternatives to use....??? If there is any comparision(or merits and demerits) among this please do specify.. And which one of this is better to work with.. I m waiting for the kind suggestions.. Regards, Vinayak ...

JSP-tags with static output

I am considering creating some JSP-tags that will always give the same output. For example: <foo:bar>baz</foo:bar> Will always output: <div class="bar">baz</div> Is there any way to get a JSP-tag to behave just like static output in the generated servlet? For example: out.write("<div class=\"bar\">"); ... out.write("</div>"); i...

Using JavaScript within a JSP tag

I've seen this question regading the importing of js-files related to the tag content itself. I have a similar problem, here I have a jsp tag that generates some HTML and has a generic js-implementation that handles the behavior of this HTML. Furthermore I need to write some initialization statements, so I can use it afterwards through J...

What is the best way to precompile JSPs using ANT

I am trying to figure out the best way to use ANT to precompile JSPs that will be deployed to an Oracle application server. Even though I am deploying to an Oracle app server I would like to avoid using Oracle's version of ANT. ...