Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

passing parameters to jsp page

 
prasad Chandrasekaran Iyer
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
if i want to pass parameters to .jsp file form an html file,
what i should mention In the ACTION of html page
prasad
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13056
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an example from my forthcoming book on servlets and JSP
<form action="TableDemoC.jsp" method="GET">
Enter Number to be shifted: <input name="numb" type="text" size="10">
<input type="hidden" name="studentid" value="thx1138" >
<input type="submit" value="Show" name="go" ><br>
</form>
As you see, the action just points to the JSP page which lives in a directory with HTML pages, etc. - as opposed to sending to a servlet where you have to use the servlet alias.
Bill
 
prasad Chandrasekaran Iyer
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi and thanks for ur reply.
I tried to do the way that u mentioned but still i am getting error.
this is my HTML page and i am giving my name here
<html>
<head>
<title>Jsp page</title>
<body>
hello how r u
<form ACTION="abc1.jsp" METHOD="GET" >
if you don't mind me asking what is ur name
<input type=text name="name"><p>
<input type=submit>
</form>
</body>
</head>
</html>
This is my JSP page, and i am passing parameters to this page.
And i mentioned HTML and JSP pages in PUBLIC_HTML directory in weblogic server.
and i started the weblogic server, and i given url like this
http://localhost:7001/abc.html
and i am getting the second page like this with an error page.
http://localhost:7001/abc1.jsp?name=prasad

<html>
<head>
<title> first jsp page</title>
<body>
<h1>
<% if(request.getParameter("name")==null){
out.println("hello world");
}
else{
out.println("hello, "+ request.getParmater("name"));
}
%>
</h1>
</body>
</html>

can anybody help me out with this problem
prasad
 
Joe Paolangeli
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works fine, you just need to fix your typing error:
change "getParmater" to "getParameter"
[This message has been edited by Joe Paolangeli (edited August 31, 2000).]
 
Tony Alicea
Desperado
Sheriff
Posts: 3226
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William:
What JSP and Servlets versions will your book cover?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic