jsp

web server-side technologies niches

My background is asp.net development and I took part in several projects where developer team was free to choose server-side programming technology (PHP, ASP.NET[Web Forms/MVC], JSP) & free to buy any CMS. Looking backward I realize technology & approach we chose often wasn't the best one. I'll enumerate some projects: One web portal ...

How to make ActionBean be instantiated immediately but not after I call one of handlers?

I'm trying to make something simple with Stripes. I've read and heard a lot about easiness of using this framework and about steep learning curve (i.e. learning is quite fast and productive). But till this moment I can't even create the simplest HelloWorld with Stripes. All examples I've found demonstrate functionality like: "click on...

In JSP page I want to get IP address of user who view the page. How?

In JSP page I want to get IP address of user who view the page. How can ? ...

JSTL Tei Not Working

All the jstl tags which do not involve passing back a value(using tei) are working, but whenever I use a tag like <c:forEach var="abc">...<%=abc%></c:forEach> i am getting an error abc cannot be resolved. <c:forEach var="i" begin="0" end="<%=len%>"> <%str+=" Parameter type= " + (String)(tArray[i]) + " Parameter Value= "+ pArray[i]; lo...

Where do I put session information? In HttpServletRequest.setAttribute()?

Hi, I have a servlet class which handles login. At the end of my login procedure, I do this: // jsp page ... Helper.loginUser(request); // Helper.java public static void loginUser(HttpServletRequest request) { request.getSession().setAttribute("username", "john"); } in order to remember who a user is between page loads. In anot...

What causes a 'Type expected' error in JSP?

In a JSP file I'm getting a: Type expected (found 'try' instead) Error while attempting to set up a connection. This leaves me with two questions. What is going wrong here? and more generally, what causes 'Type Expected' Errors in JSP? Since I can't find an explanation of the error in a Google search. Here's the code. <%! class T...

Cancel a rogue jsp comment at the beginning of an html document

I'm working as a front-end developer on an old jsp-based cms that is no longer supported by our vendor. At the beginning of a certain page template, the html document starts with: <!%@ include file = "setCookie.jsp" %> This will always be the first line of the file. The display is not an issue in Firefox, but IE tweaks out. I've tr...

Need a guide on Spring Front Controller and Bean Concept

I am following the spring MVC tutorial and also reading this article on mvc design patterns http://www.javaranch.com/journal/200603/frontman.html Hence I am trying to make an app with like this, that make use of spring mvc structures and frontController design pattern. 1. frontController with the DispatcherServlet from spring, that redi...

How to change month dynamically in JSP?

In my program, there are two buttons and in the center of the two buttons there is a space for month to display dynamically using JSP, e.g. << current month >>. The << and >> are two buttons. I need a logical or a programmatic explanation for the following to occur: When I click on the left button the previous month of the current mon...

call applet in spring class

how to call a applet in spring control class? ...

Getting Spring MVC Relative path

I am using Jboss and Netbeans to create Spring MVC web application on windows. it runs on http://localhost/myapplication/ My project path is D:\Myapplication\ My JSP Views are in D:\Myapplication\web\jsp\ My Javascripts are in D:\Myapplication\web\js\ Controllers are in D:\Myapplication\web\src\java\controller\ I have created 1 cont...

DisplayTag Sort and Pagination links(url) generated is too long.

When using displaytag the URL it's generating for paging and sorting is too long for IE. Is there a way around this without resorting to external paging and sorting? Cheers. ...

How can I wrap my JSP-generated HTML in a JSONP wrapper?

I have a JSP page that renders a block of HTML. In normal usage, I load the contents of the JSP using AJAX (specifically, using jQuery.load()) and insert it into the page. Now, I need to be able to load this block of HTML into a different domain, which means the same-source restrictions won't allow me to use "normal" AJAX. This block ge...

javascript validation

I have two input fields say val1 and val2 in jsp.Let say val1 is dynamic, I need to restrict user entering the value of val2 not exceeding val1. It can be equal but not more. I tried with onKeypress but i was not able to success. Val1 value can be get from document.getElementById(..).value. Can anyone tell me the efficient way to do this...

How can I get Tomcat to output empty string instead of null?

I just switched over to Tomcat 6.0.26 from a different Servlet/JSP engine. Previously, null values would print out as an empty String. However, Tomcat is printing out nulls as "null". <% String str = null; %> The value of str is <%= str %>. This outputs The value of str is null. How can I get Tomcat to replace nulls with empty/bl...

Passing a string between two urls on same domain (but not in a session?)

Hi, I have a servlet forwarding a request to another url in the same domain. I want to pass a string between the two, like: // ServletVerifyUser.java: public void doGet(HttpServletRequest req, HttpServletResponse resp) { // do some work.. req.setAttribute("message", "Thanks for signing up!"); req.getRequestDispatcher("/lo...

javascript detect redirect vs. page reload

In my JSP page, i am using response.sendRedirect(..) to redirect to an HTML page. Is it possible to use javascript to detect whether a redirect occurred versus a page reload? Thanks. ...

jstl foreach omit an element in last record

trying to use this jstl to formulate a json string, how can i make the segment not to put a comma in the end of the last record? note the comma in the end <c:forEach items="${fileList}" var="current"> { id:1001,data:["<c:out value="${current.fileName}" />" , "<c:out value="${current.path}" />" , "<c:out value="${current.size...

issues in multi page navigation in JSF

Hi, I am having problems in implementing menu navigation in JSF where I am using one header.jsp which is included in all other jsps, from main page forward navigation is working fine but if I want to go to any other page using dropdown menu I am getting javascript error as f: has no value. here is my header.jsp menu part <li><a href="...

list option in html from text files

I want to list options in drop down menu in HTML form but i need to make some options to be multiline .and the options i need to read them from text file.any ideas how to do that? ...