Posts

Showing posts with the label jsp

i want to load data from mysql to jsp but I have an unprocessable error

i want to load data from mysql to jsp but I have an unprocessable error enter code here this is java code to load data from database to jsp package dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import model.Category; import utils.DBConnect; public class CategoryDAO { public ArrayList<Category> getListCategory() throws SQLException { Connection connect = DBConnect.getConnection(); ArrayList<Category> listCategory = new ArrayList<>(); String sql = "SELECT * FROM category"; PreparedStatement ps = connect.prepareCall(sql); ResultSet rs = ps.executeQuery(); while (rs.next()) { Category category = new Category(); category.setCategoryID(rs.getInt("CategoryID")); category.setCategoryName(rs.getString("CategoryName")); listCategory.add(category...

How to display @Lob image from mysql database using spring mvc and jsp

How to display @Lob image from mysql database using spring mvc and jsp There is link to github: https://github.com/Lukszn/ProjectProfile I'm using Spring 4.3.7.RELEASE, MySQL Connector Java: 5.1.39 and hibrnate: 5.2.9. Finaly There i have User and his Account model. In account i have @Lob accPicture and some Strings(+ get/set). I'm trying a lot of answers from stackoverflow and documentation to show Account image, but without success. Last think what I do : created own ImageController. I successfully stored image in database but when I'm trying to display it in my jsp, it is showing "HTTP Status 400 - The request sent by the client was syntactically incorrect." Firstly I show you my User model: @Entity @Table(name = "users") public class User implements Serializable{ /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id; @Column(unique = true) ...