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


ADVERTISEMENT

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

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 :: 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 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

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

Android TextView Doesn't Update

Jul 17, 2014

I am trying to present the user with a response of 'correct' or 'incorrect'. I do the following, but mResultTextView never updates.

mResultTextView.setText("Correct");
android.os.SystemClock.sleep(1000);

I think the problem is that my view needs to be re-drawn.

package com.example.quiz;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;
import android.graphics.Color;

[code]...

View Replies View Related

JFrame Reload After MySQL Update

Apr 22, 2014

I've got a similar problem like here: URL...

private void btnAktualisierenActionPerformed(java.awt.event.ActionEvent evt) {
if(sql.conOK) {
tabelle.table.tableChanged(null);
tablePanel.remove(scrollPanel);
// The following fetches the new database data and adds the new jFrame
tableExists = false;
this.getTable();
tabelle.setOptions();
}
else
lblStatusCon.setText("Bitte zur Datenbank verbinden.");
}


this is what I've been doing. It shows only the new jTable when I resize the window.

View Replies View Related

Swing/AWT/SWT :: How To Update The Table On Screen

Mar 11, 2014

I'm writing my first bigger program (mysql connection and the first thing bigger than 300 lines ). What I'd like to do is to render data from MySQL using JTable - I managed to handle all the queries but I don't know how to update the table on screen. I've tried to use repaint() but nothing happened. I'm not posting whole code because you'll probably not interested, below are the most important things. I thought about using TableModel but how.

public class Main implements ActionListener{
JTable table;

public Main() {
JFrame frame = new JFrame("Frame");
frame.setLayout(new FlowLayout());
frame.add(table);

[code]...

View Replies View Related

Swing/AWT/SWT :: Remove Data From A Row And Update It

Sep 2, 2014

I have a client server application. The UI for the server contains a JTable and in each row, details of the connected client are shown. Say if I have 5 connections and the 3rd connection disconnects, I need the 4th and 5th connection details to be displayed in 3rd and 4th row respectively. Can this be done?

View Replies View Related

JDBC Update Exception - Too Few Parameters

Jul 22, 2014

So, first i search the id from table and all the fields are filled as in the screenshot. then i modify in the text boxes and click on button modify but exception comes-too few parameters. expected 6.

here is the code:

try
{
JOptionPane.showMessageDialog(null,"Record succefully modified!
ID is "+id.getText()+" Password is "+lname.getText());
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection("Jdbc:Odbc:Employe eDB");
String str0=id.getText();

[Code] ....

View Replies View Related

Sequential Read With Update To Status Flag?

May 20, 2014

Reading a sequential flat file (which is working) but now I need to add code to update the status flag (setting it to ‘Y’ position(7,1)) before I close the file and not sure how without defining the fields.

try
{
tFile = getTFileName();
System.out.println("File Name: " +tFile);
ukarf = new ZFile(tFile, options);
while(!EOF) {
int bytesRead = ukarf.read(buffer);
System.out.println("Record read: " +new String(buffer,0,9,"IBM-1047"));
if(bytesRead == -1)

[code]....

View Replies View Related

Swing/AWT/SWT :: Which Event Is Generated When Scrollbar Update

Jan 1, 2015

Which event is generated when a scrollbar is update?

View Replies View Related

JSF :: Update View By Running 2 Concurrent Processes?

Feb 13, 2014

What I am attempting to do is execute a long-running process and iterate over it multiple times. I'd like my page to update with the progress in between each run. What I have tried so far is using a HttpSessionAttributeListener and executing my long-running process from there and using my ViewScoped bean along with richfaces a4j:poll to update my page. Unfortunately no matter what method I try with a listener, the completion of the Partial JSF lifecycle always blocks until my listener method is through processing. So we go from start to finish with no updates in between.

I have which is to just have my view re-submit itself and try updates that way. But before I go that route I wanted to see if there was a way to do what I was originally attempting and I'm not just missing something.

View Replies View Related







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