Make Session Attribute To Store New Value After Calculation?

Dec 29, 2014

why my session attribute for this banking webapp wont add the deposits to the session var... it just keeps going back to the amount I set it to originally - so if I set the beginning balance to 3000 then deposit 100 it becomes 3100, but if I then try deposit another amount eg. a extra 200 it becomes 3200 not 3300 like it should be !!

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.text.DecimalFormat;

[code]....

View Replies


ADVERTISEMENT

JSP :: Page Directive Attribute Session False - Yet Session Created

Feb 26, 2014

May be I did not understand the meaning and usage of attribute "session" in page directive. My understanding is if session=false, in page directive, then the JSP page will not participate in the session. However, I have my welcomepage as below:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="true"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
........
.......
<%= session %>
<c:out value="${pageContext.request.session}"/>

if I choose session=true, then both ways of accessing session works , which means the JSP page participated in the session.

But if I change the session=false, then <%= session %> fails, but <c:out value="${pageContext.request.session}"/> does not fail.

how can c:out still show the session, when session = false

View Replies View Related

JSF :: Saving A Session Attribute?

Mar 13, 2014

How can I store in database an user Session attribute along with other informations provided in the same form?

<p:outputLabel value="user ID:" for="informer" />
<p:inputText id="informer" value="#{session.getAttribute('userID').toString()}"
title="informer" disabled="true" />

I've already tested with disabled="false", too, but only the Session attribute is saved as NULL, though it appears in the form field. The other fields are saved properly.

View Replies View Related

Servlets :: Cannot Serialize Session Attribute

Jan 11, 2015

I am getting following exception.

Jan 11, 2015 10:08:23 PM org.apache.catalina.session.StandardSession writeObject
WARNING: Cannot serialize session attribute cart for session 2F9FF7A5ABC3620BD5B3BC0C4D46C558
java.io.NotSerializableException: org.apache.tomcat.jdbc.pool.DisposableConnectionFacade
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1183)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1547)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1508)

[Code] .....

View Replies View Related

Servlets :: Session Attribute Keeps Reverting To Declared Value

Dec 29, 2014

Being new to java I am a bit lost as to why my session attribute for this banking app wont add the deposits to the session var... it just keeps going back to the amount I set it to originally - so if I set the beginning balance to 3000 then deposit 100 it becomes 3100, but if I then try deposit another amount eg. a extra 200 it becomes 3200 not 3300 like it should be !!

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import java.net.*;
import java.text.DecimalFormat;
public class SessionBank extends HttpServlet

[Code] .....

View Replies View Related

Servlets :: How To Get Attribute From Session In Regular Java Class

May 21, 2014

i have file index.jsp , that approach to reguar java class and call function . in that function i want to get attribute from session like this :

List<Coupon> couponsList = (List<Coupon>)request.getSession().getAttribute("listOfCouponsThatNotExpired");

because this regular java class i get error message ,how to solve this ?

View Replies View Related

Make GUI To Calculate Orders And To Save Calculation To CSV File

Feb 1, 2014

My assignment is to make GUI to calculate orders and to save the calculation to .csv file.I have solved "save" button and it really does save my input to .csv file.But, my problem is "Load button" When I press it, how to load .csv file to my existing JTextFields?

View Replies View Related

Servlets :: Can Access Session Object Even Session Is Time Out

Jun 4, 2014

Can I access the session object even session has been expired? I need to check whether session is expired or not for each request.The session invalidation is set null the session object. What I concluded, session time out I can access session object but session invalidation I can not access session object. How can I find the session time out by using session object?

View Replies View Related

Web Services :: Rest Session Not Getting Invalidated After Invalidating UI Session?

Dec 17, 2014

I have 2 war in 1 EAR.

War A corresponds to UI

War B corresponds to Rest

1) From War A, I login to the application and then fetch some users that is a rest call. I get the response back from rest in json form that ui consumes and display the data on page.

2) Now I click on the logout link from ui jsp. This logs out the session from Ui. I use <form data-dojo-type="dijit/form/Form" based logout.

3) I then go to the proxy (using burp) and manually request the rest call which I made in step no 1), the rest gives the response back with the same json object returned in step no 1) This shows that the logout action on step 2) is invalidated the session from War A (ui war) but the session or cookie based from WAR B (rest war) is not invalidated.

Expected outcome:After I Logout from War A(ui war), the session must also get invalidated from war B (rest war) and manually request from proxy should not get the same response object as received in step 1)

View Replies View Related

Servlets :: Updating Session Value But Same Session In JSP Page Not Updated

Jul 8, 2014

I am developing a e-commerce college project, here i add the items in the cart(a div tag in the jsp page) via servlet by creating sessions,

flow control: shopping jsp (when user wants to add an item in the cart) --> item servlet (which is used to create session and synchronized it) --> cart servlet(which is used to add items in the arraylist and show them in the shopping.jsp's div tag + it also sets the total purchase amount in the session variable "totalpurchase")

now after that user wants to proceed to checkout, here i use the onclick event to check the minimumshopping amount must be less than the totalpurchase (totalpurchase which i had setted in the session),but my jsp page is unable to rechognise the updated value of the totalpurchase, yes, if i reload the page, it rechognises the new updated value of the totalpurchase? but i want it to rechognise the updated total purchase value, without reloading he jsp page..

View Replies View Related

JSP :: Attribute Invalid For Tag According To TLD

May 6, 2014

My project in eclipse..I get the error below when I run MyTagUser.jsp -

HTTP Status 500 - /jsp/MyTagUser.jsp(14,0) Attribute subTitle invalid for tag Header according to TLD
org.apache.jasper.JasperException: /jsp/MyTagUser.jsp(14,0) Attribute subTitle
invalid for tag Header according to TLD
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)...et

[code]...

View Replies View Related

JSF :: Set Attribute Type Dynamically

Oct 22, 2014

context.getELContext().getELResolver().getType(context.getELContext(), null, "value")

Here "value" is an attribute name. By this we can get data type of the attribute.

By somehow can we set the type also?

View Replies View Related

How To Read Integer Attribute Using DOM Element

May 13, 2014

I don't know how to read the attribute maxLenth. The way in the image I have done drive me to the error below.!

Piece of XSL:

<?xml version="1.0" encoding="UTF-8"?>
<c:message xmlns:c="ictt"><c:de format="B" lengthField="0" name="BIT MAP, PRIMARY" number="000"/>
<c:de format="B" lengthField="0" maxLength="008" minLength="008" name="BIT MAP, SECONDARY" number="001" subFields="00"/>

Piece of Java Code:

int length = Integer.parseInt(spec.getAttribute("maxLength"));
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R java.lang.NumberFormatException: For input string: ""
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R at java.lang.NumberFormatException.forInputString(Num berFormatException.java:63)
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R at java.lang.Integer.parseInt(Integer.java:502)
[5/13/14 14:52:19:497 CDT] 00000028 SystemErr R at java.lang.Integer.parseInt(Integer.java:531)

maxlenth.jpg

View Replies View Related

JSP :: Can't Get Local Variable Value In Value Attribute Of Input Tag

Feb 3, 2014

Here, I have just tried out to take a value from the database and storing it into local variable then I want to have that value in the value attribute of <input> tag but somehow, I can't get it..

Here, below is my code..

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL]....">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

[Code]...

View Replies View Related

JRE :: Java DeploymentRuleSet - Force Attribute

Oct 27, 2014

We've implemented the Whitelist and there's an application I need to use the Force attribute with, however, I'm unable to get this to work.  As I read it, this code says use Java 1.6_24 for Example.com and any other applications are blocked from running.  There are three versions of Java installed - 1.6_24, 1.7_65 & 1.8_25.  The Java console shows 1.8_25 being called.
 
Here's the ruleset.
 
<ruleset version="1.1+">  <rule>    <id location=https://example.com />   
<action permission="run" version="1.6_24" force="true" />  </rule>
<rule>    <id />    <action permission="block">     
<message> This application is blocked due to Java restrictions, please contact the Service Desk for assistance.</message> </action>  </rule></ruleset>
 
I also tried

<action force="true" permission="run" version="1.6.0_24" />
and also
<action force="true" version="1.6.0_24" permission="run" />. 

The Java console is still showing version 1.8.0_25.

View Replies View Related

Different Units In Calculation

Sep 8, 2014

I have a maths application I am working on in java. This is more related to maths but there could be some here who have worked with calculations like this in their java project.

One could convert from degree to radians and from mph to knots. Could one convert from knots to degree or from mph to degree?

View Replies View Related

Tax Calculation Program

Apr 9, 2014

use arrays to store taxpayer information. Use methods for tasks that will be repeated.

-Ask the user how many taxpayers he would like to calculate taxes for.
-Ask the user to enter each taxpayer's first name, last name gross income, and number of children.
-Each taxpayer's tax due is computed as follows
-The taxpayer's dependency exemption is determined by multiplying $3,000 times the number of children.
-The taxpayer's net income is determined by taking the taxpayer's gross income and subtracting the taxpayer's dependency exemption.
-If the taxpayer's net income is between 0 and 50,000, the tax due is 15% of net income.
-If the taxpayer's net income is greater than 50,000, the tax due is
-15% of the first 50,000 of net income PLUS
-25% of any income over 50,000
-The tax due can never be less than 0.
-If the net income is a negative number, the tax due is 0

TAXPAYER INFORMATION: output a message in one dialog box which lists the following info for every taxpayer: first name, last name, gross income, number of children, tax due.
AVERAGE TAX: output a message in a dialog box which states the average of the taxes due.
PRESIDENTAL MESSAGE: output a message in a dialog box which says either "We computed taxes for the president. " or "We did not compute taxes for the president." The president's name is Barack Obama.

Here is my code so far

import javax.swing.JOptionPane;
public class AssignmentSeven
{
public static void main (String [] args)
{
String [] taxPayers;
String[] firstName;
String [] lastName;
String message = "";
double[] grossIncome;

[code]....

View Replies View Related

Calculation In Awt Calculator

Jul 10, 2014

I am facing problem during calculation in my awt calculator. It is showing NumberFormatException. Below is part of code.

if(e.getSource()==b14)//On button 14, label is "/"
{
String v1=tf.getText().toString();
num1=num1+Integer.parseInt(v1);//num1 is as integer variable
tf.setText("");//tf means textField
}else

[code]....

View Replies View Related

Java GUI Calculation

Oct 3, 2014

how to do this last calculation. I want the user to input and odometer (in feet) and have it use that and the Duration (in hours) to calculate speed in feet per second. Ive been trying to reference it using various methods but I'm stuck. I have it set as a string but whenever i try to pretty much use somewhat the same formula i did for total time it just gives me errors. How do I use that number the user inputs into a formula with the output of the Duration?

* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication1;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

[code]....

View Replies View Related

JSP :: How To Ignore Or Trim Directive Attribute With Space

Mar 17, 2014

I have the below code with spaces on uri and prefix (directive attribute).

<%@ taglib uri=" news.tld" prefix=" news" %>

how to fix without altering the JSP? Can i handle with web.xml or any other property available.

I have hundreds of jsp like this and wanted to handle without code fixes.

I tried JSP trimSpaces but it fixes the namespace but not the attributes.

View Replies View Related

Servlets :: Determine Which HttpSession Attribute Value Changed?

Feb 15, 2015

I'm looking to figure out if it's possible to do the following:

HttpSession session = request.getSession();
session.setAttribute('name', 'Jane_Doe');
// more code here
session.setAttribute('name', 'John_Doe');

Obviously, you can use the HttpSessionAttributeListener to determine which attribute has changed. However, it doesn't return the new value but rather the old one.

You can use the HttpSessionEvent listener to determine when a session object has been changed.

Is there a way you can determine when a session object changes (and it does NOT occur when the setAttribute method is called...) and determine the updated key:value pair?

View Replies View Related

JSF :: How To Change Rows Attribute Of InputTextarea Dynamically

Feb 13, 2014

i have a field that varies from 10 to 3000 VARCHAR in DB. A field called IDTEXT in a database that can be even a single word or up to a max of 3000. I want to display that in a form. Based on its size i want to very the size of the <h:inputTextarea>. How can i do it..will i be able to set row property from bean?

View Replies View Related

Writing A Calculation For A Program?

Sep 8, 2014

I am writing a program in Java where a user adds 1 stamp on a letter for every five sheets of paper in it (or fraction thereof)For example, I if I have 11 sheets of paper, I add 3 stamps. If the total number of stamps is more than 3, they don't send it.

I need to ask the user how many sheets of paper they have, and then calculate the appropriate number of stamps based on the formula above. I just don't know how to write the math formula to calculate this, i'm stuck. So far I have:

package test;
import java.util.Scanner;
public class LetterMailing {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
int numSheets;

[Code] .....

What should I do next?

View Replies View Related

Netbeans - Calculation In GUI Interface

May 12, 2014

I'm trying to create a GUI interface in Netbeans that calculates a phone bill.

I created a GUI interface that input:
- Account Name.
- Account Number.
- Number of Minutes the phone was used. (with a textarea so the user input the minutes)
- 2 JRadioButtoms so the user can chose the regular or premium service.
- Amount Due (+10% taxes) (also with a textarea)
- Clear/Enter/Result/Done Buttoms

And I need to output:
- Account Name.
- Account Number.
- Number of Minutes.
- Taxes
- Total Amount Due.

I have a couple of math formulas I have to add them to output the above however I'm new to java so I don't know which code to use.

The math formulas are:
-Regular charges = 20 + ( No. Minutes - 50 ) * 0.20
-Premium charges = 50 + ( No. Minutes - 75 ) * 0.50
-Taxes = ( Regular charges + Premium charges ) * 0.10
-Amount Due = Regular charges + Premium charges + Taxes

View Replies View Related

JSP :: How To Pass Attribute Along With Its Value From Servlets To Plain Java Class

Nov 3, 2014

I just want to know how to pass an Attribute along with its value from servlets to a plain Java class. Im using java beans but it's showing null...So as an alternative im using session to access variables in java class..

View Replies View Related

Efficient GCD Calculation And Long For Loops

Jan 23, 2014

My GCD testing:

Java Code:

public static long gcd(long a, long b) {
if(b == 0) {
return a;
} else {
return gcd(b, a % b);
}
} mh_sh_highlight_all('java');

Is there a more efficient way? Also, what can I do to speed this forloop up?

Java Code:

for(long i = 1; i < 750000; i++) { dothis; } mh_sh_highlight_all('java');

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved