JSF :: Viewstate Stored In Session And Values Of Input Fields

Sep 11, 2014

Many times I have read that JSF stores de view state in session and one of the things that are stored are the values of the form fields, right? But these input field values are not stored in session, I mean, they depend of the scope of the managed bean attached to the view. If I have a view and its attached to a view scoped bean with properties for the form fields, the values will dissapear if I go to other view because the bean is view scoped so I cant say the values of the form are stored in session, right?

View Replies


ADVERTISEMENT

Servlets :: Why Objects Stored In Session Should Be Serializable

Feb 5, 2015

Why is it that objects stored in session object should be serializable?

View Replies View Related

Values In Array Not Stored?

Oct 6, 2014

I just forgot to increment n while trying to store the humidity... I do this every time and I suddenly realize what I did wrong ...

My problem is that after printing humidity[n] in the "Humidity(%)" row, it seems that humidity[n] becomes 0. I checked like this:

System.out.println(humidity[5] + " " + humidity[6]);

In the "Humidity(%)" row, they come out fine, but when I do this, they come out as 0, which I think would explain why my heat indices are consistently lower than the temperature when the temperature is over 80.

My code:

import java.util.Scanner;
import java.io.File;
import java.io.IOException;
public class HeatIndex {
public static void main(String[] args) throws IOException {
System.out.printf("%70s", "Heat Index: Key West, Florida");

[Code] ......

View Replies View Related

Sending Values For GUI Fields

Jul 9, 2014

I have a simple class, called InputManager, which has methods that communicate with another class DatabaseManager which has access to Database which is actually object that contains information about actual database.

My JFrame has Navigation class (extends JPanel). There I put all needed JButtons, JLists and so on.. This class has instance of InputManager and when user interacts with GUI components inside of it, Navigation calls InputManager methods, it then analyses the call and calls needed methods on DeviceManager, which then sends queries to Database and etc.

The problem is, that at the beginning (when user runs a program), I want to get information (which is actually values for my GUI components ) from Database. It could, for example, create another DatabaseManager and connect to the Database to get information, but it is okay to have two objects?

I was also thinking about sending same DatabaseManager object through InputManager to Navigation, but it seems strange for me to have two objects, which can interact with each other in both directions(Class A has instance of Class B, and Class B has instance of Class A). Is there anything bad this can do?

Also what I noticed that it seems odd that GUI class would have to get information from database. (Logic in GUI class).

View Replies View Related

Loaded ArrayList But Can't Retrieve Stored Values

Nov 4, 2014

I am creating a shopping list, with each element and object called product from the Item attribute class. Each product object has a description, price, and priority. From user input, I am able to create each product object, and then .add to my arraylist. I know that it successfully adds because I have it printed in each iteration of the do-while loop. Once the user indicates they want to quit, the loop ends. I then want to print each description, price, and quantity but this for loop will only print the last element over and over. Here is what I have:

ArrayList <ItemAttribute> list = new ArrayList<ItemAttribute>();
Scanner keyboard = new Scanner(System.in);
ItemAttribute product = new ItemAttribute();
public void findDescrPrice() {
/**
* Get the item name (description) for each list item

[code]...

View Replies View Related

Get Values From Database And Set Them In Text Fields?

Apr 24, 2014

I have a button in which I need to do the following:

After I click it It reads the values given in a jtextfield1 and in the other jtextfields I need it to settext in them from the database I mean if I have for example id=1 when I click the button it goes to the database and find the id 1 then write the infos in the other textfields

View Replies View Related

Enum Properties / Values / Fields

Jul 11, 2014

So I have an Enum file with 119 constants and each constant of that type has 20 fields that come with it. All the fields are the same type and named the same (e.g. there are 119 of Object obj, one for each constant), and I want to run the same methods over them. Since the Objects of the same type are named the same for each constant, I just have them named explicitly in get-er methods.

This worked fine when I just put all 20 fields through the constructor and set them as fields under all the constants. But I realized that if I wanted to make an instance of this Enum class, I'd have to enter in all 20 fields when they are all a set of Objects with unique values. So I then put them as fields under their own respective constant to make it easier to create instances of this enum. But now my methods don't work.

A) I don't really understand why they don't work anymore?
B) Is there a way to fix it without putting all the methods under each constant?

Example:

public enum MyEnum {
AAA {
private MyObject obj = new MyObject (3.0);
},
BBB {
private MyObject obj = new MyObject (1.5);
},
CCC {
private MyObject obj = new MyObject (6.5);
},
DDD {
private MyObject obj = new MyObject (3.5);
};

public double getObjVal() {
return obj.value(); // it can't find this obj should I move it up to where the constants are declared?
}
}

View Replies View Related

Test Values Stored In 2D Arrays - Program Keeps Looping

Jan 13, 2014

I am trying to test values stored in 2d arrays once but i my program just keeps looping what am i doing wrong

Java Code:

tempi=i;
tempx=x;
for( i=0;i<3;i++) {
for( x=0;x<4;x++) {
if(rounded[i][x]<395 || rounded[i][x] >405) {
System.out.println("there is an error with probes "+rounded[i][x]);

[Code] .....

View Replies View Related

Fields Won't Hold Value Given Through Input?

Oct 18, 2014

At the end of my main method, I want it to print out the input given that should have been stored in my sandwich class fields, but it didn't.

import java.util.*;
import java.lang.*;
public class SandwichBuilder {
public static void main(String[] args) {
Scanner inputDevice = new Scanner(System.in);

[Code] .....

View Replies View Related

Modify Values In Fields In Serializable Object Using Objects Set Methods Java

Dec 10, 2014

This program is basically complete. It compiles and runs. It is a college course assignment that I pretty much completed but for the last part in which I'm suppose to change the values of all fields and display the modified values using a toString method. Modifying the values of the fields is where I am stuck. I don't think I need to create a new text data file to do this. The instructor only asked that all the values of fields be changed and this was the last part of the assignment so I don't think it involves creating additional ObjectOutputStream and ObjectInputStream objects. I'm getting a NullPointerException error on line 161.Here is the code. I'm also including the input data file.

//create program so that objects of class can be serialized, implements interface Serialiable
//create constructor with 4 parameters with accompanying get and set methods, Override toString method
//create text file with 5 records, create Scanner object,ObjectOutputStream, and ObjectInputStream
//create new ItemRecord object, change values of all fields in ItemRecord object using object's set methods
//modify ItemRecord object using toString method

[hightlight =Java]import java.io.Serializable;
public class ItemRecord implements Serializable

[Code] .....

This is the error message:

----jGRASP exec: java ItemRecordReport

Item Cost Quantity Description
Number
A100 $ 99.99 10 Canon PowerShot-135
A200 $149.99 50 Panasonic-Lumix T55
A300 $349.99 20 Nikon- D3200 DSRL
A400 $280.99 30 Sony- DSC-W800
A500 $ 97.99 20 Samsung- WB35F
Exception in thread "main" java.lang.NullPointerException
at ItemRecordReport.main(ItemRecordReport.java:161)

----jGRASP wedge2: exit code for process is 1.
----jGRASP: operation complete.

Here is the data file:
A100 99.99 10 Canon PowerShot-135
A200 149.99 50 Panasonic-Lumix T55
A300 349.99 20 Nikon- D3200 DSRL
A400 280.99 30 Sony- DSC-W800
A500 97.99 20 Samsung- WB35F

Here is the data file for the modified field values.
B100 98.00 10 ABC1010
B200 97.00 15 DEF1020
B300 96.00 10 GHI1030
B400 95.00 05 JKL1040
B500 94.00 01 MNO1050

View Replies View Related

Text Fields - Input String Character S

Aug 24, 2014

What should be the code if i want to input a different string in case of the typed string. The case is : I have a predefined string S = "Peter,please answer my question" and now when i input another string inside the text field character by character i want characters from the string S to enter instead of the input string. In short, the input string should be disguised as string S.

View Replies View Related

JSP :: Losing Session Values During Redirect?

Mar 30, 2014

I am trying Single signon to a different application from my application. i use redirect to open the new URL in a separate window. MY single signon works well. But i am losing the session values in my application.

Because of this when i close the new window and click on any link in my application, i am getting error sicne all application objects inside session are reset to null. how to retain the session values after Redirect.

View Replies View Related

Swing/AWT/SWT :: Creating Text Fields / Labels And Input Boxes On GUI

Oct 18, 2014

How to create text fields, labels and input boxes on a GUI, we haven't covered these in class as of yet, but I want my project to stand out so I'd like to know how to build a GUI now.

View Replies View Related

Edit User Information By Bringing In Input Fields From Database Using JSP

Jul 11, 2014

I can insert data in database, delete aslo using JSP. But facing problem while updating the information saved in database as m using MySQL 2008. I want to see the bring saved in database with particular username into the updateinfo.jsp form.

View Replies View Related

Variable Fields Are Not Holding Information Through Constructor From User Input?

Oct 19, 2014

Variable Fields are not holding information through constructor from user input so here's what I did instead.

View Replies View Related

JSP :: How To Differ Between Fields That Not Exist To Fields That Are Null

Dec 7, 2014

how to differ between fields that are not exists to fields that are null? because in my api when someone wants to delete a field he sends null instead of a value. and if he doesnt want to effect this feild he doesnt send it.

{
"a" : {"1","2"},
"b" : "hello"
}
{
"a" : null,
"b" : "hello"
}
{
"b" : "hello"
}

View Replies View Related

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

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

Reading File Input - Display All Values

Apr 8, 2014

I've been trying to learn how to read in file input and have a question about this piece of code:

Java Code:

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;
public class readFile {

public static void main(String args[]) throws FileNotFoundException{
File file = new File("file.txt");
int sum[]=new int[5];
int i=0;

[Code] .....

"file.txt" holds the following information:

1
2
88
42
56
89

But my output looks like:

2
42
89

if I take out sum[i]=input.nextInt(); it will display all values in the file.

View Replies View Related

How To Input BigInteger Parameter Values Using JConsole

Jan 9, 2015

I am trying to test my JMX bean in JConsole.  How do I input BigInteger parameter values using JConsole? It appears to want a numeric value, but everything I have tried results in an IllegalArgumentException saying there is a ClassCastException.

View Replies View Related

Print Maximum And Minimum Values Of Integers From User Input

Apr 27, 2015

So I'm learning java from a website and I was tasked with creating a simple program which allows the user to enter a series of integers, then finally when they decide to input a non-integer the program will print the maximum and minimum values of the integers they entered. So for example if they entered 5, 4, 3 and 2 then enter a non-integer the program would output 5 (maximum value), then 2 on a new line (minimum value).

Here is my code:

import java.util.Scanner;
public class MaxMinPrinter {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;

[Code] ....

And this is what the output looks like:

Actual output
-------------------------------------------
Enter an integer: 5
- 10
-
- Enter an integer: -4
- 8
- -6
-
- Enter an integer: 11
- -1
-
- Enter an integer: q
- -1
- -6

When it's supposed to look like this:

Expected output
-------------------------------------------
Enter an integer: 5
Enter an integer: 10
Enter an integer: -4
Enter an integer: 8
Enter an integer: -6
Enter an integer: 11
Enter an integer: -1
Enter an integer: q
11
-6

View Replies View Related

Unable To Match Input String With Range Of Values And Getting PatternSyntaxException

Jun 12, 2014

I am trying to match the input string with range of values and getting PatternSyntaxException. below is my code

public static void main(String[] args) {
String regex="01[4-6]";
String code="015";
boolean bool=code.matches(regex);
System.out.println(bool);
}

output: true

But when i try to give range in double digits, it throws exception. What if i have to match a number(as string) between 10 to 25 or like that.

public static void main(String[] args) {
String regex="0[14-16]";
String code="015";
boolean bool=code.matches(regex);
System.out.println(bool);
}

Output:

Exception in thread "main" java.util.regex.PatternSyntaxException: Illegal character range near index 5
0[14-16]
^

View Replies View Related

Program That Read Sequence Of Input Values And Display Bar Chart

Oct 21, 2014

Write a program that reads a sequence of input values and displays a bar chart of the values, using asterisks, like this:

********************** **************************************** **************************** ************************** **************

You may assume that all values are positive. First figure out the maximum value. That value's bar should be drawn with 40 asterisks. Shorter bars should use proportionally fewer asterisks.

import java.util.Scanner;
import java.util.ArrayList;
import java.util.Arrays;
public class Array717
{
public static void main( String[] args )

[Code] ....

The problem is that all this code does is print 1 line of *'s and what seems to be thousands of them

View Replies View Related

Java And Exception Handling - Calculate Sum Of Squares (Input Values)

Jun 19, 2014

I know I can calculate the sum of squares as such:

// SumSquares.java: calculate the sum of two squares
class SumSquares {
static int sumSquares(int a, int B)/>/> {
int asquare;
int bsquare;

[Code] .....

But how can I modify the code so that it inputs a list of integer values in the range of -100 to 100 from the keyboard and computes the sum of the squares input values. And how would I go about using exception handling to ensure that the input values are in range and are legal integers.

View Replies View Related







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