 |
| JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 13th, 2004, 12:08 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
$ command not recognised.-Can you please advise
I am having problems with below example from chapter two
Basically there is a html form called pizza.html that sends information to a JSP page called Process.jsp which will display a summary of the order details.
The problem is that Tomcat does not seem to recognise the jsp code in the pizza .html file.
When you click the option âPlace Orderâ it displays the following
Name: ${param.name}
Address: ${param.address}
Peppers: ${param.address}
Sweetcorn: ${param.sweetcorn}
Mouse Innards: ${param.mouse}
Size: ${param.size}
Ps :
I also downloaded these source files from the wrox website and the exact same problem exists.
Am I missing some setting?
Can you please advise..
Thanks
PW
__________________
PW
|
|

January 13th, 2004, 03:22 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I've just loaded the Pizza example program from Chapter 3 and it ran fine; so I guess it would indicate that the problem is local to your machine. Where have you put the the files pizza.htm and process.jsp?
Cheers
Martyn
|
|

January 14th, 2004, 11:40 AM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I saved them both to the same directory called Pizza in the webapps folder on my pc they both load fine but when i fill out the html form it does not apopear to recognise the jsp code.
One thing that is differant is that i am running Tomcat version four , could this be the issue,
Sorry i forgot to mention this before.
Quote:
quote:Originally posted by Martyn
I've just loaded the Pizza example program from Chapter 3 and it ran fine; so I guess it would indicate that the problem is local to your machine. Where have you put the the files pizza.htm and process.jsp?
Cheers
Martyn
|
PW
|
|

January 14th, 2004, 02:01 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Have you successfully deployed and ran any JSP programs since you installed Tomcat?
Cheers
Martyn
|
|

January 14th, 2004, 03:47 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I can't comment about it being an issue with version 4.0. But to test your deployment I've created the folder tomcat\webapps and copied files pizza.html and process.jsp to it. I then restarted Tomcat and in my bowser I ran the following: http://localhost:8080/pizza/pizza.htm; entered data into the form; clicked on the 'Place Order' button; viewed the expected results. Everything was fine.
As a suggestion; run the following: http://localhost:8080/index.html and click on the 'JSP Examples' link then execute a few of the JSP examples provided. This will prove that your installation is correct.
Cheers
Martyn
|
|

January 14th, 2004, 03:49 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by Martyn
Have you successfully deployed and ran any JSP programs since you installed Tomcat?
Cheers
Martyn
|
PW
|
|

January 14th, 2004, 04:06 PM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have managed to run the the examples of jsp file that came with tomcat and they work fine .
I created the following jsp file from chapter one and it would not run
<html>
<head>
<title>Basic JSP</title>
</head>
<body>
Testing Calculation
<p/>
2 + 2 is ${2 + 2} and 4 * 4 is ${4 * 4}
</body>
</html>
So played around with it and changed it to this and it worked fine ,,
<html>
<head>
<title>Basic JSP</title>
</head>
<body>
Testing Calculation
<p/>
2 + 2 is ${2 + 2} and 4 * 4 is ${4 * 4}
</body>
</html>
Thansk for your help on this,
This one I cannot figure it why to0mcat does not recognise "$"
Pat
PW
|
|

January 15th, 2004, 12:33 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Patrick,
Good, at least we have determined that Tomcat is alive and well!
The second example that you provided is the same as the first so I can't determine what it is that you actually changed. Also, I'm not sure what it is you are trying to do with the '$' sign. Are you trying to use it in place of out.println ?
Please post your code so I can see what it is you are doing; if you used the code from the download then it should be fine.
Cheers
Martyn
|
|

January 16th, 2004, 09:19 AM
|
|
Authorized User
|
|
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hI Martyn,
Sorry the actually code that worked for me was â¦.
<html>
<head>
<title>My First Jsp</title>
</head>
<body>
<p/>
2 + 2 is <%=2+2%> and 4 * 4 is <%=4*4%>
</body>
</html>
but when i tried to run the example given in the book , exactly as it appears in my previous post it fails.
When I use the url
http://localhost:8080/helloJSP/index.jsp
it displays the following.
Hello, world!
2 + 2 is ${2 + 2} and 4 * 4 is ${4 * 4}
PW
|
|

January 16th, 2004, 12:44 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Patrick,
The <% %> method is the correct way; as you have discovered, any other varients don't work.
What book are you using as your reference? I thought that it was Beginning Java Web Development, but it can't be that as the sample you refer to isn't in my version of the book.
Out of curiosity, are you a Pearl programmer?
Cheers
Martyn
|
|
 |