java - How to call a servlet from JSP page? -


possible duplicate:
calling servlet jsp file

i have used following code call conn.java (servlet) index.jsp. works.

<%@page import= "java.util.arraylist"%> <%@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"> <%@ page import= "aa.conn" %> <jsp:usebean id= "conne" class= "conn" scope= "session"/> <jsp:setproperty name= "conne" property= "*"/> <html>     <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8">         <title>jsp</title>      </head>     <body>        <link rel="stylesheet" href="rowcolor.css" type="text/css">       <%        conne.con(request, response);      arraylist newlist=null;     newlist=(arraylist)request.getattribute("data1");     int noofrows=(integer)newlist.get(0);     int q = noofrows / 5;     if(noofrows%5!=0)         q+=1;     out.println("pages --->>>");          (int t = 1; t <= q; t++) {             out.println("<a href=index.jsp?id=" + t + " name=" + t + "id=" + t + ">");             out.println("  " + t);             out.println("</a>");         }      conne.disp(request, response);      conne.dispgraphtab(request, response);       %>         </body> </html> 

but, following code doesn't work. want call newservlet graphcon.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"> <%@ page import= "aa.newservlet" %> <jsp:usebean id= "co" class= "newservlet" scope= "session"/> <jsp:setproperty name= "co" property= "*"/> <html>     <head>         <meta http-equiv="content-type" content="text/html; charset=utf-8">         <title>jsp page</title>     </head>     <body>      </body> </html> 

what problem code? error is:

exception javax.servlet.servletexception: java.lang.instantiationexception: newservlet root cause  java.lang.instantiationexception: newservlet 

make question clear. first describe want , describe steps have followed accomplish things want , problems occurring steps. guess want want redirect request 1 servlet. use sendredirect function.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -