-
JSP Help Required?
hi All
I have develpoed a small application in java. which contains on one servler and one jsp page.
...................
Here is the servlet code:
............................
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class Controller extends HttpServlet {
private static final String CONTENT_TYPE = "text/html";
//Initialize global variables
public void init() throws ServletException {
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
// PrintWriter out = response.getWriter();
String teststring = "Good";
request.setAttribute("Noman", teststring);
RequestDispatcher reqdispatcher = this.getServletConfig().getServletContext().getRequestDispatcher("model1.jsp");
reqdispatcher.forward(request,response);
}
//Clean up resources
public void destroy() {
}
}
.................................................
and here is the jsp page code:
................................................
<html>
<head>
<title>
model1
</title>
</head>
<body bgcolor="#ffffff">
<!--<form method="GET" action="Controller">
JBuilder Generated JSP
</form><-->
<% String a = (String)request.getAttribute("Noman"); %>
<%= a %>
</body>
</html>
I want to pass a string (teststring) value from servlet to jsp page.
but when i run the jsp page. it displays null value in string.
Where is the error.
i tried it a lot but can not find error in code.
plz help me.
Response will be highly appriciated
Thanks
Nomi
Similar Threads
-
Replies: 1
Last Post: 12-29-2005, 04:14 AM
-
By Adam Dawes in forum VB Classic
Replies: 1
Last Post: 09-07-2001, 03:03 PM
-
By Adam Dawes in forum VB Classic
Replies: 1
Last Post: 09-07-2001, 03:03 PM
-
Replies: 2
Last Post: 04-07-2000, 01:20 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|