GeeCON Prague 2014*
The moose likes Servlets and the fly likes passing parameters to jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "passing parameters to jsp page" Watch "passing parameters to jsp page" New topic
Author

passing parameters to jsp page

prasad Chandrasekaran Iyer
Greenhorn

Joined: Jan 14, 2004
Posts: 18
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

Joined: Mar 22, 2000
Posts: 12791
    
    5
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

Joined: Jan 14, 2004
Posts: 18
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

Joined: Apr 05, 2000
Posts: 73
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

Joined: Jan 30, 2000
Posts: 3222
    
    5
William:
What JSP and Servlets versions will your book cover?


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
 
GeeCON Prague 2014
 
subject: passing parameters to jsp page