wood burning stoves 2.0*
The moose likes Servlets and the fly likes basic jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "basic jsp" Watch "basic jsp" New topic
Author

basic jsp

sachin cknd
Greenhorn

Joined: Feb 10, 2001
Posts: 12
dear everybody,
i am new to jsp and facing very prilimary problem.
i have a html page as
********* HTML **********
<html>
<body>
<form action="demo.jsp" method=post>
Name <input type=text name=fname>
<input type=submit>
</form>
</body></html>
*****************

and my jsp page is
********** JSP **********
<html>
welcome<br><br><br>
<%
String name=request.getParameter("fname");
out.println("Name :"+name);
%>
Name : <%=name %>
</html>
*****************

i am getting html patr of the jsp file
but not getting dynamic part that is generated in the script.

*********** OUTPUT *****
welcome
*******

not getting Name : XYZ
can any body tell me the corrections in the code or why the output is not displayed?
thanks in advance
akshay mahajan
Greenhorn

Joined: Jan 18, 2001
Posts: 10
i tried running the same it is working very much fine. Just see whether u are running a proper sewserver
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

It looks to me like your JSP is missing a couple lines of code
String name=request.getParameter("fname");
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("Name :"+name);
------------------
Dont blindly believe everything I say.


SCJP
Visit my download page
Ajan Balakrishnan
Ranch Hand

Joined: Jan 04, 2001
Posts: 71
Randall do we really need to get the "out" object explicitly in a jsp . I thought it is an implicit object. Correct me if i'm wrong
Thanks
Ajan
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4340
    
    2

You could well be correct. I dont know JSP very well.
sachin cknd
Greenhorn

Joined: Feb 10, 2001
Posts: 12
Originally posted by akshay mahajan:
i tried running the same it is working very much fine. Just see whether u are running a proper sewserver

akshay mahajan
i am using TOMCAT Version 3.2.1 as a webserver.
jdk1.2.2
can you please tell me which one you have used.
i will try with that one.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: basic jsp
 
Similar Threads
Poblem with doPost() and doGet() method?
program for displaying request details
Is onSubmit() mandatory to write when SimpleFormController is used?
JSP session
How to get back in old window from a new window