Home Answers Viewqa JSP-Servlet unable to compile class file

 
 


Shanthi
unable to compile class file
2 Answer(s)      4 years and 7 months ago
Posted in : JSP-Servlet

View Answers

October 24, 2008 at 10:21 AM


Hi,

<%@ page language="java" import = "java.util.*;"%>
<%
List userList;
int nouser;
int i=1;
List cityList;
int nocity;
int j=1;
%>
<%
userList=(ArrayList)request.getAttribute("useridList");
nouser = userList.size();
%>

<%
cityList=(ArrayList)request.getAttribute("cityList");
nocity=cityList.size();
%>
<html>
<head>
<title>dynamic bombobox in servlet</title>
</head>
<body>
<br><br>
<center>
<table border="1" width="300px" bgcolor="bluelight" cellspacing="0" cellpadding="0">
<tr>
<td width="100%">
<form method="GET" action="/examples/jsp/ComboboxList">
<font color="red"><h3 align="center">Dynamic Combobox List</font></h3>
<table border="1" width="300px" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"><b>User Name:</b></td>
<td width="50%"><select name="userid" value="">
<option value="0">---Select Name---</option>
<%
Iterator userit= userList.iterator();
while(userit.hasNext()){
while(i<=nouser){%>
<option value="<%=i%>"><%=userit.next()%></option>
<%
i++;
}
}
%>
</select>
</td>
</tr>
<tr>
<td width="50%"><b>City:</b></td>
<td width="50%">
<select name="city" value="">
<option value="0">----Select city----</option>
<%
Iterator cityit= cityList.iterator();
while(cityit.hasNext()){
while(j<=nocity){%>
<option value="<%=j%>"><%=cityit.next()%></option>
<%
j++;
}
}
%>

</select>

</td>
</tr>

</table>

</form>
</td>
</tr>
</table>
</center>
</body>

</html>

October 24, 2008 at 10:22 AM


servlets code

package javacode;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import java.util.*;
import java.util.ArrayList;

public class ComboboxList extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException{
response.setContentType("text/html");
PrintWriter pw = response.getWriter();
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from Combolist");
List ulist = new ArrayList();
List clist = new ArrayList();
while(rs.next()){
request.setAttribute("userid", rs.getString(2));
request.setAttribute("city", rs.getString(3));
pw.println("userid" + " "+"city"+"<br>");
pw.println(rs.getString(2) + " " + rs.getString(3) +"<br>");
ulist.add(rs.getString(2));
clist.add(rs.getString(3));

}
request.setAttribute("useridList", ulist);
request.setAttribute("cityList", clist);
}
catch (Exception e){
pw.println(e);
}
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/jsp/Combobox.jsp");
dispatcher.forward(request, response);
}

}
---------------------------------------------


Read for more information.

http://www.roseindia.net/servlets/

Thanks.









Related Pages:
Unable to compile class for JSP - WebSevices
Unable to compile class for JSP  org.apache.jasper.JasperException: Unable to compile class for JSP When I am trying to access a java file kept under src folder under a package from a jsp page placed under web directory, I am
unable to compile class file - JSP-Servlet
unable to compile class file  I wrote database connection in jsp file. I have form in html. In html form i put drop down list box in that form...*; import java.util.ArrayList; public class ComboboxList extends HttpServlet
Unable to compile Servlet
Unable to compile Servlet  First I installed the tomcat server in C...\servlet-api.jar Then I created my servlet file Servlet_LifeCycle.java under... was created by me. To compile my servlet program I did the following: C:\apache
JAVA Compile Question ?
JAVA Compile Question ?  I'm unable to compile this file and not sure... java.io.IOException; public class FileStatistics2 { public static void main(String[] args...("The text file is " + ratio + "% of the size of the word file
compile a java class
compile a java class  Hi, Am having a class ExampleOne.java in the location C:\learn\ExampleOne.java I want the class file to be present in C:\. I don't want to add any package details in the code. Is is possible to get
compile a java class
compile a java class  Hi, Am having a class ExampleOne.java in the location C:\learn\ExampleOne.java I want the class file to be present in C:\. I don't want to add any package details in the code. Is is possible to get
unable to run servlet
unable to run servlet  Dear sir/madam i have jdk1.5.0_04 and tomcat...*; import javax.servlet.http.*; public class HelloWorld extends HttpServlet...-mapping> 6)Compile your servlet. 7)Run Tomcat server by clicking
compile error
compile error  Hello All for example public class... program with Test.java and try to compile with javac test.java an error like test.java :2 : class A is public ,should be declared in a file named A.java
how to compile programs??????????
how to compile programs??????????  "javac" is not recognised as a file name. why??????????   Have you set your path name and class name correctly? Anyways have a look at the following link: Install Java
compile time error
compile time error  my program compile successfully and make the class file also but when i tried to do next command to see the output,it showing error that "could not find or load main class fibbo" fibbo is my class name
compile time error
compile time error  my program compile successfully and make the class file also but when i tried to do next command to see the output,it showing error that "could not find or load main class fibbo" fibbo is my class name
compile time error
compile time error  my program compile successfully and make the class file also but when i tried to do next command to see the output,it showing error that "could not find or load main class fibbo" fibbo is my class name
unable to get datas from oracle database
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred...unable to get datas from oracle database  Dear Sir, I am again... this error when i run the jsp file in tomcat, I post my code below.. kindly let me
unable to connect database in java
unable to connect database in java  Hello Everyone! i was trying to connect database with my application by using java but i am unable to connect... created. 6) Restart your compiler and compile your java code. For Inserting Data
Compile error - Java Beginners
Compile error  I get this error when compiling my program: java:167... java.util.HashMap; public class TestLineCounter { public static long totalLines... if the string is a class declaration. Class declarations begin with a modifier public
Unable to call .jrxml file from jsp
Unable to call .jrxml file from jsp  Hi, I am doing web application... plugin. After creating report in netbean when i call that jrxml file then it unable to access it.Error also not showing. I will show my code and its output
Example to compile a java file with the help of the program
Example to compile a java file with the help of the program... are describing you the way to compile the java file with the help of the java program... below: For this we are taking a class Compile Hello, Inside the main method we
plaz help me i try to compile from last 2 day .
plaz help me i try to compile from last 2 day .   org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 34 in the jsp file: /saveUpdate.jsp name cannot be resolved to a variable 31
plaz help me i try to compile from last 2 day .
plaz help me i try to compile from last 2 day .   org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 34 in the jsp file: /saveUpdate.jsp name cannot be resolved to a variable 31
unable to see the output of applet. - Applet
unable to see the output of applet.  Sir, I was going through.... u just copy that java source code and compile that using javac then you... with "appletviewer name_of _the_html_file" I hope it solves your probleam
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..
Unable to connect servet, jsp to oracle 10g database.. Unable to retrieve data..  I have a class file AbstractDataAccessObject with the below code...; import com.dts.core.util.LoggerManager; public class AbstractDataAccessObject
How to compile PHP file and provide it to user without code?
How to compile PHP file and provide it to user without code?  I have created a class in PHP, that contains some useful methods. Now I want to give... in asp.net instead of providing code file. How can I compile the PHP file and provide
java script unable to connect to oracle database and insert data
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred...: org.apache.jasper.JasperException: Unable to load class for JSP...java script unable to connect to oracle database and insert data  
unable to import class com.opensymphony.xwork2.ActionContext not found
unable to import class com.opensymphony.xwork2.ActionContext not found  Imported class com.opensymphony.xwork2.ActionContext not found gettin the above error
Compile error - WebSevices
Compile error  Hello, How to read .pdf file using Javascript/php. Any one send the code
How to compile and run the JSP
How to compile and run the JSP  Hi Kindly tell me how to run and compile JSP small Program using Tomcat as webserver. I created small program HELLO JSP in HTML and compile the program but it is saying Class o r interface
compile and run java program
compile and run java program  Hello, everyone!!! I just want to ask if you anyone here knows how to compile java file in linux specifically UBUNTU... do I compile and run this file using the terminal of ubuntu... By the way, I am
Compile time error
Compile time error  Hi, When i compile my simple program in cmd am getting a error like "Javac is not a recognized as an internal or external command, operable program or batch file" How to resolve this problem ????  
Unable to execute JSP page
Unable to execute JSP page  I have written one jsp file. It contains html tags and jsp directives. I have saved the file with the extension .jsp. The tomcat server is already running onto my machine. I have saved the jsp file
Using Ant to execute class file
Using Ant to execute class file       This build.xml file is used to compile and run...;; third one is used to compile the java file from "src" directory
Unable to use JMXMP with Knopflerfish?
Unable to use JMXMP with Knopflerfish?  I have a bundle which runs properly with Eclipse, then I generate the jar file and try to use...(RunJMXAgent.java:36) at java.lang.Thread.run(Unknown Source) Note that the jar file
Unable to get data from class - Development process
Unable to get data from class  I get this code from the internet...*; import java.util.*; public class ComControl implements Runnable...; } } ========================================================================= In my other class, I have my desktop application which called
bad class file - JSP-Servlet
) and got a "bad class file...): myservlet.java:9: cannot access HttpServlet bad class file: \HttpServlet.class...bad class file. I'm (desperately) trying to get... api.jar file that you have downloaded from class path.Find servlet-api.jar from
Unable to understand Struts - Struts
Unable to understand Struts  I am studying in GNIIT from NIIT. Here... */ public class AddBookStruts extends org.apache.struts.action.Action... */ public class AddBookServlet extends HttpServlet
SOLUTION: How to compile Objective C on Windows with GNU Step ?
SOLUTION: How to compile Objective C on Windows with GNU Step ?  <... in MyClass.h file modified as:</strong></p> <h1>import<...;<strong>Compile using the below mentioned command line:</strong><
unable to find resource 'VM_global_library.vm' - Java Server Faces Questions
unable to find resource 'VM_global_library.vm'  pls help me, I am... 12 12:03:54 CAT 2008 [info] Default Properties File: org\apache\velocity... to use logger class org.apache.velocity.runtime.log.AvalonLogSystem Tue Aug 12 12
unable to connect to server - JSP-Servlet
unable to connect to server  thank you for the program code for inserting and reteriving the image but i am unable to deploy these two programs..., create a web application folder inside the webapps folder and put the jsp file
class file
class file  How to create class file in jsf easily
file class
file class  Hi Friend, I have a file class it lets me extract all the data from a csv file but I need to align the data properely, seperating... java.util.*; public class ReadCSV{ public ReadCSV (){ } public static
class file
class file  how to convert java classfile into java sourcefile
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
i am unable to identify the error in my code
i am unable to identify the error in my code  class Program { public static void main(String[] args) { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("enter
Java compile time error. - Java Beginners
Java compile time error.  CreateProcess error=2, The system cannot find the file specified  Pleae Describe your query  Hi friend, Please specify in detail and send me code. If you are new java
compile this program and let me know the resolution
compile this program and let me know the resolution  class Maxof2{ public static void main(String args[]){ //taking value as command line...+" is greater than "+i); } } please compile and let me know the resolution  
Unable to send mail using php script
Unable to send mail using php script  Hello i am trying to send mail using mail function.But the message is never sent. I have installed a free smtp server which i run in background before executing the code.and my php.ini file
i got an error while compile this program manually.
i got an error while compile this program manually.  import javax.servlet.http.*; import org.apache.struts.action.*; public class ActionOne{ public ActionForward execute(ActionMapping mapping
Generated java file - JSP-Servlet
org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 7 in the generated java file Syntax error on token ";", delete this token
Unable looping using JOptionPane - Java Beginners
Unable looping using JOptionPane  import javax.swing.*; public class Shop{ public static void main(String [] args){ Shop shop = new Shop..., Try the following code: import javax.swing.*; public class Shop{ public
Java file class
Java file class  What is the purpose of the File class
Struts2...problem in JSP..unable to get the values for menuTitle!!!
Struts2...problem in JSP..unable to get the values for menuTitle!!!  ... java.sql.DriverManager; public class ConnectionProvider { public static... java.sql.ResultSet; import java.util.*; public class DAO { public List<MenuList>

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.