This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes JSP Should recognise fundamental class Enumeration? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Should recognise fundamental class Enumeration?" Watch "JSP Should recognise fundamental class Enumeration?" New topic
Author

JSP Should recognise fundamental class Enumeration?

northfield Sid
Ranch Hand

Joined: Aug 08, 2002
Posts: 106
I am working with JSP forms.
I have got this error on class Enumeration not found. I do not why I am getting this error since it is a fundamental class and JSP should recognise this?
<HTML><HEAD><TITLE>Dynamic Form</TITLE></HEAD>
<BODY>
<B>Form</B>
<FORM ACTION=dynamicForm.jsp METHOD=POST>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>
<% String[] textFields = {"FirstName", "LastName", "Address", "City", "Zip"};
for(int j=0; j<textFields.length; j++){ %>
<TR> <TD> <%=textFields[j]%>: </TD>
<TD> <INPUT TYPE=TEXT NAME=<%=textFields[j]%>> </TD>
</TR>
<% } %>
<TR> <TD> State </TD>
<TD> <SELECT NAME=State>
<% String[] states = {"AZ", "CA", "NM", "MA", "ME", "MD", "..."};
for(int s=0; s<states.length; s++) { %>
<OPTION><%=states[s]%></OPTION>
<% } %>
</SELECT></TD>
</TR>
<TR> <TD> Card Number </TD>
<TD> <INPUT TYPE=TEXT NAME=cNumber></TD>
</TR>
<TR> <TD> Card Type </TD>
<TD> <SELECT NAME=CardType>
<% String[] cTypes = {"Amex", "Visa", "Master Card", "Discovery", "..."};
for(int t=0; t<cTypes.length; t++) { %>
<OPTION><%=cTypes[t]%></OPTION>
<% } %>
</SELECT></TD>
</TR>
<TR> <TD> Expiration Date (MM/DD/YYYY) </TD>
<TD> <INPUT TYPE=TEXT NAME=cMonth SIZE=2><INPUT TYPE=TEXT NAME=cDay SIZE=2>
<SELECT NAME=cYear>
<% int startYear = 2000;
int endYear = 2010;
for(int y=startYear; y<endYear; y++) { %>
<OPTION><%=y%></OPTION>
<% } %>
</SELECT></TD>
</TR>
</TABLE>
<INPUT TYPE=SUBMIT VALUE=Submit>
</FORM>
<HR>
<B>Form Content</B><BR>
<TABLE>
<% Enumeration parameters = request.getParameterNames();
while(parameters.hasMoreElements()){
String parameterName = (String)parameters.nextElement();
String parameterValue = request.getParameter(parameterName); %>
<TR>
<TD><%=parameterName%></TD>
<TD><%=parameterValue%></TD>
</TR>
<% } %>
</BODY></HTML>

Location: /myJSPs/jsp/Hour11/dynamicForm.jsp
Internal Servlet Error:
org.apache.jasper.JasperException: Unable to compile D:\tomcat\jakarta-tomcat-3.3.1\work\DEFAULT\myJSPs\jsp\Hour11\dynamicForm_1.java:150: Class jsp.Hour11.Enumeration not found.
Enumeration parameters = request.getParameterNames();
^
1 error
at org.apache.tomcat.facade.JasperLiaison.javac(JspInterceptor.java:898)
at org.apache.tomcat.facade.JasperLiaison.processJspFile(JspInterceptor.java:733)
at org.apache.tomcat.facade.JspInterceptor.requestMap(JspInterceptor.java:506)
at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:968)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:875)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:494)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:516)
at java.lang.Thread.run(Thread.java:484)
Please help???
chanoch wiggers
Author
Ranch Hand

Joined: May 24, 2001
Posts: 245
its not a fundamental class though, it belongs to java.util. So you will need to import java.util at the top of the jsp page.
chanoch


chanoch<p><a href="http://www.amazon.com/exec/obidos/ASIN/1861007736/" target="_blank" rel="nofollow">Author of Professional Apache Tomcat</a></p>
northfield Sid
Ranch Hand

Joined: Aug 08, 2002
Posts: 106
Thanx your suggestion works.
In Java programming I think you don't need to import this package?? I think the util and maths package is imported implicitly. ANy way the program works with the import statement.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
java.lang is imported implicitly. java.util you must explicitly import


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSP Should recognise fundamental class Enumeration?
 
Similar Threads
jsp:include needs to have "flush=true"
Getting Parameters from form
Looping thrugh an Enumeration Object
Submit and Excel buttons and my Jsp
StringTokenizer error on JSP