thippe swamy

Greenhorn
+ Follow
since Feb 04, 2012
thippe likes ...
Eclipse IDE Tomcat Server Chrome
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by thippe swamy

try instantiating the SHA1 in a servlet and set the object in some scope. Get this object in the jsp and use it.
12 years ago
JSP
did you try session.invalidate();
12 years ago
Thank you both Matthew Brown and Paul Clapham for your help. bc is an actually HashMap and I was trying to use it before creating it, I was getting Null pointer exception.
12 years ago
I have set the bc in only one servlet and it is a HashMap type, and I am trying access in other servlet, same thing is happening with the ArrayList. I did supress warnings and tried to display hm both are giving me null.
12 years ago
try creating the session object in aseparate line and use that object.
bookCollection is an HashMap. session.setAttribute actually returns a generic Object right? I have used bc in the jsp it works fine.
12 years ago
you use request.getParameter to access the information provided by the user in the html page.
try .getDate method.
12 years ago
i have set hashmap object using

session.setAttribute("bc",booksCollection); in one servlet.
i am trying to access the bc in another servlet by using HashMap<String,String> hm = (HashMap<String,String>) session.getAttribute("bc");
i get the type casting error saying: can't typecast from cbject to HashMap.
how do i get rid of this.
12 years ago
sorry ranchers, if i have troubled any of you. I have hound my mistake.
12 years ago
i get following error message:
HTTP Status 405 - HTTP method GET is not supported by this URL

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).
Apache Tomcat/7.0.22
the servlet code is as follows.


package servlets;

import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* Servlet implementation class SearchServlet
*/
public class SearchServlet extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public SearchServlet() {
super();
// TODO Auto-generated constructor stub
}

/**
* @param session
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response, ServletRequest session) throws ServletException, IOException {
// TODO Auto-generated method stub
processRequest(request,response);
}

private void processRequest(HttpServletRequest request,
HttpServletResponse response) {
// TODO Auto-generated method stub

System.out.println("Sairam");

}

/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
processRequest(request,response);
}

}

my calling page is following:


<!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>Home page</title>
</head>
<body>

<h1><p align="center"><font size="20" color="#ff0000" face="Garamond">SAI OnLine Books and Softwares Store</font></p></h1>
<form action="/OnlineBookStore_proj/Search" method="get">
<p align="right"><input type="submit" value="search">
<input type="text" name="search"></p>
</form>
<img src="web-app/images/books.jpg" align="left" width="150" height="150" >
<img src="web-app/images/softwares.jpg" align="right" width="150" height="150">
<form action="reg_page.html" method="get">
<p align="center"><input type="submit" value="register" ></p>
</form>
<hr width="80%" color="#ff3000" size="3"></hr>
<div>
<!-- displaying text at left and right in the same line -->
<p style="float:left;color:blue"><font size="25">Books</font></p>
<p style="float:right;color:blue"><font size="25">Softwares</font></p>
</div>

</body>
</html>
help me out,
Thank u.
12 years ago