Meaningless Drivel is fun!
The moose likes JSP and the fly likes JSP code is not working in jquery Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP code is not working in jquery" Watch "JSP code is not working in jquery" New topic

JSP code is not working in jquery

gupta pankaj

Joined: Mar 06, 2013
Posts: 3
\\I am not able to understand the problem.
\\when i miss the jsp code i.e <% all data %> then it work fine, but when i enter the
\\jsp code in it it does not give any output. soo help me out?
\\This is the whole program:

<%@page import=""%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="//">

var str1;
alert("Value: " + $("#dir1").val());

String str1 = "d:\\";
File f1 = new File(str1);
File[] contents = f1.listFiles();
for (int j = 0; j < contents.length; j++) {
\\Want to display the files and directories
if (contents[j].isDirectory()) {

out.println("Directory : " + contents[j].getName() + "<br/>");
if (contents[j].isFile()) {
out.println("Files :" + contents[j].getName() + "<br/>");


<title>JSP Page</title>

<input type="text" name="dir1" id="dir1"/>

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

JSP code has nothing much to do with jQuery. JSP executes on the server; jQuery on the client. All that matters is what is sent to the browser.

So rather than look at the server-side code, look at what is sent to the browser. Is it correct? Is it valid? What's different?

By the way, Java code in a JSP is a very poor and obsolete practice from 12 years ago. You should no longer be putting Java code in JSPs.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: JSP code is not working in jquery
It's not a secret anymore!