Nilesh Sanyal

Ranch Hand
+ Follow
since Jan 29, 2015
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Nilesh Sanyal

I want to integrate Struts 1.3 with Spring 3.2 and Hibernate 4.0 in a Simple user login application. I want

to use MySQL as the database. I am using Eclipse Mars as the IDE for the development.
I already integrated Struts with Spring, it is working well, but I was unable to integrate Hibernate in the

project, please help.
Table user will be used for the database named users is as follows...

Field              Type            Null    Key   Default
---------------------------------------------------------
username   varchar(30)    yes      no   null
password    varchar(40)    yes      no    null
userid         varchar(4)      no       PRI null

Data stored in that table is as follows...

username     password   userid
------------------------------------
admin           admin123     1


Project structure of the application
------------------------------------------


LoginAction.java
-------------------


BusinessDelegate.java
--------------------------


LoginForm.java
------------------


ApplicationContext.xml
----------------------------


struts-config.xml
-------------------


web.xml
-----------


index.jsp
----------
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login page | Hello World Struts application in Eclipse</title>
</head>
<body>
<h1>Login</h1>
<html:form action="login">

<bean:message key="label.username"/>
<html:text property="userName"></html:text>
<html:errors property="userName" />
<br/>
<bean:message key="label.password"/>
<html:password property="password"></html:password>
<html:errors property="password"/><br/>
<html:submit/>
<html:reset/>

</html:form>
</body>
</html>


welcome.jsp
--------------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
   pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
<title>Welcome page | Hello World Struts application in Eclipse</title>
</head>
<body>
<%
String message = (String)request.getAttribute("message");
%>
<h1>Welcome <%= message %></h1>

</body>
</html>

MessageResource.properties
----------------------------------
error.username=Username is not entered
error.password=Password is not entered
label.username=Login Detail
label.password=Password
label.welcome=Welcome
8 years ago
I tried to find ways to integrate Spring, Hibernate and JSF in a web application particularly in NetBeans IDE. But, I failed to do so. Please help me.
8 years ago
I was trying to create a simple Spring MVC application in netbeans IDE. However I got 404 error while I clicked the click hyperlink, please help me. The codes are as follows...

index.jsp
-----------
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!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=UTF-8">
<title>Spring Web MVC Sample</title>
</head>

<body>
<a href="hello.html">click</a>
</body>
</html>

hellopage.jsp
---------------------
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Message is : ${message}</h1>
</body>
</html>

redirect.jsp
------------------
<%@page contentType="text/html" pageEncoding="UTF-8"%>


HelloWorldController.java
-------------------------------


dispatcher-servlet.xml
------------------------------------


web.xml
---------------
8 years ago
Please tell me which websites offer free J2EE hosting services?
8 years ago
I am trying to create an application that will display list of books written by an author. For this I am using oracle 10g express edition database and Hibernate Framework.

The stacktrace displayed by browser is as follows...

type Exception report

message An exception occurred processing JSP page /DisplayBooks.jsp at line 22

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 /DisplayBooks.jsp at line 22

19: <%
20: String aname=request.getParameter("author");
21: mypack.SearchHelper sh=new SearchHelper();
22: List booksCollection=sh.getBooks(aname);
23: for(Iterator itr=booksCollection.iterator();itr.hasNext();)
24: {
25: Books b=(Books)itr.next();


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568)

root cause

java.lang.IllegalStateException: No data type for node: org.hibernate.hql.internal.ast.tree.IdentNode
\-[IDENT] IdentNode: 'bookname' {originalText=bookname}

PROJECT DETAILS
========================

I have created 2 tables which are as follows...

AUTHORS table
===============
Name Null? Type
----------------------------------------- -------- --------------------

AUTHORID NOT NULL VARCHAR2(4)
AUTHORNAME VARCHAR2(30)


BOOKS table
===============
Name Null? Type
----------------------------------------- -------- ------------

BOOKID NOT NULL VARCHAR2(4)
BOOKNAME VARCHAR2(30)
AUTHORID VARCHAR2(4)

Data for AUTHORS table
========================
AUTH AUTHORNAME
---- -----------
A1 Arvind
A2 Bikas


Data for BOOKS table
======================

BOOK BOOKNAME AUTHORID
---- ------------------------------ -------------------
B1 C Programming A2
B2 C++ Programming A2
B3 C# Programming A2
B5 J2ME Programming A1

SearchBooks.jsp
===============


DisplayBooks.jsp
===============


hibernate.cfg.xml


hibernate.reveng.xml


Authors.java
========


Books.java
=======


Authors.hbm.xml
============


Books.hbm.xml
===========


NewHibernateUtil.java
==============


SearchHelper.java
============
I want to check whether an email address is correct or not. I have written following expression:


But, when I give two @ symbols, it is not showing that an invalid email address has been entered, please help.
9 years ago
I am trying to create a web application using JSP and Servlets only. In the web application users can register and then they can login. For this application I am using Oracle 10g express edition database.

The main problem with this application is that when the user fills up the form and clicks the Register me button, a blank screen is displayed. However, the data is inserted into the table.

Structure of users table
======================
Name Null? Type
--------------------------------- -------- ---------------

USERNAME VARCHAR2(5)
EMAIL VARCHAR2(30)
PASSWORD VARCHAR2(20)

home.jsp
---------
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Home Page</title>
</head>
<body>
<h2>Welcome to the Home Page</h2>
<%
request.getAttribute("user");
%>


You can choose any one option<br>
<a href="register.jsp">Create an account</a><br>
<a href="login.jsp">Login to your account</a>
</body>
</html>

register.jsp
------------
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Registration Page</title>
<script type="text/javascript">

</script>
</head>
<body>
<form action="RegisterServlet" method="POST">

Name<input type="text" name="username" id="uname" required /><br>
Email address<input type="email" name="email" id="emailAddr" required /><br>
Password<input type="password" name="password" id="p1" required /><br>
Re-enter password<input type="password" name="repassword" id="p2" required /><br>
<input type="submit" value="Register me" onClick="return checkFields()"/>

<a href="home.jsp">Go Back to Home</a>
</form>
</body>
</html>

RegisterServlet.java
----------------------


RegisterModel.java
---------------------


login.jsp
---------
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login Page</title>
</head>
<body>
<form action="LoginServlet" method="post">
User name<input type="text" name="user" required/><br>
Password<input type="password" name="pass" required/><br>
<input type="submit" value="Login"/>
</form>
</body>
</html>

LoginServlet.java
-------------------


LoginModel.java
-----------------


logged.jsp
-----------
<%@page contentType="text/html" pageEncoding="UTF-8" import="com.model.LoginModel"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Logged in Page</title>
<script>
function preventBack(){window.history.forward();}
setTimeout("preventBack()", 0);
window.onunload=function(){null};
</script>
</head>
<body>
<!-- Logout <A> LINK -->
<a href="LogOutServlet">Logout</a>

<% LoginModel logModel=(LoginModel)session.getAttribute("user"); %>
User ${logModel.username}   logged in

<%-- Disabling this page caching in browser --%>
<%
response.setHeader("Cache-Control", "no-store");
response.setHeader("Pragma", "no-cache");
response.setHeader("Expires", "0");
%>
</body>
</html>

9 years ago
Sir, the J2EE project on Hospital Management System will be submitted for my collage for completing major project of MCA(Master of Computer Application). So from that perspective which framework should I choose between JSF / Struts?
9 years ago
JSP
Sorry, sir. But I am trying to implement a J2EE project on Hospital Management System, so what framework should I use JSF/ Struts? I have only two choices, because I have learned only those two frameworks although they are archaic according to your opinion.
9 years ago
JSP
I was trying to create a Hibernate application which will display all records of Orders table. I am

applying concept of Value Type and Entity Type object while mapping to 2 persistent classes named as

OrderDetails and ContactDetails. I am using Oracle 10g Express Edition database in this project.

Table created
---------------
create table orders(order_id number primary key,weekday_recipient varchar2(40),weekday_phone

varchar2(20),holiday_recipient varchar2(40),holiday_phone varchar2(20));

ORDER_ID WEEKDAY_RECIPIENT WEEKDAY_PHONE HOLIDAY_RECIPIENT HOLIDAY_PHONE
---------- ---------------------------------------- -------------------------------------------------------------------------------------
700 New York 56046023 Los Angeles 56036764

OrderDetails.java
--------------------


ContactDetails.java
-----------------------


hibernate.cfg.xml
--------------------


OrderDetails.hbm.xml
-------------------------


index.jsp
-----------


After running the application it is showing only the following output...

700 com.model.ContactDetails@895829 com.model.ContactDetails@1931438

Why it is showing that kind of output? please help.
To complete my project on j2ee which framework should I use struts or jsf. Which will be a better choice among them?
9 years ago
JSP
Sir, mca stands for Master Of Computer Application
9 years ago
JSP
If I want to work with AJAX in a J2EE application for my MCA major project then which framework/frameworks should I use GWT/Jquery/YUI Library?
9 years ago
JSP