jsp

How can I connect two users so they can share common object (game instance) with use of J2EE web technologies (JSP, Spring etc.)?

My idea is that player 1 creates a game (for two players), server returns him a URL, player 1 sends this URL to player 2 and the player 2 opens URL and that connects him to the game. What is the best and the easiest way to achieve this using JSP and related technologies? ...

How to save, retrieve and draw an image in webapplication using Java and PostgreSQL?

Given an object X; I want this object to have an image. The image must be stored in the database. I can't store the path, the actual image must be in the database. My question can be answered by answering the following subquestions: a). What type of field should I put in the database? (e.g VARCHAR) b) What type of object should I use ...

Retrieving image from database using Ajax

I'm trying to read image from database with Ajax, but I could not read the xmlhttp.responseText to the img src. The image is saved as binary data in database and also retrieved as binary data. I'm using Ajax in JSP, because I want to give the user the ability to upload images and I will view the last uploaded image, on mouse over action ...

How to persist a cookie?

Hi, I am creating a cookie in a jsp script, which is located at: www.myproject.com/login/index.jsp if I restart the browser and navigate there, all works well, I can see the cookie persist. If I navigate to: www.myproject.com I am not seeing the cookie. Do I need to set something in the cookie path or domain to make the cookie vis...

JSP taglib with tags-appender

Using tiles, spring web mvc and a lot of jsp files. I need some tags with following logic: <tl:append tag="script"> ... javascript code ... </tl:append> This jsp tag would append javascript code to bottom of in the . Just wanna have javascript in one place. Also, I wanna use such taglib for css styles and so on. Are there any a...

Tomcat servlet-api.jar problem

I am running a web application using Tomcat and Java Servlets, JSP's, etc. I am aware that in order to use Servlets, it is dependent on the Servlet-api.jar file. Initially I placed this jar file in the WEB-INF/lib/ directory. This has worked fine for me for months during the developmental phase. When we put the application onto the ...

Using static strings to define input field names in JSPs - good idea or not?

I've just be asked to work on a large portal project and have been looking through the established code. I keep finding this in the jsps: <input class="portlet-form-button" name="<%=ModifyUserProfile.FORM_FIRST_TIME_LOGIN_SUBMIT%>" type="submit" ... The authors are using static strings defined in classes to define the names of inp...

Passing JSP parameter to javascript won't work in IE8!

I've got a Servlet that generates a XML string (relatively long) which I then pass to a Javascript variable in the forwarded JSP file: $(document).ready(function() { ... var itXML = <% out.print((String) request.getAttribute("xml")); %>; ... } This seems to work just fine in Firefox, but when I run the same project on IE8 ...

how to insert checkbox values especially image url to mysql using jsp

how to insert checkbox values especially image url to mysql using jsp ...

Accessing Spring beans from a Tiles view (JSP)

In Spring MVC I can access my beans in JSP using JstlView's exposedContextBeanNames (or exposeContextBeansAsAttributes). For example, then, in my JSP I can write (${properties.myProperty). But when the same JSP is a part of a tiles view, these properties aren't accessible. Is possible to configure Tiles properly or access these propertie...

Inserting Struts Tiles attribute into a JavaScript function

Hi, I'm trying to insert a Struts Tiles attribute into a JavaScript function. The JS function is called on load and certain JSP pages should be allowed to append additional code to that function. The template looks like this: <html> <head> <script> function onLoad(){ ... <tiles:insert attribute="html.head.onLoad" ignore="tru...

How to display formated Calendar type in JSTL?

I am using Calendar type in Java and I would like to display formated date in JSTL. I was trying: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> <fmt:parseDate var="date" type="date" dateStyle="short" value="${photo.dateCreated}" /> <c:out value="$...

Prevent IE caching

I am developing a Java EE web application using Struts. The problem is with Internet Explorer caching. If an user logs out he can access some pages because they are cached and no request is made. If I hit refresh it works fine. Also if an user goes to login page again it won't redirect him because that page is also cached. Two solutions...

What causes a lexical analysis error for eclipse in jsp EL validation?

I've got some EL code inside of a JSP tag. The line starts as follows: <c:if test="${pageContext.request.serverName eq \'localhost\'}"> Eclipse throws up an error on this, saying: Unable to analyze EL expression due to lexical analysis error I'm unsure what this even means. Is this an eclipse bug? Am I mixing EL and the JSTL tag...

JSTL expression evaluation from a string

Is it possible to evaluate a String as EL expression in JSP and get value from it? I need an expression like ${model.${fieldPath}} where fieldPath will contain the required object path from a nested object model. I can get the actual field path by using but I am not sure how to evaluate a string and get the value from it Any help r...

How to handle exceptions from an image-generating Servlet?

I have a simple (Servlet, JSP, and JSTL) web app whose main functionality is displaying images retrieved from a back-end server. The controller servlet forwards the user to a JSP that in turn uses another Servlet to display the resulting image on that same JSP. Further down, the JSP has a line similar to: <a href="<c:out value='${imageU...

Unbuffered JspWriter sends to PrintWriter, is that bufferred?

The JspWriter docs say, "If the page is not buffered, output written to this JspWriter object will be written through to the PrintWriter directly.... But if the page is buffered, the PrintWriter object will not be created until the buffer is flushed". The PrintWriter docs show a flush() method, which makes me think it's somehow buffered...

onload script does not work in subview page in JSF

I have written two JSP pages: outerPage.jsp and innerPage.jsp. The outerPage.jsp includes innerPage.jsp. The innerPage.jsp has one textfield and one button. I need to set focus on textFiled in innerPage.jsp while the page loads. I wrote JavaScript which is called during body onload of outerPage.jsp, but it does not work. Here is the ou...

Uploading a zip file to a jsp and extract the content in another jsp

I want to upload a zip file in a jsp page and the user is sent to another jsp page after he selects and uploads the file. In this second page I want to 1.)extract the uploaded zip file. 2.)read some content from the extracted file(s) and allow the user to change/edit them 3.)save the user changes in the files. 4.)zip the files aga...

call lynx from jsp script

Hi, I have an execute(String cmd) in a jsp script that calls the exec method from the Runtime class. It works when I call a local command, like a php script stored on the server. for example: /usr/bin/php /path/to/php/script arg1 arg2 So I guess my execute command is ok, since it is working with that. Now when I try to call lynx, the...