Hello people,
I have configured TOMCAT6.0. I followed the following steps to configure:
1. Opened catalina n gave the path. JAVA_HOME="JDK1.6_PATH"
2. Opened CMD gave the tomcat path... STARTED THE SERVER.Then STOPPED IT
3. Installed Netbeans6.1, configured tomcat server in it.
Later i typed a simple program with JSP N HTML:
The following is the HTML code:
<html>
<head>
<title>HELLO WORLD123</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form action="index.jsp">
firstname<input type="text" name="firstname" value="username">
password<input type="password" name="password" value="password">
<input type="submit" value="submit">
</form>
</body>
</html>
JSP code:
<html>
<head>
<title>123</title>
</head>
<body>
<h2>Hello World!</h2>
<%
String firstname=request.getParameter("firstname");
String lastname=request.getParameter("lastname");
%>
<%=firstname%>
<%=lastname%>
<form action="newhtml.html" method="post">
<input type="submit" value="return">
</form>
</body>
</html>
When i save n run this program the browser is giving a diff output. It is showing the out of index.jsp. The output looks like the following:
Hello World!
Please help me solve this issue. What should i do now.
3 replies to this topic
#1
Posted 11 January 2011 - 11:44 PM
|
|
|
#2
Posted 12 January 2011 - 02:36 AM
So to run, you open the html file, type in a name and password and press submit, right?
Where should the lastname come from, by the way?
Where should the lastname come from, by the way?
#3
Posted 12 January 2011 - 03:55 AM
Also note you should add:
<form action="index.jsp" [B][I]method="post"[/I][/B]>If you leave the method out, their password will automatically be pushed to the url (via GET instead of POST, i.e. index.jsp?firstname=...&password=...) which is possible security risk
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#4
Posted 12 January 2011 - 06:37 AM
Thanks alot alexander.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account

Back to top









