JSF :: Saving 2 Times One Form
Feb 22, 2014
I'm trying to save to a table in a database that has only 2 fields, (id, nota) . I want to save the data several times just to click on "save" one look . The code that I have is this:
<h:form id="frmPerso" style="font-size: 13px;">
<h:outputText value="Id 1" />
<h:inputText value="#{vistaEjem.notas.id}" />
<h:outputText value="Nota 1 " />
<h:inputText value="#{vistaEjem.notas.nota}" />
[Code] ....
I was told to use a foreach or for the insertDatos, but not as used..
View Replies
ADVERTISEMENT
Jan 8, 2015
I want to understand how is it possible to send data (image + text) along a single form. Here is my code:
<form method="post" action="updateAccount"
encType="multipart/form-data">
<input type="file" name="file" value="Select image ..." /> <input
type="submit" value="Start Upload" /> <br>
<textarea rows="8" cols="54" name="about">Yes
View Replies
View Related
Jun 6, 2014
import java.util.Scanner;
public class Exercise1{
public static void main(String[] args) {
String employeeName, employeeNumber, position, department ;
double otpay, salary, deduction, hrs, rate ;
Scanner input = new Scanner (System.in);
[Code] ....
That's my codes but its wrong according to our prof. it should be in frame form. i don't know how to do it since i did not encountered framing since i was started in java.
View Replies
View Related
Jan 29, 2015
I have a form containing several fields, 2 of which persist to different table in a database than the rest of the fields on the form. I have no problem persisting the data into both tables of the database, and after the form is submitted I reset the form to its default values. That all works fine.
But in the same session, when I open another form (a search form) and enter search criteria, which then displays a datatable containing the search results, those 2 values that are persisted to another table are not showing up, but the rest of the data is.
Here is the method that calls the persist methods:
@ManagedBean(name = "foreignPartyController")
@SessionScoped
public class ForeignPartyController implements Serializable {
...
public void saveData() {
[Code].....
The values do show up, but the problem is, when a subsequent form is opened in the same session (e.g. a search form) the field for that value shows the actual value, instead of the field being blank.'
I am not sure why the data from the one database ("parent") is showing up, yet the data from the other database ("child") is not.
Is it something I am doing wrong? I thought by setting the setter in the child controller class back to a new instance of the Entity class (PolicyPayment) that it would reset the form to default values, but at the same time retain (or save) the inputted values in the same session.
View Replies
View Related
May 8, 2014
I have a button on UI which adds messages and when the user clicks on it the form gets submitted, meanwhile the user is clicking on refresh(F5) multiple times which is causing the same message to be displayed multiple times. To resolve this , I am converting the form from a synchronous submit to Asychronous but it is still not working. Below is the code:
Code before:
<td><input class="buttonred" type="submit" value="Confirm Add" name="submit_message"></td>
<s:form action="upd-message" method="POST" validate="true" onsubmit="validateMsg();return false;" enctype="multipart/form-data">
function validateMsg() {
var frm = document.forms["upd-message"];
frm.actionType.value=message;
[Code] .....
View Replies
View Related
Feb 28, 2014
How do i post php form contents to a jsf form?
View Replies
View Related
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
Jul 30, 2014
What I am trying to do is save the the content drawn to my screen as an image. The following code is my render method and although I know how to use it, I don't fully understand the classes and how they work with is making this difficult.
public void render() {
BufferStrategy bs = this.getBufferStrategy();
if (bs == null) {
createBufferStrategy(3);
return;
[code]....
View Replies
View Related
Apr 13, 2014
Is there any way to save variables while I'm using applet as single runnable .jar file?
For example if I start app first time some variable has value of 100. While using app it changes to 200. After closing app it disapear and next run gives me 100 again instead of 200. Is there any way to save that 200?
View Replies
View Related
Oct 1, 2014
I am learning FileIO and I am having an ArrayIndexOutOfBoundsException for the following code and I am unsure why...
import java.io.*;
public class ArrayWriter {
public static void main(String[] args) {
PrintWriter fout = null;
int[] data = new int[10];
for(int i = 0; i<data.length; i++) {
data[i] = (int)(Math.random() * 101);
[Code] ....
View Replies
View Related
Sep 18, 2014
So I'm still learning how to save data using Java. I know that saving data is extremely important when it comes to creating video games.
What I have here is this simple program.
Java Code:
import java.util.*;
import java.io.*;
import java.lang.*;
public class Character
{
private Formatter x;
private int roomNum;
private boolean[] visited = new boolean[10];
[Code]...
I'm trying to make sure that after I exit the program, joe starts in room 4, not room 1, and that he has visited rooms 1, 2, 3, 4, and 10. I have the save data created, but how do I save an array of boolean values?
View Replies
View Related
Mar 3, 2015
recently I was playing a lot in Eclipse, testing util classes, randomisation etc. But always when I wanted to keep something for future reference, I had to either comment it out or start a whole new class, copy all the code and change just that little thing I was testing.I was wondering if it's possible to actually save just the 'current state' of the code. The idea came back from my days when I was working with 3ds max and I saved the scene periodically so I could revert back anytime I messed up something.
I was looking into Object Serialisation and JUnit testing for this purpose, but that's just too complicated. Is there a way in Java (Eclipse) to accomplish such thing?
View Replies
View Related
Oct 27, 2014
I was able to create the txt file. How to get it to output my code. I know it's an object and it is a way to save data.
package multiplicationFile;
import java.util.Scanner;
import java.io.*;
public class Multiplication {
public static void main(String args[]) throws IOException {
PrintWriter outF = new PrintWriter("multiplications.txt");
[Code] ....
View Replies
View Related
Jun 16, 2015
I need to know how to save input as a variable for later use. Here is the code so far:
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;
public class TextGUI extends JFrame{
public TextGUI(){
super("Text Test");
setLayout(new FlowLayout());
[Code] ....
View Replies
View Related
Jan 21, 2014
I am trying to save the data a person enters to a file. See code below. It is compiling however the file created only shows largest =89, i want the file to show all the data a person enters.
import java.util.*;
import java.io.*;
public class LargerOfThree3{
public static void main(String args[]){
Scanner in = new Scanner(System.in);
[Code] ...
View Replies
View Related
May 21, 2014
How to save a date entered by the keyboard?
View Replies
View Related
Mar 25, 2014
I have the following
Java Code: list.stream().sorted((s, s1) -> s.getName().compareTo(s1.getName())).distinct(); mh_sh_highlight_all('java');
I want to save the results to a collection.
I saw an video tutorial on these by Oracle learning library and they mentioned an into(collection) method but I looked at the api and there isn't one.
How can I do it?
View Replies
View Related
Nov 25, 2014
in my web.xml the.STATE_SAVING_METHOD setting is server
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>
for measurement of application security isn't not allow to change this parameter to client , so the problem when I access for application and I open a new page via linker for print for example and I would access for my initial page to make change or modify my initial page it s no possible to make any modification because I have a empty bean , but if the state saving is a client I haven't a problem because a tree map is stored in client browser, so my version of JSF is 1.1.1 ,
View Replies
View Related
Nov 2, 2014
I have a simple project to save data to the database. I have successfully mapped the java class with the database table. The code displays no error, it runs very well but it does not save to database, instead it catches an exception and prints out "saving failed". The database is a mysql database.
This is the managed bean code. Save.java(name=bean)
//imports
@ManagedBean(name="bean")
@RequestScoped
public class Save {
private String username,password,msg;
Session session = null;
Transaction transaction = null;
//GETTERS AND SETTERS
public Save() {
[Code] ....
This is a screenshot of my Hibernate configuration file : hb.jpg
View Replies
View Related
Apr 6, 2015
I am trying to make a program where a user can enter guests name for a hotel, the JTable includes rows for the name of the tenant, the room number, month etc.
I've made the table, however I am having some trouble in saving the data that I put into the table. I used jtextfield and a jbutton to but data into the jtable. I am trying to save the data, and load it just buy clicking a button.
table.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"Room", "Name", "Month", "Payment"//table rows
}
));
This is my basic table. And what I'm trying to do to save the data is:
DefaultTableModel model = new DefaultTableModel();
private JFileChooser myJFileChooser = new JFileChooser(new File("."));
private void saveTable() {
if (myJFileChooser.showSaveDialog(null) ==
JFileChooser.APPROVE_OPTION ) {
saveTable(myJFileChooser.getSelectedFile());
[Code] ....
When I run my program, I'm able to click on a button, and the dialog box will appear, I'm also able to save the data to a file. However when I click on the retieve data button I made the dialog box opens, the file is there, however when I click it, nothing happens.
View Replies
View Related
Dec 4, 2014
I have created this project and want to be able to add new members to my members arraylist, store the input in a .txt file and load the new members after closing and opening the program.
[URL] .....
View Replies
View Related
Apr 16, 2015
I have a file that has the following text in it:
# Main configuration file for DEDServer
# Starting resource values
startingGold=1000000000
startingElixir=1000000000
[Code] ....
View Replies
View Related
Jul 16, 2014
The Table Model
package presentation;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import javax.swing.*;
import javax.swing.table.*;
import java.awt.*;
import business.*;
public class BgTableModel extends AbstractTableModel
[code]....
View Replies
View Related
Jul 16, 2014
I've tried everything but in vain..I want to save the data from the table into the database, I can easily connect to the database. All I want is how to get the values from the table. I've tried this method to get the values but its not working because of the contructor error in the BgTableModel class.
Tried Method
public void writeBgEdu() {
int last=gtm.getRowCount();
System.out.println(last);
for( int i=0;i<last;i++) {
if(((String) gtm.getValueAt(i,0))!=null)
[Code] .....
View Replies
View Related
Dec 7, 2014
Everything compiles but doesn't work like it should. What the idea is, is to be able to add class personnel objects and have them saved in a file, so that later on i would be able to see them.
Back to my problem: When i create a new "Personnel" and try to run Write and read, to see if my new "Personnel" is added to the list, it's not there at all... what do i do wrong?
import java.io.*;
class Personnel implements Serializable
//No other action required by Serializable interface.
{
private long payrollNum;
private String surname;
private String firstNames;
[Code] ....
View Replies
View Related
May 18, 2014
So, I have two classes (bubble sort and insert sort) which are sorting dates. I need to save their comparings and reallocation of elements.
And I don't know how to do it. The point is if I want save that dates(comparings and reallocation) to Result class i need to create new instances of class in each sorting classes so i can't later do something with that, because I have null in Main class.
To avoid that problem i have tried to make Result class as singleton.. I mean: "public static final Results INSTANCE = new Results();" and then in classes "static Results result = Results.INSTANCE" without constructor and to save for example comparings i had method:
Java Code:
int SetComparings(){
return comparings++;
} mh_sh_highlight_all('java');
But it do not work too, because it overwrites old dates. Is there anyway to do not create instance of class? I don't want to copy whole code because it is too long and cant be unreadable, but i will put you structure of my program:
Java Code:
class BubbleSort{}
class InsertSort{}
class Results{}
class Sorting{} // class with switch to choose which way of sorting use
public class Main{} mh_sh_highlight_all('java');
View Replies
View Related