I also tried to declare it as a static final string, same problem.
I just saw that I did send the wrong snippet.
I will attach both action bean and jsp.
What happens there is: I have another form, where I have a button called
"Create new order". Once pressed, the button calls the createOrder resolution
in the action bean, which creates a new order in the database, from which I
retrieve the id of the order and the username. Then, the user is taken to
another page, where a large table is displayed which contains all the products
in the database. There is also a textbox, where the user inserts the id of a
product which he desires to add to the order, and then presses the "Add
product" button. This calls the addProduct method, which inserts the product in
the database and gives the control back to the
createUserOrder jsp. Also, the username and the orderid should be kept the same
as long as the user keeps adding products to the order (I don't really know how
to do this, I tried storing them into the context but, since I get the error
I'm not sure if it works or not, but in my opinion it does not work as I want
it to). The problem is when I press the add product button. The product is
added correctly to the database, but the forward doesn't work, and gives me the
errors:
type Status report
message
descriptionThe requested resource () is not available. (in browser)
SEVERE: PWC6117: File "C:\Program Files
(x86)\glassfish-3.1.2.2\glassfish\domains\domain1\docroot\StoreOnlineWEB-INF\createUserOrder.jsp"
not found (in glassfish tab in netbeans)
If I try accessing the createUserOrder.jsp from another action bean it works,
it even works when accessing it from UserOrdersAction, except on this
operation.
The action bean is:
public class UserOrdersAction implements ActionBean {
String errors;
private ActionBeanContext context;
Integer orderid = -1;
Integer productid;
private String username;
Integer quantity;
Integer orderedprodid;
String status;
public Resolution createOrder() {
Calendar currentDate = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy");
String dateNow = formatter.format(currentDate.getTime());
OrderMethods orderAction = new OrderMethods();
orderid = orderAction.findMaxId()+1;
orderAction.create(orderid, username, "open", dateNow);
getContext().getRequest().getSession().setAttribute("username",
username);
getContext().getRequest().getSession().setAttribute("orderid", orderid);
return new ForwardResolution("WEB-INF/createUserOrder.jsp");
}
public Resolution viewOrders() {
return new ForwardResolution("WEB-INF/seeUserOrders.jsp");
}
public Resolution addProduct() {
username =
(String)getContext().getRequest().getSession().getAttribute("username");
orderid =
(Integer)getContext().getRequest().getSession().getAttribute("orderid");
OrderedProductMethods orderedProdAction = new OrderedProductMethods();
orderedprodid = orderedProdAction.findMaxId()+1;
orderedProdAction.create(orderedprodid, orderid, productid, quantity);
return new RedirectResolution("/WEB-INF/createUserOrder.jsp");
}
public Resolution closeOrder() {
orderid = -1;
getContext().getRequest().getSession().setAttribute("username",
username);
return new ForwardResolution("WEB-INF/user.jsp");
}
public Resolution logout() {
return new ForwardResolution("WEB-INF/login.jsp");
}
public List getAllProducts() {
ProductMethods productAction = new ProductMethods();
return productAction.findAll();
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getErrors() {
return errors;
}
public void setErrors(String errors) {
this.errors = errors;
}
public Integer getProductid() {
return productid;
}
public void setProductid(Integer productid) {
this.productid = productid;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public void setContext(ActionBeanContext c) {
this.context = c;
}
public ActionBeanContext getContext() {
return context;
}
}
and the createUserOrder.jsp is:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Create User Order</title>
</head>
<body>
<h1>Here you can create a new order ${actionBean.username}!</h1>
<s:form beanclass="com.project.storeonline.action.UserOrdersAction">
<h1>Add a product to the order: <h1>
<h2>${actionBean.errors}<h2>
<h3>Product Id: <s:text name="productid"/></h3>
<h3>Quantity:<s:text name="quantity"/></h3>
<s:submit name="addProduct" value="Add Product"/>
</s:form>
<s:form
beanclass="com.project.storeonline.action.UserOrdersAction">
<s:submit name="closeOrder" value="Close Order"/>
</s:form>
<br/><br/>
<h1>Product list</h1>
<table border="1">
<tr>
<th>Id</th>
<th>Name</th>
<th>Category</th>
<th>Price</th>
<th>Description</th>
</tr>
<c:forEach var="prod"
items="${actionBean.allProducts}" varStatus="loop">
<tr >
<td >${prod.id}</td>
<td >${prod.name}</td>
<td >${prod.category}</td>
<td >${prod.price}</td>
<td >${prod.description}</td>
<td >${prod.quantity}</td>
<td >
</td>
</tr>
</c:forEach>
</table>
</body>
</html>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users