Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 13th, 2004, 12:08 PM
Authorized User
 
Join Date: Jan 2004
Location: Athlone, , Ireland.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default $ 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
Reply With Quote
  #2 (permalink)  
Old January 13th, 2004, 03:22 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #3 (permalink)  
Old January 14th, 2004, 11:40 AM
Authorized User
 
Join Date: Jan 2004
Location: Athlone, , Ireland.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default



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
Reply With Quote
  #4 (permalink)  
Old January 14th, 2004, 02:01 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Have you successfully deployed and ran any JSP programs since you installed Tomcat?

Cheers

Martyn
Reply With Quote
  #5 (permalink)  
Old January 14th, 2004, 03:47 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #6 (permalink)  
Old January 14th, 2004, 03:49 PM
Authorized User
 
Join Date: Jan 2004
Location: Athlone, , Ireland.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Martyn
 Have you successfully deployed and ran any JSP programs since you installed Tomcat?

Cheers

Martyn
PW
Reply With Quote
  #7 (permalink)  
Old January 14th, 2004, 04:06 PM
Authorized User
 
Join Date: Jan 2004
Location: Athlone, , Ireland.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #8 (permalink)  
Old January 15th, 2004, 12:33 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #9 (permalink)  
Old January 16th, 2004, 09:19 AM
Authorized User
 
Join Date: Jan 2004
Location: Athlone, , Ireland.
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
  #10 (permalink)  
Old January 16th, 2004, 12:44 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plz give the advise about Sql 9i syllebus gemsuis Oracle 0 July 4th, 2006 02:23 PM
Please have a look and advise on my join mat41 SQL Language 2 August 9th, 2005 06:22 PM
OO Advise and Clarification rodmcleay General .NET 1 October 14th, 2004 09:51 PM
Problems with Java Mail Please advise "Chapter 9" PatrickWalsh JSP Basics 1 September 5th, 2004 06:46 PM



All times are GMT -4. The time now is 03:16 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.