pretenderесли класс FormHello приведен полностью, то удивляться нечему. Поле session инициализировать как-то надо бы, прежде чем к нему обращаться: session.beginTransaction();
Ну а это навскидку, а так согласен: нужен полный стэк-трэйс, чтобы разобраться в чем проблема.
Ладненько, вот полный вариант того ы чем собственно вопрос :
1) index.jsp
<jsp:forward page="/cafe/main.jsp" />
2) main.jsp
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<title>Main Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" href="styles.css">
<script type="text/javascript" language="javascript" src="jscripts.js"></script>
</head>
<body class ="stb">
<f:view>
<table width="400" cellpadding="0" cellspacing="0" border="0" align="left">
<tr>
<td valign="top" align="left">
<table width="400" cellpadding="0" cellspacing="0" border="0" align="left">
<tr>
<td width="11" valign="top" align="right"><img src="img/lt.gif" border="0" alt=""></td>
<td width="378" class ="mn"></td>
<td width="11"><img src="img/rt.gif" border="0" alt=""></td>
</tr>
<tr>
<td width="11" class ="mn"></td>
<td width="378" class ="mn" valign="top" align="center">
<h:form id="mform" onsubmit="return checkTextFields('mform:hotCoffeQuantity','mform:coffeWithSugarQuantity')">
<table width="358" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="216" height="20" align="center" valign="middle">Name</td>
<td width="78" align="center" valign="middle">Price</td>
<td width="64" align="center" valign="middle">Quantity</td>
</tr>
<tr class ="fr">
<td height="28" valign="middle" align="left"><h:selectBooleanCheckbox styleClass="ch" id="checked_num_1" onclick="javascript:setDefaultTextValue('mform:checked_num_1','mform:hotCoffeQuantity')"/><h:outputText value="Very strong and hot coffee." /></td>
<td valign="middle" align="center"><h:outputText value="20 TGR"/></td>
<td valign="middle" align="center"><h:inputText id="hotCoffeQuantity" styleClass="tf" value="#{CalculationControllerBean.hotCoffeQuantity}" maxlength="3" /></td>
</tr>
<tr>
<td colspan="3" height="5"></td>
</tr>
<tr class ="sr">
<td height="28" valign="middle" align="left"><h:selectBooleanCheckbox styleClass="ch" id="checked_num_2" onclick="javascript:setDefaultTextValue('mform:checked_num_2','mform:coffeWithSugarQuantity')" /><h:outputText value="Delicious coffee with sugar."/> </td>
<td valign="middle" align="center"><h:outputText value="15 TGR"/></td>
<td valign="middle" align="center"><h:inputText id="coffeWithSugarQuantity" styleClass="tf" value="#{CalculationControllerBean.coffeWithSugarQuantity}" maxlength="3" /></td>
</tr>
<tr>
<td colspan="3" height="5"></td>
</tr>
<tr>
<td colspan="3" align="right" valign="middle" height="20">
<h:panelGroup>
<h:commandButton styleClass="submit" id="calculationOfAll" action="#{CalculationControllerBean.calculationOfAll}" type="submit" value="Submit"/>
</h:panelGroup>
</td>
</tr>
<tr>
<td colspan="3" height="5"></td>
</tr>
</table>
</h:form>
</td>
<td width="11" class ="mn"></td>
</tr>
<tr>
<td width="11" valign="bottom" align="right"><img src="img/lb.gif" border="0" alt=""></td>
<td width="378" class ="mn"></td>
<td width="11" valign="bottom" align="left"><img src="img/rb.gif" border="0" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td valign="top" align="left"><span class ="style1">*</span> - Each fifth cup free of charge.</td>
</tr>
</table>
</body>
</f:view>
</html>
3) orderlist.jsp
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
104.
105.
106.
107.
108.
109.
110.
111.
112.
113.
114.
115.
116.
117.
118.
119.
120.
121.
122.
123.
124.
125.
126.
127.
128.
129.
130.
131.
132.
133.
134.
135.
136.
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<title>OrderList Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" href="styles.css">
</head>
<body class ="stb">
<f:view>
<table width="408" cellpadding="0" cellspacing="0" border="0" align="left">
<tr>
<td width="408" align="left" valign="top">
<h:form id="submitform">
<table width="300" cellpadding="0" cellspacing="0" border="0" align="left" class ="tb">
<tr>
<td height="20" class ="tx" valign="middle" align="center">Delivery</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="20" align="left" valign="top">
<table width="300" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="71" height="20" align="left" valign="middle" class ="tx"> FIO:</td>
<td width="229" align="left" valign="middle"><h:inputText id="fio" value="#{CalculationControllerBean.fio}" styleClass="tfl" onclick="this.value =''" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="20" align="left" valign="top">
<table width="300" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="71" height="20" align="left" valign="middle" class ="tx"> Address:</td>
<td width="229" align="left" valign="middle"><h:inputText id="address" value="#{CalculationControllerBean.address}" styleClass="tfl" onclick="this.value =''" /></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
<tr>
<td align="right" valign="middle" height="20">
<h:panelGroup>
<h:commandButton type="submit" id="submit" action="#{CalculationControllerBean.success}" styleClass="submit" value="Submit" />
</h:panelGroup>
</td>
</tr>
<tr>
<td height="5"></td>
</tr>
</table>
</h:form>
</td>
</tr>
<tr>
<td height="10"></td>
</tr>
<tr>
<td valign="top" align="left">
<table width="400" cellpadding="0" cellspacing="0" border="0" align="left">
<tr>
<td width="11" valign="top" align="right"><img src="img/lt.gif" border="0" alt=""></td>
<td width="378" class ="mn"></td>
<td width="11"><img src="img/rt.gif" border="0" alt=""></td>
</tr>
<tr>
<td width="11" class ="mn"></td>
<td width="378" class ="mn" valign="top" align="center">
<table width="358" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="216" height="20" align="center" valign="middle">Name</td>
<td width="78" align="center" valign="middle">Price</td>
<td width="64" align="center" valign="middle">Quantity</td>
</tr>
<tr class ="fr">
<td height="28" valign="middle" align="left" class ="pd">Very strong and hot coffee.</td>
<td valign="middle" align="center"> 20 TGR</td>
<td valign="middle" align="center"><h:outputText value="#{CalculationControllerBean.hotCoffeQuantity}"/></td>
</tr>
<tr>
<td height="5" colspan="5"></td>
</tr>
<tr class ="sr">
<td height="28" valign="middle" align="left" class ="pd">Delicious coffee with sugar.</td>
<td valign="middle" align="center"> 15 TGR</td>
<td valign="middle" align="center"><h:outputText value="#{CalculationControllerBean.coffeWithSugarQuantity}"/></td>
</tr>
<tr>
<td colspan="3" height="3"></td>
</tr>
<tr>
<td colspan="3" align="right" valign="top">
<table cellpadding="0" cellspacing="0" border="0" width="145">
<tr>
<td width="80" height="20" align="right" valign="middle">Summ:</td>
<td width="65" align="center" valign="middle"><h:outputText value="#{CalculationControllerBean.costOfCoffePrice}"/> TGR</td>
</tr>
<tr>
<td height="20" valign="middle" align="right">Delivery:</td>
<td valign="middle" align="center"><h:outputText value="#{CalculationControllerBean.deliveryPrice}"/> TGR</td>
</tr>
<tr>
<td height="20" valign="middle" align="right">Total price:</td>
<td valign="middle" align="center" class ="tx"><h:outputText value="#{CalculationControllerBean.totalPrice}"/> TGR</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="11" class ="mn"></td>
</tr>
<tr>
<td width="11" valign="bottom" align="right"><img src="img/lb.gif" border="0" alt=""></td>
<td width="378" class ="mn"></td>
<td width="11" valign="bottom" align="left"><img src="img/rb.gif" border="0" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" align="left">
<a href="/cafe/main.jsp" class ="clr">Back to main page ... </a>
</td>
</tr>
</table>
</f:view>
</body>
</html>
4) order.jsp
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<html>
<head>
<title>Order Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" href="styles.css">
</head>
<body class ="stb">
<table width="404" cellpadding="0" cellspacing="0" border="0" align="left">
<tr>
<td width="404" align="left" valign="top">
<table width="400" cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="11" valign="top" align="right"><img src="img/lt.gif" border="0" alt=""></td>
<td width="378" class ="mn"></td>
<td width="11"><img src="img/rt.gif" border="0" alt=""></td>
</tr>
<tr>
<td width="11" class ="mn"></td>
<td width="378" class ="mn" valign="top" align="center">
<table width="358" cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="20" align="center" valign="middle" class ="tx">Подтверждение</td>
</tr>
<tr>
<td valign="middle" align="center" class ="tx">Ваш заказ принят</td>
</tr>
</table>
</td>
<td width="11" class ="mn"></td>
</tr>
<tr>
<td width="11" valign="bottom" align="right"><img src="img/lb.gif" border="0" alt=""></td>
<td width="378" class ="mn"></td>
<td width="11" valign="bottom" align="left"><img src="img/rb.gif" border="0" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" align="left"><a href="main.jsp" class ="clr">Back to main page ...</a></td>
</tr>
</table>
</body>
</html>
5) faces-config.xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
<faces-config>
<managed-bean>
<description>The "backing file" bean that backs up the calculator webapp</description>
<managed-bean-name>CalculationControllerBean</managed-bean-name>
<managed-bean- class >com.cafe.orderlist.controller.CalculationController</managed-bean- class >
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/main.jsp</from-view-id>
<navigation- case >
<from-outcome>success</from-outcome>
<to-view-id>/orderlist.jsp</to-view-id>
</navigation- case >
</navigation-rule>
<navigation-rule>
<from-view-id>/orderlist.jsp</from-view-id>
<navigation- case >
<from-outcome>success</from-outcome>
<to-view-id>/order.jsp</to-view-id>
</navigation- case >
</navigation-rule>
</faces-config>
6) web.xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
<web-app>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet- class >javax.faces.webapp.FacesServlet</servlet- class >
<load-on-startup> 1 </load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/cafe/*</url-pattern>
</servlet-mapping>
</web-app>
7) hibernatecfg.xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<property name="connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/list</property>
<property name="connection.username">root</property>
<property name="connection.password"> 123 </property>
<property name="show_sql">true</property>
<mapping resource="com/cafe/orderlist/submit/IntoDataBase.hbm.xml"></mapping>
</session-factory>
</hibernate-configuration>
8) IntoDataBase.hbm.xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
< class name="com.cafe.orderlist.submit.IntoDataBase" table="current_lists">
<id name="listId" column="id">
<generator class ="net.sf.hibernate.id.IncrementGenerator"/>
</id>
<property name="fio">
<column name="fio" length="100" not- null ="true"/>
</property>
<property name="address">
<column name="address" length="100" not- null ="true"/>
</property>
<property name="hotCoffeQuantity">
<column name="hotCoffeQuantity" not- null ="true"/>
</property>
<property name="coffeWithSugarQuantity">
<column name="coffeWithSugarQuantity" length="50" not- null ="true"/>
</property>
<property name="hotCoffePrice">
<column name="hotCoffePrice" not- null ="true"/>
</property>
<property name="coffeWithSugarPrice">
<column name="coffeWithSugarPrice" not- null ="true"/>
</property>
<property name="costOfCoffePrice">
<column name="costOfCoffePrice" not- null ="true"/>
</property>
<property name="deliveryPrice">
<column name="deliveryPrice" not- null ="true"/>
</property>
<property name="totalPrice">
<column name="totalPrice" not- null ="true"/>
</property>
</ class >
</hibernate-mapping>
9) IntoDataBase.java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
package com.cafe.orderlist.submit;
public class IntoDataBase {
private int listId;
private int hotCoffeQuantity;
private int coffeWithSugarQuantity;
private int hotCoffePrice;
private int coffeWithSugarPrice;
private int costOfCoffePrice;
private int totalPrice;
private int deliveryPrice;
private StringBuffer fio;
private StringBuffer address;
public int getListId() {
return listId;
}
public void setListId( int listId) {
this .listId = listId;
}
public int getHotCoffeQuantity() {
return hotCoffeQuantity;
}
public void setHotCoffeQuantity( int hotCoffeQuantity) {
this .hotCoffeQuantity = hotCoffeQuantity;
}
public int getCoffeWithSugarQuantity() {
return coffeWithSugarQuantity;
}
public void setCoffeWithSugarQuantity( int coffeWithSugarQuantity) {
this .coffeWithSugarQuantity = coffeWithSugarQuantity;
}
public int getHotCoffePrice() {
return hotCoffePrice;
}
public void setHotCoffePrice( int hotCoffePrice) {
this .hotCoffePrice = hotCoffePrice;
}
public int getCoffeWithSugarPrice() {
return coffeWithSugarPrice;
}
public void setCoffeWithSugarPrice( int coffeWithSugarPrice) {
this .coffeWithSugarPrice = coffeWithSugarPrice;
}
public int getCostOfCoffePrice() {
return costOfCoffePrice;
}
public void setCostOfCoffePrice( int costOfCoffePrice) {
this .costOfCoffePrice = costOfCoffePrice;
}
public int getTotalPrice() {
return totalPrice;
}
public void setTotalPrice( int totalPrice) {
this .totalPrice = totalPrice;
}
public int getDeliveryPrice() {
return deliveryPrice;
}
public void setDeliveryPrice( int deliveryPrice) {
this .deliveryPrice = deliveryPrice;
}
public StringBuffer getFio() {
return fio;
}
public void setFio(StringBuffer fio) {
this .fio = fio;
}
public StringBuffer getAddress() {
return address;
}
public void setAddress(StringBuffer address) {
this .address = address;
}
}
10) Calculation.java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
package com.cafe.orderlist.model;
public class Calculation {
public int hotCoffeCalc( int hotCoffeQuantity){
int freeOfChargeCpups;
if (hotCoffeQuantity >= 5 ) {
freeOfChargeCpups = hotCoffeQuantity/ 5 ;
return 20 * (hotCoffeQuantity - freeOfChargeCpups);
}
else return 20 * hotCoffeQuantity;
}
public int coffeWithSugarCalc ( int coffeWithSugarQuantity){
int freeOfChargeCpups;
if (coffeWithSugarQuantity >= 5 ) {
freeOfChargeCpups = coffeWithSugarQuantity/ 5 ;
return 15 * (coffeWithSugarQuantity - freeOfChargeCpups);
}
else return 15 * coffeWithSugarQuantity;
}
public int costOfDelivery ( int hotCoffePrice, int coffeWithSugarPrice){
if (hotCoffePrice + coffeWithSugarPrice > 50 )
return 0 ;
else if (hotCoffePrice + coffeWithSugarPrice == 0 )
return 0 ;
else return 5 ;
}
public int costOCoffe ( int hotCoffePrice, int coffeWithSugarPrice){
return hotCoffePrice + coffeWithSugarPrice;
}
public int totalPrice ( int hotCoffePrice, int coffeWithSugarPrice, int deliveryPrice){
return (hotCoffePrice + coffeWithSugarPrice + deliveryPrice);
}
}
11) CalculationController.java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
94.
95.
96.
97.
98.
99.
100.
101.
102.
103.
package com.cafe.orderlist.controller;
import com.cafe.orderlist.model.Calculation;
import com.cafe.orderlist.submit.IntoDataBase;
import net.sf.hibernate.Transaction;
import net.sf.hibernate.Session;
import net.sf.hibernate.HibernateException;
public class CalculationController {
private Calculation calculator = new Calculation();
private IntoDataBase intoDataBase = new IntoDataBase();
private int hotCoffeQuantity = 0 ;
private int coffeWithSugarQuantity = 0 ;
private int hotCoffePrice;
private int coffeWithSugarPrice;
private int costOfCoffePrice;
private int totalPrice;
private int deliveryPrice;
private StringBuffer fio = new StringBuffer("fio");
private StringBuffer address = new StringBuffer("address");
// - Set & Get FIO - //
public StringBuffer getFio() {
return fio;
}
public void setFio(StringBuffer fio) {
this .fio = fio;
}
//- Set & Get Address -//
public StringBuffer getAddress() {
return address;
}
public void setAddress(StringBuffer address) {
this .address = address;
}
//- Set & Get HotCoffeQuantity -//
public void setHotCoffeQuantity ( int hotCoffeQuantity){
this .hotCoffeQuantity = hotCoffeQuantity;
}
public int getHotCoffeQuantity() {
return hotCoffeQuantity;
}
//- Set & Get CoffeWithSugar -//
public void setCoffeWithSugarQuantity ( int coffeWithSugarQuantity) {
this .coffeWithSugarQuantity = coffeWithSugarQuantity;
}
public int getCoffeWithSugarQuantity() {
return coffeWithSugarQuantity;
}
//- Get HotCoffePrice -//
public int getHotCoffePrice(){
return hotCoffePrice;
}
//- Get CoffeWithSugarPrice -//
public int getCoffeWithSugarPrice(){
return coffeWithSugarPrice;
}
//- Get DeliveryPrice -//
public int getDeliveryPrice(){
return deliveryPrice;
}
public int getCostOfCoffePrice (){
return costOfCoffePrice;
}
//- Get TotalPrice -//
public int getTotalPrice(){
return totalPrice;
}
public String success (Session session) throws HibernateException {
Transaction transaction = session.beginTransaction();
intoDataBase.setAddress(address);
intoDataBase.setFio(fio);
intoDataBase.setCoffeWithSugarPrice(coffeWithSugarPrice);
intoDataBase.setCoffeWithSugarQuantity(coffeWithSugarQuantity);
intoDataBase.setHotCoffePrice(hotCoffePrice);
intoDataBase.setHotCoffeQuantity(hotCoffeQuantity);
intoDataBase.setCostOfCoffePrice(costOfCoffePrice);
intoDataBase.setDeliveryPrice(deliveryPrice);
intoDataBase.setTotalPrice(totalPrice);
session.save(intoDataBase);
transaction.commit();
session.close();
return "success";
}
public String calculationOfAll(){
hotCoffePrice = calculator.hotCoffeCalc(hotCoffeQuantity);
coffeWithSugarPrice = calculator.coffeWithSugarCalc(coffeWithSugarQuantity);
deliveryPrice = calculator.costOfDelivery(hotCoffePrice,coffeWithSugarPrice);
costOfCoffePrice = calculator.costOCoffe(hotCoffePrice,coffeWithSugarPrice);
totalPrice = calculator.totalPrice(hotCoffePrice,coffeWithSugarPrice,deliveryPrice);
return "success";
}
}
JavaScriptы по моему не влияют поэтому показываит их не буду как и css файл.
Так вот вопрос в том что при нажатии на кнопку Submit на странице orderlist.jsp
1.
2.
3.
<h:panelGroup>
<h:commandButton type="submit" id="submit" action="#{CalculationControllerBean.success}" styleClass="submit" value="Submit" />
</h:panelGroup>
Обсолютно ничего не происходит.
Если метод success сделать без параметров success() а переменную session определить в параметрах
1.
2.
3.
private StringBuffer fio = new StringBuffer("fio");
private StringBuffer address = new StringBuffer("address");
Session session;
то тоже ничего не происходит, база пустая как и нет перехода на финальную страницу. Когда я мутил что-то из серии еруды то получал вот тот ексепшен что описан выше.
Мне надо что бы работало по следующему правилу. На первой странице вводятся данные(int) переходим на вторую (orderlist) где вводим вторые данные (StringBuffer) и в результате переходим на последнюю страницу где ничего не выводиться (просто говориться спасибо) и все собранные данные на двух страницах кладуться в базу данных. Вот и все. Помогите умной мыслей.
Прошу модераторов не банить за большое сообщение, просто хотел внечти ясность.