You can view and download the complete source code of this tutorial from my github account.
In this tutorial, we will create a simple CRUD (Create Read Update Delete) User Management Web Application using Jsp, Servlet and MySQL.
For this tutorial, we will need the following tools: (The older or newer version should also works). Moreover, basic Java knowledge is assumed.
1. Eclipse IDE for Java EE Developers (Indigo – ver. 3.7)
3. MySQL Community Server and MySQL Workbench (GUI Tool)
5. jstl.jar and standard.jar. You can get these jars from your Tomcat. Check in this directory : (your tomcat directory)—>apache-tomcat-7.0.26-windows-x86—>apache-tomcat-7.0.26—>webapps—>examples—>WEB-INF—>lib
I will tell you where you should put these jars later.
6. jQuery for javascript capability. In this case, we only use it for the datepicker component
First, lets create the database and table for User using the following SQL scripts:
create database UserDB; use UserDB; grant all on UserDB.* to 'admin'@'localhost' identified by 'test'; CREATE TABLE UserDB.`users` ( `userid` int(11) NOT NULL AUTO_INCREMENT, `firstname` varchar(45) DEFAULT NULL, `lastname` varchar(45) DEFAULT NULL, `dob` date DEFAULT NULL, `email` varchar(100) DEFAULT NULL, PRIMARY KEY (`userid`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8
Go to eclipse. Before we create a new project for our application, we need to setup the server. Select File—>New—>Other. From the tree, Select Server.
Choose Apache—>Tomcat v7.0 Server and set the runtime environment.
Next, create a new project. Select File—>New—>Dynamic Web Project.
Enter “SimpleJspServletDB” as the project name. Select target runtime to Apache Tomcat v7.0 which we already setup before. Click Finish.
Please refer to this project directory in case you miss something along the way
Copy the standard.jar, mysql-connector jar and jstl jar to WEB-INF—>lib folder.
Create four packages in the src folder.
- com.daniel.controller: contains the servlets
- com.daniel.dao: contains the logic for database operation
- com.daniel.model: contains the POJO (Plain Old Java Object). Each class in this package represents the database table. For this tutorial, however, we only have one table.
- com.daniel.util : contains the class for initiating database connection
Next, create a new Java class. in com.daniel.model folder. Name it “User.java” and insert these following codes. Each of the variables in this class represents the field in USERS table in our database.
package com.daniel.model; import java.util.Date; public class User { private int userid; private String firstName; private String lastName; private Date dob; private String email; public int getUserid() { return userid; } public void setUserid(int userid) { this.userid = userid; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Date getDob() { return dob; } public void setDob(Date dob) { this.dob = dob; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return "User [userid=" + userid + ", firstName=" + firstName + ", lastName=" + lastName + ", dob=" + dob + ", email=" + email + "]"; } }
Create a new class in com.daniel.util package and name it DbUtil.java. This class handles the database connection to our MySQL server. In this class, we read a .properties file which contains the information necessary for the connection.
package com.daniel.util; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; public class DbUtil { private static Connection connection = null; public static Connection getConnection() { if (connection != null) return connection; else { try { Properties prop = new Properties(); InputStream inputStream = DbUtil.class.getClassLoader().getResourceAsStream("/db.properties"); prop.load(inputStream); String driver = prop.getProperty("driver"); String url = prop.getProperty("url"); String user = prop.getProperty("user"); String password = prop.getProperty("password"); Class.forName(driver); connection = DriverManager.getConnection(url, user, password); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return connection; } } }
Create the properties file directly under the src folder. Create a new file, name it db.properties. Put the following information inside.
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/UserDB
user=admin
password=test
Next, create a new class in com.daniel.dao package, name it UserDao.java. Dao stands for Data Access Object. It contains the logic for database operation.
package com.daniel.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import com.daniel.model.User; import com.daniel.util.DbUtil; public class UserDao { private Connection connection; public UserDao() { connection = DbUtil.getConnection(); } public void addUser(User user) { try { PreparedStatement preparedStatement = connection .prepareStatement("insert into users(firstname,lastname,dob,email) values (?, ?, ?, ? )"); // Parameters start with 1 preparedStatement.setString(1, user.getFirstName()); preparedStatement.setString(2, user.getLastName()); preparedStatement.setDate(3, new java.sql.Date(user.getDob().getTime())); preparedStatement.setString(4, user.getEmail()); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } public void deleteUser(int userId) { try { PreparedStatement preparedStatement = connection .prepareStatement("delete from users where userid=?"); // Parameters start with 1 preparedStatement.setInt(1, userId); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } public void updateUser(User user) { try { PreparedStatement preparedStatement = connection .prepareStatement("update users set firstname=?, lastname=?, dob=?, email=?" + "where userid=?"); // Parameters start with 1 preparedStatement.setString(1, user.getFirstName()); preparedStatement.setString(2, user.getLastName()); preparedStatement.setDate(3, new java.sql.Date(user.getDob().getTime())); preparedStatement.setString(4, user.getEmail()); preparedStatement.setInt(5, user.getUserid()); preparedStatement.executeUpdate(); } catch (SQLException e) { e.printStackTrace(); } } public List<User> getAllUsers() { List<User> users = new ArrayList<User>(); try { Statement statement = connection.createStatement(); ResultSet rs = statement.executeQuery("select * from users"); while (rs.next()) { User user = new User(); user.setUserid(rs.getInt("userid")); user.setFirstName(rs.getString("firstname")); user.setLastName(rs.getString("lastname")); user.setDob(rs.getDate("dob")); user.setEmail(rs.getString("email")); users.add(user); } } catch (SQLException e) { e.printStackTrace(); } return users; } public User getUserById(int userId) { User user = new User(); try { PreparedStatement preparedStatement = connection. prepareStatement("select * from users where userid=?"); preparedStatement.setInt(1, userId); ResultSet rs = preparedStatement.executeQuery(); if (rs.next()) { user.setUserid(rs.getInt("userid")); user.setFirstName(rs.getString("firstname")); user.setLastName(rs.getString("lastname")); user.setDob(rs.getDate("dob")); user.setEmail(rs.getString("email")); } } catch (SQLException e) { e.printStackTrace(); } return user; } }
Finally, create a new Servlet inside the com.daniel.controller package and name it UserController.java
package com.daniel.controller; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.daniel.dao.UserDao; import com.daniel.model.User; public class UserController extends HttpServlet { private static final long serialVersionUID = 1L; private static String INSERT_OR_EDIT = "/user.jsp"; private static String LIST_USER = "/listUser.jsp"; private UserDao dao; public UserController() { super(); dao = new UserDao(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String forward=""; String action = request.getParameter("action"); if (action.equalsIgnoreCase("delete")){ int userId = Integer.parseInt(request.getParameter("userId")); dao.deleteUser(userId); forward = LIST_USER; request.setAttribute("users", dao.getAllUsers()); } else if (action.equalsIgnoreCase("edit")){ forward = INSERT_OR_EDIT; int userId = Integer.parseInt(request.getParameter("userId")); User user = dao.getUserById(userId); request.setAttribute("user", user); } else if (action.equalsIgnoreCase("listUser")){ forward = LIST_USER; request.setAttribute("users", dao.getAllUsers()); } else { forward = INSERT_OR_EDIT; } RequestDispatcher view = request.getRequestDispatcher(forward); view.forward(request, response); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { User user = new User(); user.setFirstName(request.getParameter("firstName")); user.setLastName(request.getParameter("lastName")); try { Date dob = new SimpleDateFormat("MM/dd/yyyy").parse(request.getParameter("dob")); user.setDob(dob); } catch (ParseException e) { e.printStackTrace(); } user.setEmail(request.getParameter("email")); String userid = request.getParameter("userid"); if(userid == null || userid.isEmpty()) { dao.addUser(user); } else { user.setUserid(Integer.parseInt(userid)); dao.updateUser(user); } RequestDispatcher view = request.getRequestDispatcher(LIST_USER); request.setAttribute("users", dao.getAllUsers()); view.forward(request, response); } }
Now, it’s time for us to create the jsp, the view for our application. Under the WebContent folder, create a jsp file, name it index.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <title>Insert title here</title> </head> <body> <jsp:forward page="/UserController?action=listUser" /> </body> </html>
This jsp serves as the entry point for our application. In this case, it will redirect the request to our servlet to list all the users in the database.
Next, create the jsp to list all the users in the WebContent folder. Name it listUser.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <title>Show All Users</title> </head> <body> <table border=1> <thead> <tr> <th>User Id</th> <th>First Name</th> <th>Last Name</th> <th>DOB</th> <th>Email</th> <th colspan=2>Action</th> </tr> </thead> <tbody> <c:forEach items="${users}" var="user"> <tr> <td><c:out value="${user.userid}" /></td> <td><c:out value="${user.firstName}" /></td> <td><c:out value="${user.lastName}" /></td> <td><fmt:formatDate pattern="yyyy-MMM-dd" value="${user.dob}" /></td> <td><c:out value="${user.email}" /></td> <td><a href="UserController?action=edit&userId=<c:out value="${user.userid}"/>">Update</a></td> <td><a href="UserController?action=delete&userId=<c:out value="${user.userid}"/>">Delete</a></td> </tr> </c:forEach> </tbody> </table> <p><a href="UserController?action=insert">Add User</a></p> </body> </html>
In this jsp, we use JSTL to connect between the jsp and the servlet. We should refrain from using scriplet inside the jsp because it will make the jsp more difficult to maintain. Not to mention it will make the jsp looks ugly.
Next, create a new jsp in WebContent folder and name it user.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=EUC-KR"> <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.18.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.18.custom.min.js"></script> <title>Add new user</title> </head> <body> <script> $(function() { $('input[name=dob]').datepicker(); }); </script> <form method="POST" action='UserController' name="frmAddUser"> User ID : <input type="text" readonly="readonly" name="userid" value="<c:out value="${user.userid}" />" /> <br /> First Name : <input type="text" name="firstName" value="<c:out value="${user.firstName}" />" /> <br /> Last Name : <input type="text" name="lastName" value="<c:out value="${user.lastName}" />" /> <br /> DOB : <input type="text" name="dob" value="<fmt:formatDate pattern="MM/dd/yyyy" value="${user.dob}" />" /> <br /> Email : <input type="text" name="email" value="<c:out value="${user.email}" />" /> <br /> <input type="submit" value="Submit" /> </form> </body> </html>
Lastly, check the web.xml file located in WebContent—>WEB-INF folder in your project structure. Make sure it looks like this
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>SimpleJspServletDB</display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <description></description> <display-name>UserController</display-name> <servlet-name>UserController</servlet-name> <servlet-class>com.daniel.controller.UserController</servlet-class> </servlet> <servlet-mapping> <servlet-name>UserController</servlet-name> <url-pattern>/UserController</url-pattern> </servlet-mapping> </web-app>
That is it. Right click the project name and run it using Run As–>Run on server option.
Hi I am trying to run your example and I am getting The requested resource (/SimpleJspServletDB/listUser.jsp) is not available. I have the listUser.jsp in the WebContent folder so I am not sure why its not seeing it.
Its all good got it working! Thanks for the very clear example! Finally I found one on the web. Thank you!
What was the issue im having the same problem you had
What did you do men I also encounter an error ?
HTTP Status 404 – /SimpleJspServletDB/
——————————————————————————–
type Status report
message /SimpleJspServletDB/
description The requested resource is not available.
——————————————————————————–
Apache Tomcat/7.0.35
may I ask source code?
Thank’s …
It was simple and the best crud for servlet +jsp+jquery+mysql I ever found
wesome Example
Thanks, Really a very helpful tutorial.
How do you do this part?
First, lets create the database and table for User using the following SQL scripts:
create database UserDB;
use UserDB;
grant all on UserDB.* to ‘admin’@'localhost’ identified by ‘test’;
CREATE TABLE UserDB.`users` (
`userid` int(11) NOT NULL AUTO_INCREMENT,
`firstname` varchar(45) DEFAULT NULL,
`lastname` varchar(45) DEFAULT NULL,
`dob` date DEFAULT NULL,
`email` varchar(100) DEFAULT NULL,
PRIMARY KEY (`userid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8
never used a script before, the rest the tutorial is super simple but I got lost right here
just copy and paste the script to any sql editor and run it
as my post said, i use MySQL Workbench GUI.
sorry for the late reply, i hope by now you already figure it out
you rock! thx for saving me a lot of time
Excellent, your tutorial was clear and very good
Thank a lot for sharing
Pingback: JSPs and Servlets Tutorials | Saikat's space
nice and clear example thx
hey, I try to implement your code..
I try to save some datas,
after I debug it, I realize that the code through catch(SqlException e){}
my datas unable to save to database..
What does the SqlException means ?
How can I fix this?
I`m following the entire post, but…
http://localhost:8080/SimpleJspServletDB/
HTTP Status 404 –
…
How can I fix this?
Same here
i have same Error :
HTTP Status 404 – /SimpleJspServletDB/UserController>action=listuser
——————————————————————————–
type Status report
message /SimpleJspServletDB/UserController>action=listuser
description The requested resource (/SimpleJspServletDB/UserController>action=listuser) is not available.
——————————————————————————–
so please give me a solution of that Error :
Thanks dude………………………………
nice tutorial and u explain it very clearly.
all files are loosely coupled also.
thanks again
very clear cut tutorial, thanks a lot
v.laksmi
Hello, thanks for your tutorials.
But i want to ask, how do you manage an application in folders? I confused manage url in Servlet, because my application’s view i put in folders spearately.
Thank you
Fantastic tutorial! Well explained! Thank you very much!
nice..
tnks a lot
Thank you! This really helped me get my head around Java servlets and Tomcat implementation. Was able to get a sample up and running that provides a good basis going forward.
package com.daniel.controller;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.RequestDispatcher ;//errors m getting
import javax.servlet.ServletException; ;//errors m getting
import javax.servlet.http.HttpServlet; ;//errors m getting
import javax.servlet.http.HttpServletRequest; ;//errors m getting
import javax.servlet.http.HttpServletResponse; ;//errors m getting
import com.daniel.dao.UserDao;
import com.daniel.model.User;
public class UserController extends HttpServlet {
private static final long serialVersionUID = 1L;
private static String INSERT_OR_EDIT = “/user.jsp”;
private static String LIST_USER = “/listUser.jsp”;
private UserDao dao;
public UserController() {
super();
dao = new UserDao();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
If i have to add search functionality by user id then how togo for it
I have used the same code that has been used for delete.
and i have forward that to search.jsp and in this the code is same ajust as list users.jsp
and also how to make the build file
plz suggest
Hi when i execute this code i am got an error as
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: An exception occurred processing JSP page /index.jsp at line 10
7: Insert title here
8:
9:
10:
11:
12:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:457)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.NullPointerException
com.daniel.dao.UserDao.getAllUsers(UserDao.java:69)
com.daniel.controller.UserController.doGet(UserController.java:63)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:745)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:716)
org.apache.jsp.index_jsp._jspService(index_jsp.java:63)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.12 logs.
——————————————————————————–
Please tell me the solutions
Thanks in Advance
See my comment below about the private members of User class. Not sure if thats the prob, you didnt provide the full stack trace.
Thank you so much……U made my day
cheers
Reblogged this on Ben Chapman and commented:
Here’s an excellent tutorial on how to create a basic database-powered JSP-driven application.
i have one form i should get insert data and update data on same form using two button on same page add new….update
Hi! if i have two or more “model” classes.. how many servlets are neccessary? one for each class? Like UserController, Class2Controller… ClassNController OR One BIIIG controller to handle all the classes.. Thank you for the tutorial, it is excellent!! sorry for my english!
if the operations are complex, best to use one servlet for each model, but if it is simple and the model always interact together, you can use one big controller. whichever suits your taste. after all you are the one who will develop it.
how to use the same logic in struts framework ??
Hi,
I’ve been able to run your great example, but I’ve troubles setting the correct date format in the JSP user.jsp:
the pattern defined is ignored and the listUser show the DOB as yyyy-MM-dd. I really cannot understand what’s wrong.
Thanks
how to run using eclipse?
This is an excellent tutorial, however you must have made some changes to the User class, and did not update the other classes. The data members of User are all ‘private’, and in listUser and user.jsp, you try to reference these directly:
”
”
This fails and throws a null pointer exception. (HTTP Error 500 returned).
These need to say:
”
“
Dang, the code got stripped. If you look in listUser.jsp, when you have value = user.userid, that will fail. It needs to use the get method of the User class: value = user.getUserid().
Nevermind! (I’m sure most can tell that I’m still learning this stuff!)
The errors were due to my dynamic web project using Servlet 3.0, whereas your project (since it includes web.xml) is using 2.5.
There are probably other minor configs that differ (how you use the JSTL) that can cause the HTTP 500 error.
Fun stuff!
Great tutorial!!!! It is the first one that helped through clean and easy to read code. Thanx!!!
Some search would be perfect
Good tutorial..but i find one bug in listuser when i refresh the page list row is go on adding with the previous result.Please tell me how to fix it.
Thanks,
This package will work on your local machine as you start/stop your server, but it will not work when deployed to a server which stays up, and database queries are not performed within 8 hours (or whatever your MySQL timeout is set to). The Connection object you instantiated will be closed, but will not be null, and the queries will fail.
Need to check:
connection.isClosed() and connection.isValid() before you attempt to perform queries; if those fail, you need to create a new connection.
Or, use a DataSource Object (with PooledConnections) instead of DriverManager to create your Connection.
Hi, very nice tuto.Ii have a trouble someone can show how or where to download the jstl.jar and the standar.jar. Since i looked on web but i can’t find them. Thx
All files are availabe at github, as also mentioned by the writer in this very first line of this tutorial. Writer has also provided the link.
“You can view and download the complete source code of this tutorial from my github account.”
All the source files are available at github as mentioned by writer at the very first line of this tutorial. Writer has also provided the link in the second line.
Pls let me know if you have any issue.
Hi,
After adding all the files to respected directories i ma getting error in jsp pages listUser.jsp and user.jsp where the following to lines are not ecognsed.
i have added the jstljar and standard.jas files to WebContent->WEB-INF->lib directory
please help me.
Thanks
NehaLBK
Did you add all three jar files from writer’s github account to webcontent->WEB_INF->lib ?
Hi,
The example is working fine. Grate tutorial. But i need a example to upload any file(.doc,.pdf,.jpg etc) to oracle database Clob data type, and display it back in the same format when needed. I tried many examples but they upload only images or .txt files and display is in binay format. Please can you help me?
Thanks in advance.
The uri’s are as follows which are not recognzed
taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”
taglib uri=”http://java.sun.com/jsp/jstl/fmt” prefix=”fmt”
hi,
you need just to add the library : jstl 1.2.jar
i have process as per given code furthere if give problem to me.
I cant show user List on jsp page.
Not give any Error and bugs. it also pass listarray and show in consol but i can show in table and i can not insert a new data. please give me a solution.
i got this error :
org.apache.jasper.JasperException: An exception occurred processing JSP page /listUser.jsp at line 33
30:
31:
32:
33:
34:
35:
36:
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:457)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
com.d.controller.UserController.doPost(UserController.java:121)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
may I ask source code?
Hi,
I am using the same code. I got this exception in server startup time…
javax.servlet.ServletException: Wrapper cannot find servlet class com.daniel.controller.UserController or a class it depends on
org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:706)
org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:677)
org.apache.jsp.index_jsp._jspService(index_jsp.java:68)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Can any one help me..
Cheers,
Suresh
Mas bro, kodingan ente ga bisa di input, terus ada yang salah parameter tuh…
seharusnya “string”.equalsIgnoreCase(action)
yang di controller…
entah kenapa
thanks man)
Hello KJohn,
Awesome tutotrial, Thanks for your efforts. I am getting this error… “javax.el.PropertyNotFoundException: The class ‘com.daniel.model.User’ does not have the property ‘getUserid’. I have tried everything . My program loads in my weblogic server but when I insert a new user and try to submit..thats where I am getting this error. I would appreciate if you can please help me .
I already added the get Userid in ListUser as you have mentioned earlier…that is not helping either.
I would appreciate hearing back from you.
thanks.