• Post Reply Bookmark Topic Watch Topic
  • New Topic

problems with expression langguage in jsp-  RSS feed

 
p Walsh
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just starting out on the jsp learning curve but cannot get the below example to work can you please advise?
I am using a book by Wrox publishers entitled Beginning Jsp.
Basically that example i am work on is a html order forms that displays the information to a jsp file here is the code...
for the jsp file
<html>
<head>
<title>Take The Pizza</title>
<style type="text/css">
H1 {
font-size: 12pt;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Order Confirmation</h1>
<p/>
Please review this data to ensure that it is correct.
<p/>
<table border="1">
<tr>
<td>
Name:
</td>
<td>
${param.name}
</td>
</tr>
<tr>
<td>
Address:
</td>
<td>
${param.address}
</td>
</tr>
<tr>
<td>
Order Type:
</td>
<td>
${param.purchaseType}
</td>
</tr>
<tr>
<td>
Peppers:
</td>
<td>
${param.peppers}
</td>
</tr>
<tr>
<td>
Sweetcorn:
</td>
<td>
${param.sweetcorn}
</td>
</tr>
<tr>
<td>
Mouse Innards:
</td>
<td>
${param.mouse}
</td>
</tr>
<tr>
<td>
Size:
</td>
<td>
${param.size}
</td>
</tr>
</table>
</body>
</html>
And here is the code for the html file-
<html>
<head>
<title>Take The Pizza</title>
<style type="text/css">
H1 {
font-size: 12pt;
font-weight: bold;
}
</style>
</head>
<body>
<form action="process.jsp" method="post">
Welcome to Take the Pizza Online! We're eager to take your order
for pizza via our new web form!
<p/>
Please fill out the fields below and click on "Place Order" when
you're done!
<p/>
<h1>Your Information:</h1>
<table>
<tr>
<td>
Name:
</td>
<td>
<input type="text" name="name" size="30">
</td>
</tr>
<tr>
<td>
Address:
</td>
<td>
<textarea rows="4" cols="40" name="address"></textarea>
</td>
</tr>
</table>
<p/>
<h1>Order Type:</h1>
<table>
<tr>
<td>
<input type="radio" name="purchaseType" value="Home Delivery">
</td>
<td>
Home Delivery
</td>
</tr>
<tr>
<td>
<input type="radio" name="purchaseType" value="Take Away">
</td>
<td>
Take Away
</td>
</tr>
</table>
<p/>
<h1>Please Select Any Additional Toppings:</h1>
<table>
<tr>
<td>
<input type="checkbox" name="peppers" value="Yes">
</td>
<td>
Peppers
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="sweetcorn" value="Yes">
</td>
<td>
Sweetcorn
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="mouse" value="Yes">
</td>
<td>
Mouse Innards
</td>
</tr>
</table>
<p/>
<h1>Pizza Size:</h1>
<table>
<tr>
<td>
Size:
</td>
<td>
<select name="size">
<option>Small</option>
<option selected="true">Medium</option>
<option>Large</option>
</select>
</td>
</tr>
</table>
<p/>
<input type="submit" value="Place Order">
</form>
</body>
</html>
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}
Can you please advise me on this , much appreciated,
Pat
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat,
Firstly, you'd be best served to be sure and use the UBB code tags when posting code to the ranch. That will preserve the code formatting and make it more likely that someone will look through it.
Secondly, which servlet engine and version are you using? The expression language is new with JSP 2, so you need to make sure that you are using a JSP 2 engine.
If you are, I think there was a thread earlier this month on just such a problem. (Something to do with making sure that something was set up correctly in the web.xml file).
bear
[ January 13, 2004: Message edited by: Bear Bibeault ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are, I think there was a thread earlier this month on just such a problem. (Something to do with making sure that something was set up correctly in the web.xml file).
Yeah. I was bouncing back between Resin and Tomcat trying to help a guy doing this exact same Pizza problem. Hmmmmm.
Anyway, if you are using Tomcat, you have to have a web.xml file or Tomcat won't evaluation RE's correctly. I have no idea why. I can't find any docs on this. Resin doesn't care about the web.xml if all you are doing is JSP's.
If you are actually running Tomcat, make sure you have a web.xml file in a WEB-INF folder in the root of your web module folder and make sure that the specified DTD is as follows...

Again, I have no idea why Tomcat wants the web.xml file just for JSP's for RE to work. It could be a temporary solution since Tomcat 5.x.x is still considered BETA. The final release may not have this restriction.
IMHO though, Tomcat is still the best server for development.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!