jsp

Start an applet from a servlet...

I have been searching on how to start an applet from a servlet. Everything on the web so far has been on the opposite, connecting to a servlet from an applet. I am writing a gwt/j2ee app and need to post data to a servlet, then have the servlet start an applet and pass serialized objects to the applet. The applet would then send data bac...

Including JSP page inside forEach loop

I need to do for each loop and include loops content to other jsp page. Now I need to pass looped variable to other JSP page. I have tried following, but it didn't work. When I used attribute in included page, it just returned null value. <c:forEach var="item" items="${items}" varStatus="loop"> <jsp:include page="/my_jsp_page.js...

CSV jsp generated file, how to insert a break line

Hi all, I am trying to generate a csv file using a jsp file this its code: <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%-- Set the content type --%> <%@ page contentType="text/csv"%> <c:forEach items="${chartData}" var="chartDataEntry" varStatus="status"> ${chartDataEntry.date}, ${chartDataEntry.open}, ${chartDa...

Should I create a Model & DAO for this in my Java web application?

I have the following action servlet and was wondering if I should create a model called supervisor and a corresponing supervisorDAO as I did for program? The programDAO puts multiple program model beans into the returned arraylist. For supervisors, I am using a general input/output database utility to get an arraylist of hashmaps (retA...

Setting parent form attributes from an iFrame

Hello All, I have a jsp which has an iFrame in it. The page displayed in the iFrame depends on the selection made by the user in a drop down list on the parent page. Once the page inside the iFrame is displayed, the user can then fill in the details and hit on submit button. Problem is I'm not able to access the value entered by the use...

How do you force a download prompt, before data it sent from a servlet?

Hi all, How do you force a download prompt to popup before you send any data to browser? I know about content disposition attachment, but this is different. Basically, the servlet starts sending data to the client, and then the client open a dialog, open, save, cancel. The probably is my servlet is slow getting the data, and it gets ...

How to pass the location of a file from JSP Form to Java Program

String fileToBeRead = "C:/Documents and Settings/Developer/Desktop/Anand exmps/Anand.xls"; I have completed a java program in which the location of a file is assigned to a string as above. But what actually is required is, the end user should select the location of file in a JSP form that is developed using <input type="file" name="fi...

How to replace broken images with a blank image in JSF?

I'm using the h:graphicImage tag in JSF. Is there a way to show a blank image (i.e. blank.jpg) if there is a broken or not found image? ...

Problem with jsp tags

I'm trying to port a web app to JBOSS server. Application has jsp pages with <@include> to include a standard header fragment. Header fragment opens a jsp tag but it leaves to the main page to close.My understanding is that this style of include is like literal insertion of contents and I expected this to work. However I ended up with co...

how to import a jsp from temp directory in jstl

I have some dynamically generated jsp content I'd like to (jstl) c:import into another jsp page. Currently I have the dynamically generated jsp written to a file in the servlet temp directory (javax.servlet.context.tempdir) but can't work out how I can import it since it is outside the servlet context. Is there a way to import a jsp from...

Struts 1 - How to define List bean with empty value

Hi all, I have Struts 1 / JSP web application. In the JSP I need to define List bean and pass value to it. <bean:define id="beanName" type="java.util.List" value=""/> does not work. It says I should pass in NNULL value. <bean:define id="beanName" type="java.util.List" value="<%= new ArrayList() =>"/> does not work either - it says...

Best way to include sub-templates into templates in Spring MVC

I'm writing webapp using Spring 3 MVC with annotations. I use jsp for view layer. I have a few basic templates and many templates that I want to include into this basic templates in depend of controller. I know that I can add template name to model inside controller, but it is not best way I think. I think some declarative way must exis...

Confusion with RequestDispatcher saying the browser address bar does not change

All the online references and head first JSP&Servlet book I'm reading state the characteristic of RequestDispatcher and Redirect (i.e. resoponse.sendRedirect() ) like: "Request Dispatcher" - URL in the browser bar does not change. "Redirect" - The user sees the new URL in the browser. But according to my test, for RequestDispatcher, I...

How to print the year in a JSP?

I want to do something like this: <?php echo date('Y'); ?> But then in a .jsp file. All the tutorials I'm seeing require building a class somewhere. We're running appFuse and Tapestry. Surely one of those (if not Java itself) provide us with something to do this sort of thing without all that overhead. This seems like it should wor...

How to display just the child menu items in appfuse

(I think this is coming from appfuse, anyway. I'm not always clear on what's part of which framework still.) I've got this in my menu-config.xml: <?xml version="1.0" encoding="UTF-8"?> <MenuConfig> <Displayers> <Displayer name="Velocity" type="net.sf.navigator.displayer.VelocityMenuDisplayer"/> </Displayers> <Menus>...

How to split column and row in shopping cart with java JSP or JSF

Hello everybody, i want to present one shopping cart in index i want to show 3 column and 5 row for each category Example Books || Books A || Books B || Books C ||============||===============||========= || Books D || Books E || Books F ||============||===============||========= || Books G || Books H || Boo...

Related Parameters in HTML

I have a table of rows and columns on an HTML-based entry form that allows the user to edit multiple records. Each row corresponds to a database record and each column to a database field. When the user submits the form, the server needs to figure out which request parameter belongs to which row. The method I've been using for years is ...

Cause of 'tmpFile.renameTo(classFile) failed' during JSP compilation

Recently, I started to experience strange behaviour in JBOss 4.0.5 JSP application. The JSP compilation fails on first (second, third,..) attempt with exception: 17:24:29,909 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception java.io.IOException: tmpFile.renameTo(classFile) failed at org.apache.jasper.compiler.SmapU...

applying JSP/JSTL's <c:url> to a path inside a servlet

In our JSP pages, we use extensively. Works great, rewrites the URL to deal with sessionids, contexts, etc. But now we need to do some of this work inside a class that takes an HttpServletRequest and HttpServletResponse as part of the Spring Security specification. How do I apply a type transformation to a path in a servlet? I gues...

JSPX adds <?xml version="1.0" encoding="UTF-8"?> to top of page, causes JS errors in IE6

When JSPX compiles, it automatically adds <?xml version="1.0" encoding="UTF-8"?> to top of file which causes some JavaScript code not to work on Internet Explorer 6. How can I avoid it to add <?xml version="1.0" encoding="UTF-8"?> in output file? ...