jsp

Declaring functions in JSP?

I come from PHP world, where declaring a function in the middle of a php page is pretty simple. I tried to do the same in JSP: public String getQuarter(int i){ String quarter; switch(i){ case 1: quarter = "Winter"; break; case 2: quarter = "Spring"; break; case 3: quarter = "Summer I"; break; case 4: quarter = "Summer II"; br...

How to Include a file outside the application (war) using jsp include

I am using "jsp:include" to include a static file in one of my jsp files. It works fine when the static html file is located inside the application folder. However if its kept outside the application folder it is not included in the JSP file. Note: I have created a context for the folder where the static file is saved and I m able to v...

Netbeans incompatible types question

Hi there, I am getting the following warning in Netbeans: incompatible types found : carPackage.port.search required : carPackage.SearchResponse In my JSP page, I have the following code: CarService service = new CarService(); CarPort port = service.getCarPort(); SearchResponse searchResult = port.search("Toyota"); The error obviou...

processing json objects in jsp

i have a JSON object sent from the browser to the jsp page. how do i receive that object and process it in jsp. do i need any specific parsers? i have used the following piece of code. but it wouldnt work. essentially i should read the contents of the object and print them in the jsp. <%@page language="java" import="jso.JSONObject"%> ...

Java Servlet connecting to SQL Server tutorial?

Can anyone recommend a tutorial on how to write a Java Servlet which connects to MS SQL server and manages data? I'm trying to write something which pulls products out of one database and inserts them into a stored procedure located on another database. Thanks in advance. ...

Unit testing JSPs in embedded mode

I am in process of building up a small framework that does unit testing for JSPs. These JSPs have some custom tags, otherwise they are not any special. Although there are numerous Java unit testing solutions available, I prefer not to use the method where a separate full-blown JSP container is launched, application deployed and results ...

IE Operation Aborted - None of the regular fixes work!

Hello StackOverflow! First of all, I've been researching this "Operation Aborted" error / bug for what seems like weeks, so here are a couple related questions and good articles if you are not familiar with it: Why does ASP.NET cause the “Operation Aborted” Error in IE7? (so question) Detecting cause of IE’s Operation Aborted Issue (so...

How can I check if a user has a certain role in JSP?

I need to make decisions in a JSP based on the user's roles. Is there a tag or EL expression that lets me do that? ...

JSONobject to JSONtext

how can i convert a JSON Object to JSONtext in a javascript function. i should pass the JSONtext as a string to JSP. ...

What is the best way to create a Java Servlet or JSP that optionally includes content depending on URL parameters

I want to create a JSP page or servlet that will work in 2 ways. A user visits their own profile page: http//something.com/profile/ Or they visit their friends page: http://something.com/profile/FriendsName They could also visit their own page through an explicit URL like: http://something.com/profile/YourName I have a servlet-mapp...

Make Struts show different JSPs for different roles

We have a Struts 2 web application that's used by pretty much every employee to manage and configure jobs for our server farm. We're working on a plan to make a dashboard for customers, so they can see their own jobs, and a very simple display of its status ("in process", "ready for proofing", "finished", etc). All of the pages the cus...

Redirect Apache to Tomcat - IllegalStateException when navigating in the app

Hi, I'm using Apache 2.2 and Tomcat 6.0.18 on Windows XP. I've enabled the mod_proxy module to redirect the traffic from my Apache web server to Tomcat. I only updated the httpd.conf file to have the redirection like this: ProxyPass /myapp http://MYMACHINENAME:8080/MyApp/Start ProxyPassReverse /myapp http://MYMACHINENAME:8080...

Spring JSP form:input tag puts commas in int value

Using Spring 2.5 tag library, I have an Integer value in a command form that's rendered on my page using <form:input path="budget" htmlEscape="true" /> When the value is > 999, it renders the number as value="x,xxx" on the page. My validation isn't expecting the comma and rejects the value. Is there a fix for the rendering, or do I n...

GAE - Error when browse jsp page

I create a blank project (by using eclipse plugin), create a default jsp page, run GAE server, browse to this jsp and i got error JRE: 1.6, Compiler: 1.6 JSP file: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://...

tomcat polling issue

Hi I am not sure if anyone else encountered this issue, I have a java app that polls data from an external provider every second, it works fine and polls data as required -this is a console app I have written a jsp service that does the same, it is basically returning the same data that the console app writes to the console, instead...

Exporting jsp tables to excel, word, pdf

Can anyone suggest me any library/jar files which I can use to export my table to excel/pdf/word. Please tell me if there is any library by which I can create reports in jsp. ...

exporting tables to excel / word using POI

i want the code to export tables/ reports to excel and word uisng POI i saw the examples that came with POI but cuoldnot understand.Can anyone provide me a small/easy code to do the same. ...

HTML/JSP Doubt, Print date on webpage...

I made a function which displays date on the webpage,, and i uploaded the same onto some server... But when i changed the date of my system, i noticed that the date is dependent on client machine.. Is it not possible to get the date from actual time server and embed that code into my program.. Hope i am able to explain my doubt.. Ple...

Is there a DTD or Schema file for jsp tag files?

I am writing some JSP 2.x tag files. I have searched for a few hours now, but I was not able to find doctype/schema definitions/dtds for jsp based tag files. Does anybody knows if there are dtd/schema files to ease the pain of writing those tag files? It's pretty painful to not have auto completion and so on in eclipse. I have to check ...

how do you read locale information from session?

The following bit of code sets the Locale from lang param on querystring. <c:if test="${param['lang'] != null}"> <fmt:setLocale value="${param['lang']}" scope="session"/> </c:if> How do I now read that variable? I know its a bit noobish. I need a bit of conditional logic to display one language link if the local hasn't been set ...