• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSP Should recognise fundamental class Enumeration?

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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???
 
Author
Posts: 245
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
northfield Sid
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.lang is imported implicitly. java.util you must explicitly import
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic