• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Error while running jsp

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am getting following error while running my jsp file. The bean file for my jsp is already saved in WEB-INF/classes directory.

org.apache.jasper.compiler.ParseException: /videoShop.jsp(3,57) Attribute % has no value

&

org.apache.jasper.compiler.ParseException: /AddToVideoShop.jsp(0,31) Attribute import has no value


can anybody help me out.

Thanks in advance.
[ October 08, 2006: Message edited by: Bear Bibeault ]
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No substantive response is possible without showing us the code that generates the error.
[ October 08, 2006: Message edited by: Bear Bibeault ]
 
chauhan prakash
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The followings are the 3 files.
Can you debug the problem as I mentioned earlier.
Thanks in advance.


File no.1--videoShop.java
package video;
import java.lang.*;
import java.util.*;


public class videoShop {

protected Hashtable items = new Hashtable();

public videoShop() { }

public void addItem(String itemId, String desc, float price, int quantity) {
String[] item = {itemId, desc, Float.toString(price), Integer.toString(quantity)};

if(items.containsKey(itemId)) { //what if loop is doing.
String [] tmpItem = (String[])items.get(itemId);//why type casting ?
int tmpQuant=Integer.parseInt(tmpItem[3]);
quantity+=tmpQuant;
tmpItem[3]=Integer.toString(quantity);
}

else {
items.put(itemId,item);
}
}


public void removeItem(String itemId) {
if(items.containsKey(itemId)) {
items.remove(itemId);
}
}


public void updateQuantity(String itemId, int quantity) {
if(items.contains(itemId)) {
String[] tmpItem = (String[])items.get(itemId);
tmpItem[3]=Integer.toString(quantity);
}
}


public Enumeration getEnumeration() {
return items.elements();
}


public float getCost() {
Enumeration enum = items.elements();
String[] tmpItem;
float totalCost = 0.00f;

while(enum.hasMoreElements()) {
tmpItem = (String[])enum.nextElement();
totalCost+=(Integer.parseInt(tmpItem[3])*Float.parseFloat(tmpItem[2]));
}
return totalCost;
}


public int getNumOfItems() {
Enumeration enum = items.elements();
String[] tmpItem;
int numOfItems=0;
while(enum.hasMoreElements()) {
tmpItem=(String[])enum.nextElement();
numOfItems+=Integer.parseInt(tmpItem[3]);
}

return numOfItems;
}
}







File no2--AddToVideoShop.jsp
<%@ page language="java" import"videoShop"%>
<jsp:useBean id="cart" scope="session" class="videoShop"/>

<html>
<head><title>VCD/DVD MENU</title></head>
<body>

<!--if there is new item to the request add it to the cart-->

<% String id = request.getParameter("id");
if(id!=null) {
String desc=request.getParameter("desc");
Float price=new Float(request.getParameter("price");

cart.addItem(id,desc,price.floatValue(),1);
}
%>



<!--print the current quantity of the shoppping cart-->

<hr>
<center><h3>VCD/DVD MENU</h3></CENTER>
<table border="1" width="300" cellspacing="0" cellpadding="2" align="center">
<tr>
<th>Name</th>
<th>Cost</th>
</tr>

<tr>
<form action="AddToVideoShop.jsp" method="post">
<td>where Eagles Dare</td>
<td>$20.00</td>
<td><input type="submit" name="Submit" value="Add"></td>
<input type="hidden" name="id" value="1">
<input type="hidden" name="desc" value="where Eagles dare">
<input type="hidden" name="price" value="20.00">
</form>
</tr>


<tr>
<form action="AddToVideoShop.jsp" method="post">
<td>Ghost Busters</td>
<td>$18.45</td>
<td><input type="submit" name="Submit" value="Add"></td>
<input type="hidden" name="id" value="2">
<input type="hidden" name="desc" value="Ghost Busters">
<input type="hidden" name="price" value="18.45">
</form>
</tr>


<tr>
<form action="AddToVideoShop.jsp" method="post">
<td>Mrs.DoubtFire</td>
<td>$21.00</td>
<td><input type="submit" name="Submit" value="Add"></td>
<input type="hidden" name="id" value="3">
<input type="hidden" name="desc" value="Mrs.DoubtFire">
<input type="hidden" name="price" value="21.50">
</form>
</tr>


<tr>
<form action="AddToVideoShop.jsp" method="post">
<td>Tomorrow Never Dies</td>
<td>$18.00</td>
<td><input type="submit" name="Submit" value="Add"></td>
<input type="hidden" name="id" value="4">
<input type="hidden" name="desc" value="Tomorrow Never Dies">
<input type="hidden" name="price" value="18.75">
</form>
</tr>


<tr>
<form action="AddToVideoShop.jsp" method="post">
<td>Mission Impossible</td>
<td>$20.00</td>
<td><input type="submit" name="submit" value="Add"></td>
<input type="hidden" name="id" value="5">
<input type="hidden" name="desc" value="Mission Impossible">
<input type="hidden" name="price" value="20.00">
</form>
</tr>
</table>
</body>
</html>






File no.3--videoShop.jsp
<%@ page language="java" import="videoShop"%>
<%@ page import="java.util.*"%>

<jsp:useBean id="cart" scope="session" class="videoShop"%>

<html>
<head><title>sharp videos</title></head>
<body
<center>
<table width="300" border="1" cellspacing="0" cellpadding="2" border="0">
<caption><b>video shop content</b></caption>
<tr>
<th>Name</th>
<th>cost</th>
<th>Quantity</th>
</tr>

<%
Enumeration enum=cart.getEnumeration();
String[] tmpItem;

While(enum.hasMoreElements()) {
tmpItem=(String[])enum.nextElement();
%>

<tr>
<td><%=tmpItem[1]%></td>
<td align="center">$<%=tmpItem[2]%></td>
<td align="center"><%=tmpItem[3]%></td>
</tr>

<%
}
%>

</table>
</center>
</body>
</html>
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JSP FAQ covers the fact that your beans must be in a package other than the default.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In AddToVideoShop.jsp, change:

<%@ page language="java" import"videoShop"%>



to



And in videoShop.jsp, change:

<jsp:useBean id="cart" scope="session" class="videoShop"%>



to

 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, in addition to these simple syntax correction, be sure to move your bean into a package.
 
chauhan prakash
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thnak's a lot. I got the output.
 
Stop it! You're embarassing me! And you are embarrassing this tiny ad!
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic