Hi this is my first post but so far this is pretty good site. I have a file called index.html with the following code: -
<!-- index.html -->
-
-
<html>
-
<head><title>Student Registration Front</title></head>
-
<body bgcolor="#ffffcc">
-
-
<h2 align="center"><font color="#800000">Student Registration Webapp 2007</font></h2>
-
-
<p> </p>
-
<p> </p>
-
-
<!-- <form action="http://localhost:8080/eventRegister/front.jsp" method="post"> -->
-
<form action="https://tomcat.cscs.wmin.ac.uk:9191/tomcat/w1009048/front.jsp" method="post">
-
<table align="center">
-
<tr><th>Student Registration: </th>
-
<td><input type="radio" name="choice" value="register" checked> </td>
-
<td> <font color="blue">you must register here first</font></td></tr>
-
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
-
<tr><th>Login for registered students: </th>
-
<td><input type="radio" name="choice" value="login"> </td>
-
<td><font color="red">this is not yet implemented<br />
-
and leads to a blank page</font></td></tr>
-
-
<tr><td> </td><td> </td><td> </td></tr>
-
-
<tr><td> </td>
-
<th><input type="submit" value="Submit"></th>
-
<td> </td></tr>
-
</table>
-
</form>
-
-
</body>
-
</html>
-
When they click on submit it goes to my front.jsp which has the following code(front.jsp is actually FrontController .java changed in web.xml): -
// FrontController.java
-
-
import java.io.* ;
-
import java.util.* ;
-
import javax.servlet.* ;
-
import javax.servlet.http.* ;
-
import beans.*;
-
-
/*
-
The front controller:
-
* creates a new 'session' object,
-
* creates an empty 'error message' String which it stores in 'session', then
-
* redirects the request to either:
-
- 'register' (the real JSP, register.jsp), or
-
- 'login' (not implemented)
-
*/
-
-
public class FrontController extends HttpServlet
-
{
-
public void doPost( HttpServletRequest request, HttpServletResponse response )
-
throws IOException, ServletException
-
{
-
String strChoice = request.getParameter( "choice" );
-
-
if ( strChoice.equals( "register" ) )
-
{
-
HttpSession session = request.getSession();
-
-
String strError = " "; /* now 'store' this String object - this is not a bean
-
but can be stored in 'session' in exactly the same way */
-
session.setAttribute( "error", strError );
-
-
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher( "/register.jsp" );
-
dispatcher.forward( request, response );
-
}
-
else
-
{
-
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher( "/login.jsp" );
-
dispatcher.forward( request, response );
-
}
-
}
-
}
-
After from frontcontroller , it should go into register.jsp but it does not becuase it i get this error message: -
-
HTTP Status 500 -
-
-
--------------------------------------------------------------------------------
-
-
type Exception report
-
-
message
-
-
description The server encountered an internal error () that prevented it from fulfilling this request.
-
-
exception
-
-
org.apache.jasper.JasperException: /register.jsp(4,0) The value for the useBean class attribute bean.Counter is invalid.
-
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
-
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
-
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
-
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
FrontController.doPost(FrontController.java:34)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
-
-
root cause
-
-
org.apache.jasper.JasperException: /register.jsp(4,0) The value for the useBean class attribute bean.Counter is invalid.
-
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
-
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
-
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
-
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
-
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
-
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
-
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
-
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
-
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
-
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
-
org.apache.jasper.compiler.Generator.generate(Generator.java:3320)
-
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
-
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
-
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
-
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
-
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
-
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
-
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
-
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
FrontController.doPost(FrontController.java:34)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
The reason why it shows this error message is cos i add this following line of code in my register.jsp: <jsp:useBean id="counterid" class="bean.Cou nter" scope="applicat ion" />
The full code is here: -
<%-- register.jsp --%>
-
-
<%@ page language="java" contentType="text/html; charset-ISO-8859-1" %>
-
<jsp:useBean id="counterid" class="bean.Counter" scope="application" />
-
-
<html>
-
<head><title>Student Registration Front</title></head>
-
<body bgcolor="#ffffcc">
-
<h2 align="center"><font color="#800000">Student Registration Webapp 2007</font></h2>
-
-
<h3 align="center"><font color="red"><i>
-
<% String e = (String) session.getAttribute( "error" );
-
out.print( e ); %>
-
</i></font></h3>
-
-
-
-
<form action="registerStudent.jsp" method="post">
-
<table align="center">
-
<tr><th>Enter Surname: </th>
-
<td><input type="text" name="surname" size="20"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter First Names: </th>
-
<td><input type="text" name="firstname" size="20"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter 8 Registration Digits: </th>
-
<td><input type="text" name="reg" size="8"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter Module: </th>
-
<td><select name="module">
-
<option value="3sfe513">3sfe513
-
<option value="3sfe7a6">3sfe7a6
-
</select>
-
</td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter Password for Webapp Login: </th>
-
<td><input type="password" name="password" value="" size="8"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th colspan="2"><input type="submit" value="Submit"></th></tr>
-
</table>
-
</form>
-
-
</body>
-
</html>
-
The register.jsp is used to allow member to enter their details and once they are submitted the data will be stored in mysql db. Now, can somone tell me why when i add the following code i get the following error message. If i dont add the following code, after i submit the first page it goes to my register.jsp. Please help if you cannn, please help..
2 2136
Hi this is my first post but so far this is pretty good site. I have a file called index.html with the following code: -
<!-- index.html -->
-
-
<html>
-
<head><title>Student Registration Front</title></head>
-
<body bgcolor="#ffffcc">
-
-
<h2 align="center"><font color="#800000">Student Registration Webapp 2007</font></h2>
-
-
<p> </p>
-
<p> </p>
-
-
<!-- <form action="http://localhost:8080/eventRegister/front.jsp" method="post"> -->
-
<form action="https://tomcat.cscs.wmin.ac.uk:9191/tomcat/w1009048/front.jsp" method="post">
-
<table align="center">
-
<tr><th>Student Registration: </th>
-
<td><input type="radio" name="choice" value="register" checked> </td>
-
<td> <font color="blue">you must register here first</font></td></tr>
-
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
-
<tr><th>Login for registered students: </th>
-
<td><input type="radio" name="choice" value="login"> </td>
-
<td><font color="red">this is not yet implemented<br />
-
and leads to a blank page</font></td></tr>
-
-
<tr><td> </td><td> </td><td> </td></tr>
-
-
<tr><td> </td>
-
<th><input type="submit" value="Submit"></th>
-
<td> </td></tr>
-
</table>
-
</form>
-
-
</body>
-
</html>
-
When they click on submit it goes to my front.jsp which has the following code(front.jsp is actually FrontController .java changed in web.xml): -
// FrontController.java
-
-
import java.io.* ;
-
import java.util.* ;
-
import javax.servlet.* ;
-
import javax.servlet.http.* ;
-
import beans.*;
-
-
/*
-
The front controller:
-
* creates a new 'session' object,
-
* creates an empty 'error message' String which it stores in 'session', then
-
* redirects the request to either:
-
- 'register' (the real JSP, register.jsp), or
-
- 'login' (not implemented)
-
*/
-
-
public class FrontController extends HttpServlet
-
{
-
public void doPost( HttpServletRequest request, HttpServletResponse response )
-
throws IOException, ServletException
-
{
-
String strChoice = request.getParameter( "choice" );
-
-
if ( strChoice.equals( "register" ) )
-
{
-
HttpSession session = request.getSession();
-
-
String strError = " "; /* now 'store' this String object - this is not a bean
-
but can be stored in 'session' in exactly the same way */
-
session.setAttribute( "error", strError );
-
-
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher( "/register.jsp" );
-
dispatcher.forward( request, response );
-
}
-
else
-
{
-
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher( "/login.jsp" );
-
dispatcher.forward( request, response );
-
}
-
}
-
}
-
After from frontcontroller , it should go into register.jsp but it does not becuase it i get this error message: -
-
HTTP Status 500 -
-
-
--------------------------------------------------------------------------------
-
-
type Exception report
-
-
message
-
-
description The server encountered an internal error () that prevented it from fulfilling this request.
-
-
exception
-
-
org.apache.jasper.JasperException: /register.jsp(4,0) The value for the useBean class attribute bean.Counter is invalid.
-
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:512)
-
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
-
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
-
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
FrontController.doPost(FrontController.java:34)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
-
-
root cause
-
-
org.apache.jasper.JasperException: /register.jsp(4,0) The value for the useBean class attribute bean.Counter is invalid.
-
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
-
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
-
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
-
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1174)
-
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116)
-
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
-
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
-
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
-
org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
-
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
-
org.apache.jasper.compiler.Generator.generate(Generator.java:3320)
-
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:198)
-
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
-
org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
-
org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
-
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
-
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:305)
-
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
-
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
FrontController.doPost(FrontController.java:34)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
-
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
-
The reason why it shows this error message is cos i add this following line of code in my register.jsp: <jsp:useBean id="counterid" class="bean.Cou nter" scope="applicat ion" />
The full code is here: -
<%-- register.jsp --%>
-
-
<%@ page language="java" contentType="text/html; charset-ISO-8859-1" %>
-
<jsp:useBean id="counterid" class="bean.Counter" scope="application" />
-
-
<html>
-
<head><title>Student Registration Front</title></head>
-
<body bgcolor="#ffffcc">
-
<h2 align="center"><font color="#800000">Student Registration Webapp 2007</font></h2>
-
-
<h3 align="center"><font color="red"><i>
-
<% String e = (String) session.getAttribute( "error" );
-
out.print( e ); %>
-
</i></font></h3>
-
-
-
-
<form action="registerStudent.jsp" method="post">
-
<table align="center">
-
<tr><th>Enter Surname: </th>
-
<td><input type="text" name="surname" size="20"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter First Names: </th>
-
<td><input type="text" name="firstname" size="20"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter 8 Registration Digits: </th>
-
<td><input type="text" name="reg" size="8"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter Module: </th>
-
<td><select name="module">
-
<option value="3sfe513">3sfe513
-
<option value="3sfe7a6">3sfe7a6
-
</select>
-
</td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th>Enter Password for Webapp Login: </th>
-
<td><input type="password" name="password" value="" size="8"></td></tr>
-
<tr><td> </td><td> </td><td> </td></tr>
-
<tr><th colspan="2"><input type="submit" value="Submit"></th></tr>
-
</table>
-
</form>
-
-
</body>
-
</html>
-
The register.jsp is used to allow member to enter their details and once they are submitted the data will be stored in mysql db. Now, can somone tell me why when i add the following code i get the following error message. If i dont add the following code, after i submit the first page it goes to my register.jsp. Please help if you cannn, please help..
It is bean.Counter or is it supposed to be beans.Counter or possibly just Counter?
It is bean.Counter or is it supposed to be beans.Counter or possibly just Counter?
Ahhhhh, it is meant to be beans.Counter. I looked at my folder name. I don't know about you but sometimes when programming in general you don't always see your own mistakes, therefore it is always good to ask somebody else as they might have a different view. Thanks for you'r help and sorry if i have caused any inconvience.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jose Munoz |
last post by:
Hi all,
I want to share some data for all my applications (servlets and jsps).
For this i am using a JSP to set the variables with scope=application.
When i get this data from some JSP all is o.k, i can see the data that
i saved, but when i get access with my servlets, i can't see data
saved prev.
My request is simple: save data with a JSP and read this data with
servlets.? please if you send me a small sample to do this. or tell me...
|
by: jenniferyiu |
last post by:
Hi. I downloaded the bean builder
and followed the steps told on
http://java.sun.com/products/javabeans/beanbuilder/1.0/docs/guide/tutorial.html
and the sample tools was created as the above link told.
I guess the bean builder can let the developers do something without
writing
|
by: Miles Davenport |
last post by:
I have the following code (please see base of email) which displays text
from a properties file ok.
I have changed the properties file so the contents are different, but cannot
get the new details to display. I have tried the following:
-Stop and restart Apache and Tomcat.
-Delete the Tomcat compiled Java and associated class for the JSP, and stop
restart the server.
-Cleared my browsers cache.
|
by: Borek |
last post by:
In my project I have to access in one business method of session bean
usually more then 10 CMP Beans. I would like to have some utils classes,
which could get me right instance of CMP or create one. Instead of making
the same thing again and again. My proposition looks like:
1) Class for taking home interface:
public final class JNDILookup {
private static Context initialContext;
private static HashMap homeInterfaces;
private static...
|
by: Casper B |
last post by:
Since I am only able to pass simple beans around using my Web Service
framework, I wonder how to incorporate business logic around these beans.
My idea was to let my Beans be the base class and simply extend these
with more sophisticated classes with the nessesary business logic
inside. However, when I do a cast from MyObjectBean to MyObject I get a
ClassCastException. Is it not possible to cast in this direction?
public class...
| |
by: seller |
last post by:
coded this method in bean. The intent was for the bean to run
all the setters using the values in a vector argument. here's
the code:
public void loadSelf(Vector v) throws Exception {
String parms = new String;
Class cls = getClass();
java.lang.reflect.Method methods = cls.getMethods();
java.lang.reflect.AccessibleObject.setAccessible(methods, true);
int vectorPointer = 0;
|
by: Alfredo |
last post by:
Hello everybody
I have a problem as a newbie in using beans and I hope someone out there can
help me with this.
I have a jsp-page that use BeanClass. Somewhere in the jsp code there is the
following scriptlet:
<%
Vector vec=BeanClass.getStateVector();
|
by: jaisi |
last post by:
What iam exactly trying to do is..saving the resultset in a bean.....and calling the bean in a servlet and forwarding it to jsp by setting the bean in the request scope;
Now i have only one record in the db;
But still iam getting the servlet as wellas jsp with
no 0
name null;
Here is the code:
import java.io.Serializable;
|
by: hostel |
last post by:
HTML PAGE
<html>
<body>
<form action="second.jsp" method="get">
YOur name <input type=text name="name">
<input type=submit >
</form>
</body>
</html>
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |