aspose file tools*
The moose likes JSP and the fly likes Error while running jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Error while running jsp" Watch "Error while running jsp" New topic
Author

Error while running jsp

chauhan prakash
Greenhorn

Joined: Oct 08, 2006
Posts: 6
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 ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

No substantive response is possible without showing us the code that generates the error.
[ October 08, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
chauhan prakash
Greenhorn

Joined: Oct 08, 2006
Posts: 6
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
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

The JSP FAQ covers the fact that your beans must be in a package other than the default.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10052
    
163

In AddToVideoShop.jsp, change:
<%@ page language="java" import"videoShop"%>


to



And in videoShop.jsp, change:

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


to



[My Blog] [JavaRanch Journal]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61010
    
  65

Yes, in addition to these simple syntax correction, be sure to move your bean into a package.
chauhan prakash
Greenhorn

Joined: Oct 08, 2006
Posts: 6
Thnak's a lot. I got the output.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error while running jsp