JSP :: Possible To Update The List?

Mar 18, 2015

I have arraylist which is already set in controller side.

I need to update the same list(removing few elements in the list) in jsp based on few conditions like, the selected values in dropdown kind off.

How to update the list in jsp?. Is there any way to handle this using JSTL?.

Instead of using scriptlets, can i do this?

View Replies


ADVERTISEMENT

JavaFX 2.0 :: Update Observable List From Database At Certain Time Intervals Using Threads?

Dec 9, 2014

i have a table UI and want it to be to be in sync with tabledata in the database... How can i go about it?

View Replies View Related

JavaFX 2.0 :: Modifying Item In Observable List Doesn't Update ListView

Oct 3, 2014

I am using:

Java:..... 1.8.0_20JavaFX:... 8.0.20-b26 

I have this class:
 
public class Person {
    private SimpleStringProperty name;
    public SimpleStringProperty nameProperty(){
        if(this.name==null){
            this.name=new SimpleStringProperty();

[Code] .....

I have this:

lista = FXCollections.<Person>observableArrayList();
lista.addAll(new Person("uno"),new Person("due"),new Person("tre"));
myListView.setItems(lista);

The problem is if I add /remove an item all is fine, the listView refreshes correctly:

Person p = new Person(tfld_textAdd.getText());
lista.add(0, p);
 
But if I change a value on an item into the observable list it doesn't:

lista.get(0).setName("new value");
 
I also have a table linked in the same way and the table workd correctly after I updated my Java version...

View Replies View Related

Java Array Update Without Using ArrayList - Add Values And Update Size?

Feb 9, 2015

I am trying to create an array list without using the built in arrayList class that java has. I need to start the array being empty with a length of 5. I then add objects to the array. I want to check if the array is full and if not add a value to the next empty space. Once the array is full I then need to create a second array that starts empty and with the length of the first array + 1.

The contents of the first array are then copied into the new array without using the built in copy classes java has and then the new array ends up containing 5 elements and one null space the first time round. The first array is then overwritten with the new array containing the 5 elements and the null space. The process then starts again adding values until the array is full which will be 1 more value then recreating the second array empty and the length of the first array + 1. This is my attempt at creating this but I have run into multiple problems where I get only the last value I added and the rest of the values are null:

public class MyArrayList {
public Object arrayList[];
public MyArrayList(Object[] arrayList) {
this.arrayList = arrayList;

[code]...

View Replies View Related

JSF :: Update Action Does Not Update Bean Attribute

May 14, 2014

I have a strange behaviour when trying to update a bean. Here is the edit page:

<h3>Edit Post</h3>
<div class="row">
<h:form>
<div class="small-3 columns">
<label for="right-label" class="right inline">Title</label>

[Code] ....

Here is the bean class:

package com.airial.controllers;
import com.airial.domain.Post;
import com.airial.service.PostService;
import com.ocpsoft.pretty.faces.annotation.URLMapping;
import com.ocpsoft.pretty.faces.annotation.URLMappings;
import org.springframework.beans.factory.annotation.Autowired;

[code]...

postToUpdatet is always NULL. Why the title property is not binded ? What is wrong here ?

View Replies View Related

Sort Linked List Through The Nodes Of List - Data Of Calling Object

Feb 14, 2014

I have some class called sorted to sort the linked list through the nodes of the list. and other class to test this ability, i made object of the sort class called "list1" and insert the values to the linked list.

If i make other object called "list2" and want to merge those two lists by using method merge in sort class. And wrote code of

list1.merge(list2);

How can the merge method in sort class know the values of list1 that called it as this object is created in other class.

View Replies View Related

How To Append New Entry In A List Of 100,000 Names Without Iterating List Each Time

Apr 22, 2015

I have a list of 100,000 + names and I need to append to that list another 100,000 names. Each name must be unique. Currently I iterate through the entire list to be sure the name does not exist. As you can imagine this is very slow. I am new to Java and I am maintaining a 15+ year old product. Is there a better way to check for an existing name?

View Replies View Related

Unable To Filter A List And Then Assign Results To New List

Dec 30, 2014

I receive a java.lang.NumberFormatException: For input string: ""DepDelayMinutes"" error when trying to filter a list and then assign the results to a new list.

I have edited the code so it is an int that throws the exception so it isn't the presence of a string that is causing the error - java.lang.NumberFormatException: For input string: ""0914"" .

I believe the issue is because of the two sets of double quotes but I do not understand how they came about. The original dataset does not have any quotes whatsoever.

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Predicate;
import java.util.stream.Collectors;

public class FilterObjects extends Thread{

[Code]...

View Replies View Related

Iterating Over List And Inserting Each Element From List Into BST?

Jul 5, 2014

Suppose i have given a List<Intervals> list; I am iterating over list and inserting each element from list into BST, if time require to insert into BST is logn then what is the total time require to insert all the elements into tree ?

logn or nlogn ?

View Replies View Related

Linked List Implementation Of List Interface?

Oct 5, 2013

So we have an assignment regarding a linked list implementation of a given list interface.

In my list interface, the method contains(T anEntry) is defined.

In the LList implementation, contains is already implemented as part of getting the core methods in.

Now I am being tasked with the following:

Provide a second implementation of the method contains2(T anEntry) that calls a private recursive method

Private boolean contains (T anEntry, Node startNode) that returns whether the list that starts at startNode contains the entry anEntry.

I've written the private recursive method already. That's not an issue (at least not right now).

But what I don't understand is how startNode is supposed to be populated when this private contains method is called from the public contains2 method? contains2 only takes one parameter: anEntry. the private method takes two parameters: anEntry and startNode. How am i supposed to provide startNode when I am calling contains2?

View Replies View Related

Update XML Using DOM Objects

Sep 29, 2014

I have a requirement to insert the data into xml file . I have used DOM class for doing this. Below is my xml file

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<deployments>
<applications>
<application>
<name> PCMH</name>

[Code] ....

The thing is if SITA is the name then I have to insert component to the particular envi tabs , if DEVB is the component I have to insert the component there. How can I do this I have done some code its inserting the data at the bottom og the XML .

View Replies View Related

JSP :: Update Database Values?

Jan 4, 2015

I am trying out jsp and servlets now for the first time. I have to insert two data, car code and car name into a mysql table. I got those details using jsp but if I use form, it redirects to another page for insertion. I want the data to be inserted and still remain in same jsp page. I am thinking of using onClick from javascript but as I googled this many places have said it is a bad idea to use jsp inside javascript. If so how can we insert data to mysql table without redirecting to another page?

View Replies View Related

EJB / EE :: Update Same Table From Different Applications?

Feb 18, 2014

I have two separate applications who will access the same table in a database and the two application will update the table.

How can I make sure the integrity of accessing this table? Is it in the code or in the database level?

View Replies View Related

Private JTextField Update

Jan 22, 2015

I am creating a slot machine using eclipse. I am trying to get the "winnings" JTextField to be updated in a way so that when the random images have been selected it adds to the number that is already displayed in the JTextField as opposed to what it is doing at the minute which is just displaying how much was won on that particular spin. I am also struggling to set a code for when noting is won, nothing is added. My code is below.

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.util.*;
import javax.swing.Timer;

[Code] ....

View Replies View Related

Java GUI Search And Update

May 15, 2015

I'm trying to make a update page where you search for person info by their number then have the ability to change any info and save it back to the binary field. I have the search working but i don't know how to do the update,.here my code:

Java Code: import javax.swing.*;

import java.awt.*;
import java.awt.event.*;
import java.io.EOFException;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

[code]....

View Replies View Related

JSF :: Edit / Update Row Of Datatable

Jan 23, 2014

I am implementing code of edit/update row of datatable in jsf.

package org.demo;
import java.util.ArrayList;
import java.util.Arrays;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name="order")
@SessionScoped

[Code] .....

View Replies View Related

EJB / EE :: Cannot Add Or Update A Child Row When Using EmbeddedID

Jan 1, 2015

I have the following objects:

User Object:

public class User implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(unique = true, nullable = false)
private int id;

@OneToMany(fetch = FetchType.EAGER, mappedBy = "user", cascade = CascadeType.ALL)
private List<UserReason> userReasons;
....

Code :

public List<UserReason> getUserReasons() {
return userReasons;
}
public void setUserReasons(List<UserReason> userReasons) {
this.userReasons = userReasons;
}

public UserReason addUserReason(UserReason userReason) {
if (userReasons == null) {
userReasons = new ArrayList<UserReason>();

[Code] ....

I want to be able to add userReason to the list, and that Hibernate will automatically update the reference between the parent & child object.

When using the above code, when trying to start the server, i'm getting the error message:

Repeated column in mapping for entity: com.commit.safebeyond.model.UserReason column: userId (should be mapped with insert="false" update="false")

Please notice that i mapped the userId in UserReasonPK with insertable = false, updatable = false.

If i change it, and add this on the User property in UserReason object, server is up, but when trying to insert new User I'm getting the following error:

Hibernate: insert into UserReasons (reasonId, userId) values (?, ?)
WARN 2015-01-01 13:25:17,488 [http-nio-8080-exec-2] org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 1452, SQLState: 23000
ERROR 2015-01-01 13:25:17,488 [http-nio-8080-exec-2] org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Cannot add or update a child row: a foreign key constraint fails (`SafeBeyond`.`UserReasons`, CONSTRAINT `FK_UserReasons_Users` FOREIGN KEY (`userId`) REFERENCES `Users` (`id`))

[Code] ....

View Replies View Related

Pong Game Won't Update

Apr 19, 2014

I'm a beginner at java and am trying to code a basic pong game java applet. The code has no errors in it but when i run it the .png's do not come up in the window until its moved off screen. when the .png's are shown they do not update whatsoever. I thought the problem could be with the key-listener but even the ball (which moves independently of user input) does not move.

I've placed all the code from the 5 classes below. There's some unnecessary code in the background class but that's because I'm thinking of making the background scroll later on.

package main;
 import java.applet.Applet;
import java.awt.Color;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.net.URL;

[Code] ....

View Replies View Related

Authenticate Update Request

Nov 24, 2014

I'm always receiving update requests from numerous vendors.  How can I confirm that an update request from Java is authentic?

View Replies View Related

Unable To Update BorderPane?

Dec 28, 2013

I have the below snipped of code that is giving me problems. The code is called when the user clicks on the "NEXT" button of the form. Why despite getting into the Lines 41-45 I am not able to update the BorderPane? Lines 30-39 appear to work as expected.  In the case below there are 3 entries within the TreeMap.  You can see this within the Output provided by NetBeans shown below.
 
NetBeans Output
Next Button Clicked.
1 => BorderPane@5bee8c9b                   <----------- Entry 1
Next Button Clicked.
1 => BorderPane@5bee8c9b                    <----------- Entry 1
MATCH!
2 => BorderPane@e857ac                        <------------ Entry 2
UPDATING! BorderPane@15d3ddab          <------------ Entry 3
Cancel Button Clicked.

[Code]...

View Replies View Related

Add To List With ID Makes List Upside Down

Feb 14, 2015

I saved the content of an ArrayList<SomeClass> to a file

I write each serialised object to the file by adding to each an id that is created with list.indexOf(object) (and saved before each object)

So I can repopulated the list with SomeClass objects in the same order as they were and once I reload the file, I do list.add(id,object)...

Well my list is populated upside down, I mean the first object is the last and the other way around, If i remove the id when I do the add(object)...

View Replies View Related

Alternative To Update Passed Arguments?

Apr 22, 2015

I am writing a simple program in Java, where I call a method and pass some variables (namely, min and max) as arguments. This method is recursive, so the same arguments are again passed on in each recursive call.

I need to update these variables in recursive calls so that when the calling method uses them, it uses updated values. As it might sound confusing, here is sample code :

// Function 1.
void func1() {
//Call func2.
func2 (int hd, int min, int max, Map<String, String> map);
//Other stuff.
}
// Function 2.

[code]....

As you can see, min and max are updated after each recursive call returns, based on conditions. However, these changes aren't reflected in original min and max, which were used by func1 while calling func2. As far as I know, this happens due to call by value mechanism being used by Java while passing arguments. If I declare min and max as instance variables in the class, my problem is solved. But, I want to know whether there's any other way to update these variables so that changes in original min and max are reflected. Yes, I can return them as an array of 2 elements each time while returning, but it didn't seem a good solution to me.

View Replies View Related

JSF :: Using Merge Method To Update DB Record

Apr 25, 2014

So I have two related tables - Country (Master) Projects (Detail). Country has a OneToMany relationship with Projects. I put a link on my AllProjects.xhtml page. When tyhe link is clicked it uses a data model class to to display the current (clicked) project record (projectRecord object). After editing all the details, the UPDATE button calls a merge method in the DAO class. On the first attempt to update, nothing happens and the record is returned as it is with no errors. If I try updating again, I get:

Error Code: 1062
Call: INSERT INTO projects_beta2b_projects_beta2b (projects_PROJECTID) VALUES (?)
bind => [1 parameter bound]
Query: DataModifyQuery(name="projects" sql="INSERT INTO projects_beta2b_projects_beta2b (projects_PROJECTID) VALUES (?)")

[Code] .....

My classes are:

projects.java

@Entity
@Table(name = "projects_beta2b")
public class Projects implements Serializable {

@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int projectid;
private String projectName;
private String client;

[Code] ...

Is the 'new' keyword in the entity class causing the Inser statement in the DAO because the JPA thinks I want to create a new object therefore invokes INSERT instead of UPDATE?

View Replies View Related

Swing/AWT/SWT :: How To Update Image In Java GUI

Jul 10, 2014

I have a GUI with several buttons and I'm using NetBeans GUI Builder to do. At the click of one of these I would like for it to open another frame containing a picture. So I associate a listener (actionPerformed) the button and when clicked it opens actually post the new frame.

In the new frame I waxed a JLabel and then I associate the image of the label. I saw that to do that NetBeans generates this code:

label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/img/tree.png")));

My problem is that the picture is overwritten several times during the execution of the program is not changed yet in the frame. That is, in the new frame is always displayed an old version of the image.

I have an image that is created every time I click on the button (it always has the same name and same path). Basically I have a generic tree on which I perform the operations (add, remove, etc..). When I click on the button I call a method that generates the image of the tree (using Graphviz). So I have one image that changes over the time...

How can I do so that the image is always up to date?

The Code:

package View;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
public class AlberoIpotesi extends javax.swing.JFrame {

[Code] ....

View Replies View Related

How To Send Patch To Update A Program

Mar 21, 2014

Lets say I have a program that is not in any way connected to the Internet. I post it for for downloading, but I know that I will need to update it fairly often. I don't want people to have to redownload the entire program, I just want to send out a patch to update it. How can I do this?

View Replies View Related

Hot To Get A Swing Timer To Update At Different Times

Apr 27, 2014

I'm working on a space invades game and I have a swing timer set up to update the score(number of aliens killed) and for the aliens to shoot. I'm trying to get the score to update at say 100 ms, but the aliens to shoot at 3200ms. I tried to use 2 timers one for the aliens, and one for the score,but the aliens would just use faster score timer.

import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;

[Code]......

View Replies View Related







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