CRUD application
I have defined a entity and a session bean.
Now I want to maken a enterprise application client or desktop (what is the difference??) which can perform CRUD operations using the session bean.
I can't find anywhere how to do this job.
Please help me out.
thanks,
I think the URL given by Jagan_ayans does it all. You can only change the implementation from strut to Swing. If you guys want a generator, Check out the application CRUD table-like generator that is in NetBean 6.0.
Even with the generation, you will still have to tweak code to suit to case. Using a custom JTable will be best. I am sure to what I just said.
Currently, we are doing a JSF CRUD implementation where everything goes from database -> Entity EAOs -> Session Beans -> Managed Bean -> JSPs and what Jagan_ayans provided in the link is something close to it.
So, it is all possible.
>
There are lots of tools. Unfortunately, it's still not possible to push a button and have an app come out.
Lots of managers would love to have such a thing so they could fire all the programmers and have secretaries or drunken monkeys write enterprise apps, but we're not there yet.
Duffymo, you should know that no matters what modern day code generator generate, they will never suit today's complex business needs. There will always be a need for you (programmers). Think about the SQL, as human like the langauges seems to be, it has never been easy for a non-DBA or non-Developer to speak it.
We will always be in vogue.
Regards
Similar Messages
-
How to create CRUD application using bapi in webdynpro java
Hi All,
I have implemented the CRUD application using bapi Now i want to create, retrieve , update and delete the existing table by click on Insert, delete, retrieve ,and update button dynamically. i get null values from database, Please let me know the logic and procedure for how to create CRUD application using bapi Please any one help me..
Thanks in advanceHi,
Hey tell me one thing your BAPI having CURD methods. See you are getting data from BAPI and pull the data in Table in WDJ. So if u can do any action it will comes trough BAPI.
If your BAPI having CURD methods. You can implement CURD methods in WDJAVA also.
@ You said you are getting null values from the database. Please let me know what code you have to wrote for CURD. Please tell me.
Hope this is help full for u
Best Regards
Vijay K -
Anyone know how to gernerate CRUD applications with flex and coldfusion?
Anyone know how to gernerate CRUD applications with flex and
coldfusion? I am working with a remote coldsfusion installation
with MS SQL and I don't have RDS.You might investigate "squidhead". It is CF based. I'm not
sure if it has any Flex related features.
http://squidhead.riaforge.org/ -
SAPUI5 CRUD Application using OData
Hi Everyone,
Trying this tutorial here Building a CRUD Application with SAPUI5 Using Odata Model. Just wondering if anyone has tried using SAP's Gateway demo services (SAP Netweaver Gateway Demo System) in this tutorial. Or do we really have to create our own bank service.
Thanks.Hi,
As of now I did not tried POST/PUT on demo service. I did GET earlier.
you can first check if POST/PUT operation can be possible with GW Demo services. try with Demo service ZGWSAMPLE_SRV
As per this document, I guess it should be possible and then find out if bank service is available and then perform CRUD operations.
Regards,
Chandra -
How to create and develop CRUD application using JDeveloper and ADF?
Hi,
Check this, this will help:
http://andrejusb.blogspot.com/2008/09/jdeveloper-11g-crud-in-adf-form.html
http://andrejusb.blogspot.com/2009/11/crud-operations-in-jdeveloperadf-11g-r1.html
-Prasad -
Flex 3 missing Coldfusion CRUD
I just installed Flex 3, and I get RDS working fine. I was
going to quickly build an app to test using the Coldfusion CRUD
Wizard, but it appears to be non-existent in Flex 3?
Help! Where did it go? Am I missing something? The only thing
I found was a CFC wizard on the the RDS Dataview tab, but I need
the entire CRUD application wizard, not just a few CFCs.
Thanks!This appears to be a bug in the Windows Vista x64
functionality with Flex 3 (even when the program is run as
Administrator). I have posted a bug report and the work-around I
discovered here at Adobe's Flex Bug and Issue Management System:
https://bugs.adobe.com/jira/browse/FB-12276
In case the link above becomes invalid, the problem is that
NONE of the Wizard Folder expand to show and of the wizards
available in the Wizard Selection window when you click to expand
any folder and show its contents. The work-around is to type part
of the name of the particular wizard you want to run in the search
field above the wizard folder listings. This will cause the folder
to expand and reveal the wizards matching what the user has typed.
In my case I had to install Flex 3 on my Windows XP system to know
the names of what I was searching for, and typing "cold" brought up
the ColdFusion CRUD wizard below the folder. -
Having just acquired Creative Cloud subscription, I see that I have access to Flash Builder 4.6 Premium. I haven't figured out yet if I will eventually have access to Flash Builder 4.6 for PHP when / if it is released.
I am relatively new to programming. I want to create a desktop application, perhaps a web application, to manage a MySQL database. I am not, at this time, concerned with mobile applications. I'm primarily interested in just managing the MySQL data -- CRUD (create, read, update, delete) operations.
Hopefully I've provided enough context. My question concerns whether learning Flash Builder 4.6 and Flex programming is an appropriate choice. Alternatively, I could just focus on learning basic PHP programming or perhaps learning to use one of the PHP frameworks (CakePHP, CodeIgniter, or Zend). It seems like learning these frameworks will take time as well, so I don't know where I should begin.
I would really value your perspective. Are the Flash Builder related technologies here to stay? Is Flash Builder primarily suitable for mobile applications (rather than desktop or web)? Would it be more or less difficult to learn Flash Builder and Flex than PHP and one of the PHP frameworks with a view to building a MySQL CRUD application?
Thank you, so very much -- for your time and expertise.
KevinKevin,
I am a big fan of Flash Builder. You can build great desktop web applications as well desktop applications that run on AIR (installs locally to the desktop).
I found it easier to pick up Flex (now Flash Builder) primarily due to the resources (Learn Flex in a week video tutorials http://www.adobe.com/devnet/flex/videotraining.html ) as well as a big developer community that posts a lot of how to's and walk throughs. In my personal opinion, I think the power of Flash Builder/Flex framework is the ability to create what traditionally was seen as desktop apps within your web browser. If you're looking to create a basic crud interface, skipping Flash Builder and just doing it in PHP may be the way to go. If you're looking to add visualizations (ie graphs, charts) or highly interactive user interface to it then Flash Builder would be a good way to go (though keep in mind that you will still need PHP (or some other server side application layer like coldfusion) to interface with your mysql database but Flash Builder's dataservices creates some sample php classes for you to handle CRUD using Zend). There's lots of amazing things you can do with Flash Builder. I'd recommend checking out some of the samples from Tour de Flex to get a sense of what can be done with Flash Builder.
A couple of notes though - You can build and package native mobile apps with Flash Builder but if you're looking to create web apps for devices like iphone and ipads, Flash Builder isn't the solution since it compiles web based apps to Flash and we all know how idevices don't play nicely with Flash. -
ADF Bindings CRUD with either JDBC or Hibernate
Does anyone know of an example CRUD application that uses ADF Bindings and either Hibernate or JDBC.
The site...
http://technology.amis.nl/blog/index.php?p=765
uses ADF Bindings and Hibernate, but does not update a database.
I have attempted to do this myself, but when my add/edit page loads, all of my af:inputtext controls display labels instead of input boxes.
There are several ADF Biding examples for both Toplink and ADF BC, but if anyone can point me in the direction of examples for JDBC and/or Hibernate, I would appreciate it.I have created the target datacontrol for ADF Binding.
In my DataContorls.dcx file, my datacontrol (a JavaBeanDataControl, not an AdapterDataControl) has its SupportsUpdates attribute = "false".
When I create a form, the #{bindings.<my_property>.updateable} expression returns false, making it so my af:inputText controls cannot take input data. If I manually set SupportUpdates="true", my #{bindings.<my_property>.updateable} expression still returns false.
If anyone knows how to set it so I can make it so I can update my java objects, I think I will be set.
Any help would be appreciated. -
SMP 3.0 Hybrid Application
Hello All , I just want to create same application in 3 platforms (Windows , iOS , Android ). As per my knowledge through agentry its possible . But through Kapsel only possible with (iOS and Andorid). How about UI5 ? will it possible via UI5 for (iOS , Android , Windows). Can you please suggest more on it ? Thanks & Regards, Kunal Varaiya
Tags edited by: Michael ApplebyYou can follow the below link and develop a simple application consuming odata services from gateway.
Using gateway plugin for eclipse
How to create SAPUI5 application consuming Gateway service with the help of SAP NW Gateway Plug-in for Eclipse
http://scn.sap.com/community/developer-center/front-end/blog/2014/01/13/building-a-crud-application-with-sapui5-using-odata-model
SAPUI5 SDK - Demo Kit is the root document to develop applications from scratch -
Coldfusion/Flex CRUD Tutorial?
Are there any tutorials on how to build a CRUD application
from scratch using Coldfusion and Flex w/o FDS? I know Flex Builder
2 includes a wizard, but it is just too limited, and doesnt help
much when trying to learn how a CRUD is built.
Thanks!Neither. The Remote Authentication screen refers to hard-coded credentials in the CF server configuration as described here:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec115d2 -7ffc.html#WSc3ff6d0ea77859461172e0811cbec115d2-7ff7
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/ -
Warning this is very long code but i need help to see if I am on right trac
I have done all the following code myself and it is the buisiness layer for my application. I have tried to follow recommendations on previous posts and I would like to be told where I can clean up my code and how? This is not complete and it looks very long to me but I need help in order to be better. There are 4 button vlivks and I have not completed them all. The criteria for application is that phonebook will accept new entries if they have names surnames and phone numbers that are not longer than 10 characters for display purposes but can change this. No duplicates are allowed. No editing of a existing entry must lead to a duplicate entry either. No new entry or edit may result in a new contact having no phone numbers.
Many thanks for your time in advance,.....
import javax.swing.JOptionPane;
import java.util.ArrayList;
public class Contact
{// Start of the Contact class
ArrayList<ContactDetails> phoneList = new ArrayList<ContactDetails>(); // To hold all the contacts
ArrayList<ContactDetails> searchList = new ArrayList<ContactDetails>(); // To hold all contacts that return true on search
ArrayList<ContactDetails> list = new ArrayList<ContactDetails>();
String newName; // To hold the new name
String newSurname; // to hold the new surname
String newHome; // To hold the new home number if any
String newWork; // To hold the new work number
String newCell; // To hold the new cell number
final int MAX_LENGTH = 10;
public boolean addToPhoneList; // Sets to false if there is an invalid entry
public boolean addToSearchList; // Sets to false if there is an invlid search
public boolean modifyContact; // Sets to false if there is an invalid modification
// Method to create a new contact
public void createNew()
{// Start of create new()
addToPhoneList = true; // Set boolean to true each time the method is executed
getNewContactsName(); // Get new name
if(addToPhoneList == false)
createNew();
return;
getNewContactsSurname(); //Get new surname
if(addToPhoneList == false)
createNew();
return;
String checkName = newName; //Creates copies to be used in the checkIfDuplicate method
String checkSurname = newSurname;
addToPhoneList = checkIfDuplicate(checkName, checkSurname); //Check if the entries are duplicate
if(addToPhoneList == false)
createNew();
return;
getNewContactsHomeNum(); // Get new home number
if(addToPhoneList == false)
createNew();
return;
getNewContactsWorkNum(); // Get new work number
if(addToPhoneList == false)
createNew();
return;
getNewContactsCellNum(); // Get new cell number
if(addToPhoneList == false)
createNew();
return;
checkAtLeastOneNumEntered(); // Check that at least one phone number was entered
if(addToPhoneList == true)
updateListWithNew();
}// End of createNew()
// Method to search for an existing contact
public void searchExisting()
{// Start of searchExisting()
addToSearchList = true; // Set the boolean true
searchList.clear(); // Clear list from any previous searches
if(phoneList.size() > 0) // Check if any contacts are in the list
getExistingDetailsAndSearch(); // If there are entries then continue to search
else
JOptionPane.showMessageDialog(null,"There are no contacts to search for. Please use this option when you have added a contact to the list.","Error",JOptionPane.ERROR_MESSAGE);
}// End of searchExisting()
// Method to modify an existing contact
public void modifyExisting()
{// Start of modifyExisting()
modifyContact = true; // Set the boolean to true
if(phoneList.size() <= 0) // Check if the phonelist is not empty
JOptionPane.showMessageDialog(null,"There are no contacts to modify. Please use this option when there have been contacts added to the list.","Error",JOptionPane.ERROR_MESSAGE);
else
getExistingDetailsAndModify(); // If phonelist not emty continue to modify method
}// End of modifyExisting()
//Method to delete a contact from the list
public void deleteExisting()
//Method to get new contacts name
public void getNewContactsName()
newName = JOptionPane.showInputDialog("Please enter the new contacts name or press cancel to exit without saving.");
if(newName == null)
finish();
if(newName.trim().length()<=0)
JOptionPane.showMessageDialog(null,"You have not entered a name. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
addToPhoneList = false;
return;
addToPhoneList = checkLengthValid(newName, "name");
//Method to get a new contacts surname
public void getNewContactsSurname()
newSurname = JOptionPane.showInputDialog("Please enter the new contacts surnname or press cancel to exit without saving.");
if(newSurname == null)
finish();
addToPhoneList = checkLengthValid(newSurname, "surname");
//Method to get a new contacts home number
public void getNewContactsHomeNum()
newHome = JOptionPane.showInputDialog("Please enter the new contacts home number or press cancel to exit without saving.");
if(newHome == null)
finish();
if(newHome.trim().length() > 0)
try
Long homeNum = Long.parseLong(newHome);
catch(Exception e)
JOptionPane.showMessageDialog(null,"You may only use numbers for a valid phone number. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
addToPhoneList = false;
return;
addToPhoneList = checkLengthValid(newHome, "home number");
//Method to get a new contacst work number
public void getNewContactsWorkNum()
newWork = JOptionPane.showInputDialog("Please enter the new contacts work number or press cancel to exit without saving");
if(newWork == null)
finish();
if(newWork.trim().length()> 0)
try
Long workNum = Long.parseLong(newWork);
catch(Exception e)
JOptionPane.showMessageDialog(null,"You may only use numbers for a valid number. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
addToPhoneList = false;
return;
addToPhoneList = checkLengthValid(newWork, "work number");
//Method to get a new contacts cell number
public void getNewContactsCellNum()
newCell = JOptionPane.showInputDialog("Please enter the new contacts cell number or press cancel to exit without saving");
if(newCell == null)
finish();
if(newCell.trim().length() > 0)
try
Long cellNum = Long.parseLong(newCell);
catch(Exception e)
JOptionPane.showMessageDialog(null,"You may only use numbers for a valid number. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
addToPhoneList = false;
return;
addToPhoneList = checkLengthValid(newCell, "cell number");
//Method to get the details for an existing contact
public void getExistingDetailsAndSearch()
String existingName = getExistingName("search for");
if(existingName == null)
addToSearchList = false;
return;
if(existingName.length()<=0)
JOptionPane.showMessageDialog(null,"You have not entered a name please try again","Error",JOptionPane.ERROR_MESSAGE);
addToSearchList = false;
searchExisting();
String existingSurname = getExistingSurname();
if(existingSurname == null)
return;
if(addToSearchList == true)
searchAndAddIfFound(existingName, existingSurname);
//Method to get existing details and modify contact
public void getExistingDetailsAndModify()
String existingName = getExistingName("modify");
if(existingName == null)
modifyContact = false;
return;
if(existingName.length()<=0)
JOptionPane.showMessageDialog(null,"You have not entered a name please try again","Error",JOptionPane.ERROR_MESSAGE);
modifyContact = false;
modifyExisting();
String existingSurname = getExistingSurname();
if(existingSurname == null)
return;
if(modifyContact == true)
getContactBySearch(existingName.trim().toUpperCase(), existingSurname.trim().toUpperCase());
//Method to get the contact from list and modify details
public void getContactBySearch(String currentName, String currentSurname)
int count = 0;
int numFound = 0;
for(ContactDetails cd: phoneList)
cd = phoneList.get(count);
if((cd.name.equals(currentName))&&(cd.surname.equals(currentSurname)))
numFound ++;
changeDetails(cd);
count ++;
if(numFound <= 0)
JOptionPane.showMessageDialog(null,"No contacts matching the name and surname you entered found. Press the modify button to try again.","Information",JOptionPane.INFORMATION_MESSAGE);
//Method to get existing contacts name
public String getExistingName(String whatWasClicked)
String name = JOptionPane.showInputDialog("Please enter the contacts name that you wish to "+whatWasClicked);
return name;
//Method to get an existing contacts surname
public String getExistingSurname()
String surname = JOptionPane.showInputDialog("Please enter the contacts surname.");
return surname;
//Method to change the details of contact
public void changeDetails(ContactDetails conToChange)
String currentName = conToChange.name;
String currentSurname = conToChange.surname;
String currentHome = conToChange.home;
String currentWork = conToChange.work;
String currentCell = conToChange.cell;
String newNameForContact = getNewModName(currentName);
if(modifyContact == false)
modifyExisting();
return;
String newSurnameForContact = getNewModSurname(currentSurname);
if(modifyContact == false)
modifyExisting();
return;
String newHomeForContact = getNewModHome(currentHome);
if(modifyContact == false)
modifyExisting();
return;
String newWorkForContact = getNewModWork(currentWork);
if(modifyContact == false)
modifyExisting();
return;
String newCellForContact = getNewModCell(currentCell);
if(modifyContact == false)
modifyExisting();
return;
if(modifyContact == true)
conToChange.name = newNameForContact;
//Method to get the modified name
public String getNewModName(String currentName)
String newModifiedName = JOptionPane.showInputDialog("Please enter the new name for contact or press cancel to keep it as is.");
if(newModifiedName == null)
return currentName;
if(newModifiedName.trim().length() <= 0)
JOptionPane.showMessageDialog(null,"You may not replace the existing name with a blank name. Please try again.","Error",JOptionPane.ERROR_MESSAGE);
modifyContact = false;
return currentName;
modifyContact = checkLengthValid(newModifiedName, "modified name");
return newModifiedName;
//Method to get the modified surname
public String getNewModSurname(String currentSurname)
String newModifiedSurname = JOptionPane.showInputDialog("Please enter the new surname for the contact or press cancel to keep it as is.");
if(newModifiedSurname == null)
return currentSurname;
modifyContact = checkLengthValid(newModifiedSurname, "modified surname");
if(modifyContact == false)
JOptionPane.showMessageDialog(null,"Surname not changed.","Information",JOptionPane.INFORMATION_MESSAGE);
return currentSurname;
modifyContact = checkLengthValid(newModifiedSurname, "modified surname");
return newModifiedSurname;
//Method to search and update the list with a succesfull search
private void searchAndAddIfFound(String name, String surname)
int count = 0;
int numFound = 0;
for(ContactDetails cd: phoneList)
cd = phoneList.get(count);
if(cd.name.equals(name.trim().toUpperCase()))
numFound ++;
searchList.add(cd);
count ++;
if(numFound <= 0)
JOptionPane.showMessageDialog(null,"No contacts were found matching the dat you entered.","Information",JOptionPane.INFORMATION_MESSAGE);
else
list.clear();
list.addAll(searchList);
//Method that check all entries are a valid logical length
//Method is based on assumption that a normal name, surname, and phone numbers are not longer than 10 characters long.
//IF This method is changed please change the layout in the GUI as this is also set to fit with the layout that gives a neat //apperance
private boolean checkLengthValid(String detailEntered, String whatWasEntered)
boolean validLength = true;
if(detailEntered.trim().length() >= MAX_LENGTH)
JOptionPane.showMessageDialog(null,"The " +whatWasEntered+" you entered is too long. Please try again and use a "+whatWasEntered+" that is less than "+MAX_LENGTH+" characters long.","Error",JOptionPane.ERROR_MESSAGE);
validLength = false;
return validLength;
private void finish()
System.exit(0);
//Method to update the list with a new entry
private void updateListWithNew()
try
ContactDetails cd = new ContactDetails();
cd.name = newName.trim().toUpperCase();
cd.surname = newSurname.trim().toUpperCase();
cd.home = newHome.trim();
cd.work = newWork.trim();
cd.cell = newCell.trim();
phoneList.add(cd);
JOptionPane.showMessageDialog(null,"Contact succesfully entered. To save this change press exit to save or use the save option in the toolbar menu.","Information",JOptionPane.INFORMATION_MESSAGE);
catch(Exception e)
JOptionPane.showMessageDialog(null,"Failed to add contact to list. If problem persists please contact the software developer.","Error",JOptionPane.ERROR_MESSAGE);
list.clear();
list.addAll(phoneList);
//Method to check for duplicate
public boolean checkIfDuplicate(String nameToCheck, String surnameToCheck)
int count = 0;
boolean valid = true;
for(ContactDetails cd : phoneList)
cd = phoneList.get(count);
if(((nameToCheck.trim().toUpperCase()).equals(cd.name))&&((surnameToCheck.trim().toUpperCase()).equals(cd.surname)))
JOptionPane.showMessageDialog(null,"You may not enter a duplicate contact. Please try again and change the name and surname.","Error",JOptionPane.ERROR_MESSAGE);
valid = false;
break;
count ++;
return valid;
//Method to check that at least one phone number exists for contact
public void checkAtLeastOneNumEntered()
if((newHome.trim().length()<=0)&&(newWork.trim().length()<=0)&&(newCell.trim().length()<=0))
JOptionPane.showMessageDialog(null,"You have not entered any phone number at all. You must enter at least one phone number for a new contact.","Error",JOptionPane.ERROR_MESSAGE);
addToPhoneList = false;
//Method that returns the list to the GUI
public ArrayList<ContactDetails> getList()
return list;
}Should I start over from scratch? Can I get help with links to tutorials on following? How to create a java CRUD application (google not useful) and how to layer in java(google not useful)
This is my pres layer as is is this wrong too?
Filename: ContactsListInterface.java
Date: 16 March 2008
Programmer: Yucca Nel
Purpose: Provides a GUI for entering names and contact numbers into a telephone directory.
Also allows options for searching for a specific name and deleting of data from the record
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import java.io.*;
import java.util.*;
import java.text.*;
public class Phonebook1 extends JFrame implements ActionListener
{ //start of class
// construct fields, buttons, labels,text boxes, ArrayLists etc
JTextPane displayPane = new JTextPane();
JLabel listOfContacts = new JLabel("List Of Contacts"); // creates a label for the scrollpane
JButton createButton = new JButton("Create");
JButton searchButton = new JButton("Search");
JButton modifyButton = new JButton("Modify");
JButton deleteButton = new JButton("Delete");
Contact c = new Contact();
ArrayList<ContactDetails> contactList = c.getList();
// create an instance of the ContactsListInterface
public Phonebook1()
{ // start of cli()
super("Phonebook Interface");
} // end of cli()
public JMenuBar createMenuBar()
{ // start of the createMenuBar()
// construct and populate a menu bar
JMenuBar mnuBar = new JMenuBar(); // creates a menu bar
setJMenuBar(mnuBar);
JMenu mnuFile = new JMenu("File",true); // creates a file menu in the menu bar which is visible
mnuFile.setMnemonic(KeyEvent.VK_F);
mnuFile.setDisplayedMnemonicIndex(0);
mnuFile.setToolTipText("File Options");
mnuBar.add(mnuFile);
JMenuItem mnuFileExit = new JMenuItem("Save And Exit"); // creates an exit option in the file menu
mnuFileExit.setMnemonic(KeyEvent.VK_X);
mnuFileExit.setDisplayedMnemonicIndex(1);
mnuFileExit.setToolTipText("Close Application");
mnuFile.add(mnuFileExit);
mnuFileExit.setActionCommand("Exit");
mnuFileExit.addActionListener(this);
JMenu mnuEdit = new JMenu("Edit",true); // creates a menu for editing options
mnuEdit.setMnemonic(KeyEvent.VK_E);
mnuEdit.setDisplayedMnemonicIndex(0);
mnuEdit.setToolTipText("Edit Options");
mnuBar.add(mnuEdit);
JMenu mnuEditSort = new JMenu("Sort",true); // creates an option for sorting entries
mnuEditSort.setMnemonic(KeyEvent.VK_S);
mnuEditSort.setDisplayedMnemonicIndex(0);
mnuEdit.add(mnuEditSort);
JMenuItem mnuEditSortByName = new JMenuItem("Sort By Name"); // to sort entries by name
mnuEditSortByName.setMnemonic(KeyEvent.VK_N);
mnuEditSortByName.setDisplayedMnemonicIndex(8);
mnuEditSortByName.setToolTipText("Sort entries by first name");
mnuEditSortByName.setActionCommand("Name");
mnuEditSortByName.addActionListener(this);
mnuEditSort.add(mnuEditSortByName);
JMenuItem mnuEditSortBySurname = new JMenuItem("Sort By Surname"); // to sort entries by surname
mnuEditSortBySurname.setMnemonic(KeyEvent.VK_R);
mnuEditSortBySurname.setDisplayedMnemonicIndex(10);
mnuEditSortBySurname.setToolTipText("Sort entries by surname");
mnuEditSortBySurname.setActionCommand("Surname");
mnuEditSortBySurname.addActionListener(this);
mnuEditSort.add(mnuEditSortBySurname);
JMenu mnuHelp = new JMenu("Help",true); // creates a menu for help options
mnuHelp.setMnemonic(KeyEvent.VK_H);
mnuHelp.setDisplayedMnemonicIndex(0);
mnuHelp.setToolTipText("Help options");
mnuBar.add(mnuHelp);
JMenuItem mnuHelpHelp = new JMenuItem("Help"); // creates a help option for help topic
mnuHelpHelp.setMnemonic(KeyEvent.VK_P);
mnuHelpHelp.setDisplayedMnemonicIndex(3);
mnuHelpHelp.setToolTipText("Help Topic");
mnuHelpHelp.setActionCommand("Help");
mnuHelpHelp.addActionListener(this);
mnuHelp.add(mnuHelpHelp);
JMenuItem mnuHelpAbout = new JMenuItem("About"); // creates a about option for info about api
mnuHelpAbout.setMnemonic(KeyEvent.VK_T);
mnuHelpAbout.setDisplayedMnemonicIndex(4);
mnuHelpAbout.setToolTipText("About this program");
mnuHelpAbout.setActionCommand("About");
mnuHelpAbout.addActionListener(this);
mnuHelp.add(mnuHelpAbout);
return mnuBar;
} // end of the createMenuBar()
// create the content pane
public Container createContentPane()
{ // start of createContentPane()
//construct and populate panels and content pane
JPanel labelPanel = new JPanel(); // panel is only used to put the label for the textpane in
labelPanel.setLayout(new FlowLayout());
labelPanel.add(listOfContacts);
JPanel displayPanel = new JPanel();// panel is used to display all the contacts and thier numbers
setTabsAndStyles(displayPane);
displayPane = addTextToTextPane();
displayPane.setEditable(false);
JScrollPane scrollPane = new JScrollPane(displayPane);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); // pane is scrollable vertically
scrollPane.setWheelScrollingEnabled(true);// pane is scrollable by use of the mouse wheel
scrollPane.setPreferredSize(new Dimension(400,320));
displayPanel.add(scrollPane);
JPanel workPanel = new JPanel();// panel is used to enter, edit and delete data
workPanel.setLayout(new FlowLayout());
workPanel.add(createButton);
createButton.setToolTipText("Create a new entry");
createButton.addActionListener(this);
workPanel.add(searchButton);
searchButton.setToolTipText("Search for an entry by name number or surname");
searchButton.addActionListener(this);
workPanel.add(modifyButton);
modifyButton.setToolTipText("Modify an existing entry");
modifyButton.addActionListener(this);
workPanel.add(deleteButton);
deleteButton.setToolTipText("Delete an existing entry");
deleteButton.addActionListener(this);
labelPanel.setBackground(Color.red);
displayPanel.setBackground(Color.red);
workPanel.setBackground(Color.red);
// create container and set attributes
Container c = getContentPane();
c.setLayout(new BorderLayout(30,30));
c.add(labelPanel,BorderLayout.NORTH);
c.add(displayPanel,BorderLayout.CENTER);
c.add(workPanel,BorderLayout.SOUTH);
c.setBackground(Color.red);
// add a listener for the window closing and save
addWindowListener(
new WindowAdapter()
public void windowClosing(WindowEvent e)
int answer = JOptionPane.showConfirmDialog(null,"Are you sure you would like to save all changes and exit?","File submission",JOptionPane.YES_NO_OPTION);
if(answer == JOptionPane.YES_OPTION)
System.exit(0);
return c;
} // end of createContentPane()
protected void setTabsAndStyles(JTextPane displayPane)
{ // Start of setTabsAndStyles()
// set Font style
Style fontStyle = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
Style regular = displayPane.addStyle("regular", fontStyle);
StyleConstants.setFontFamily(fontStyle, "SansSerif");
Style s = displayPane.addStyle("bold", regular);
StyleConstants.setBold(s,true);
} // End of setTabsAndStyles()
public JTextPane addTextToTextPane()
{ // start of addTextToTextPane()
int numberOfEntries = contactList.size();
int count = 0;
Document doc = displayPane.getDocument();
try
{ // start of tryblock
// clear previous text
doc.remove(0,doc.getLength());
// insert titles of columns
doc.insertString(0,"NAME\tSURNAME\tHOME NO\tWORK NO\tCELL NO\n",displayPane.getStyle("bold"));
for(ContactDetails cd : contactList)
cd = contactList.get(count);
doc.insertString(doc.getLength(),cd.name+"\t"+cd.surname+"\t"+cd.home+"\t"+cd.work+"\t"+cd.cell+"\n",displayPane.getStyle("regular"));
count ++;
} // end of try block
catch(BadLocationException ble)
{ // start of ble exception handler
System.err.println("Could not insert text.");
} // end of ble exception handler
return displayPane;
} // end of addTextToTextPane()
// code to process user clicks
public void actionPerformed(ActionEvent e)
{ // start of actionPerformed()
String arg = e.getActionCommand();
// user clicks create button
if(arg.equals("Create"))
c.createNew(); // method to create a new Contact
addTextToTextPane();
if(arg.equals("Search"))
c.searchExisting(); // method to search for an existing entry
addTextToTextPane();
if(arg.equals("Modify"))
c.modifyExisting(); // method to modify contact
addTextToTextPane();
if(arg.equals("Delete"))
c.deleteExisting();
addTextToTextPane();
if(arg.equals("Exit"))
} // end of actionPerformed()
// method to create a new contact
public static void main(String[] args)
{ // start of main()
// Set look and feel of interface
try
{ // start of try block
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
} // end of try block
catch(Exception e)
{ // start of catch block
JOptionPane.showMessageDialog(null,"There was an error in setting the look and feel of this application","Error",JOptionPane.INFORMATION_MESSAGE);
} // end of catch block
Phonebook1 pb = new Phonebook1();
pb.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
pb.setJMenuBar(pb.createMenuBar());
pb.setContentPane(pb.createContentPane());
pb.setSize(520,500);
pb.setVisible(true);
pb.setResizable(false);
} // end of main()
} //end of class -
How to create a new record using ODataModel?
Hi,
I am new to UI5 and so ODataModel. I have tied one table to an ODataModel.
How would I send request to a server so that I will have a new entry created at server end?
I googled this and I tried following:
1. Called createEntry method on ODataModel as follows:
sap.ui.getCore().byId("maintainRolesTable").getModel().createEntry("DERMASSIGNMENTSet",{
"DeUser":"C5192081",
"SeqNo":"X",
"Childbp":"C5192081",
"ChildbpName":"",
"Id":"2",
"RelationType":"",
"Parentbp":"I0656568",
"ParentbpName":""
2. I called then submitChanges method on the model as follows:
sap.ui.getCore().byId("maintainRolesTable").getModel().submitChanges();
This is giving error as follows:
POST https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet 403 (Forbidden) datajs.js:17
2014-06-05 16:53:32 The following problem occurred: HTTP request failed403,Forbidden,CSRF token validation failed -
When I try to use ajax call instead of these methods, I get error as follows:
var obj={
"Childbp": "C5192081",
"ChildbpName": "Supriya Kale",
"DeUser": "C5192081",
"Id": "8",
"Parentbp": "I0656568",
"ParentbpName": "",
"RelationType": "RESOURCE MANAGER",
"SeqNo": "1",
"metadata":{
"id":"https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet(DeUser='C5192081',SeqNo='x')",
"uri":"https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet(DeUser='C5192081',SeqNo='x')",
"type":"ZSECENTRAL_SRV.DERMASSIGNMENT"
$.ajax({
type: "PUT",
dataType: "json",
url: "https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet",
data: JSON.stringify(obj)
}).success(function( msg ) {
alert('HI read operation complete....................................');
}).error(function(msg){
alert("error occurred");
I get following error:
PUT https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet 403 (Forbidden)
Can anyone tell me if I am going wrong in calling methods? Help would be appreciated.
Thanks,
Supriya KaleHi Supriya,
you can take a look at this blog. Building a CRUD Application with SAPUI5 Using Odata Model
Scroll down to Create Operation.
There you can see that the author is also first fetching CSRF and the calling CREATE operation.
For simple example see correct answer in this thread.
HTTP request failed403,Forbidden,CSRF token validation failed
Best regards,
Peter -
Noob needs help re offline desktop db app - is FB the right tool?
Hi,
Thanks in advance for reading, and being patient with my long-winded-noobiness!
I am a self taught (read as: big gaps in my knowledge!) independent web designer/developer, with experience in developing PHP/mySQL database web-apps - both with DW, and by hand-coding. I've been approached by a potential client asking if I could build a simple CRUD desktop application, and am trying to figure out if I can leverage my existing knowledge in doing so. It's something I know I could develop in a snap for the web, but I'm left realizing I don't know the first thing - or even where to begin learning the first thing! - about desktop software development. I'm hoping Flash Builder might be just the ticket for me (I'm not sure if the client will want to wait around while I learn JAVA!!), since I already own and am familiar with CS5. I've been going over all the documentation, tutorials, etc. that I can get my hands on, but am finding my brain a little overwhelmed and frazzled, so I'm hoping one of you wonderful folk might be able to offer a simple answer!
Can I use Flash Builder / Flex to develop a strictly offline, local desktop CRUD application, but one which connects to a (local) mySQL database (ideally with PHP, since that's what I already know) - without the end-user having to separately install a local server?
If not, any suggestions? As well as Flex, I've been looking into Java (but am finding the learning curve quite steep), and Filemaker Pro 11 Advanced (which allows you to create a runtime - but I'm finding it a bit restrictive, and would rather not have any Filemaker branding on the finished product),
In case you're wondering why I don't just convince the client to create a web-app instead, the data stored would be of a sensitive nature, and the main target demographic is baby-boomers, many of whom are still very wary of the interwebs
Thank you so much for any help you can offer!
Cheers,
DavidActually, I would think that Flex would be ideal using AIR with a SQLite database (the database is built in to AIR apps). However, if you've not done programming with Flex before, I won't trivialize the learning curve you have ahead of you. If you haven't already done so, go through Flex in a Week or get the latest Training from the Source for Flex 4 and get comfortable with the Flex workspace and programming environment. You'll like come to love it but it's a bit different than PHP. It would be an easier transition, I think, if you had a heavy background in JavaScript or Java so that you felt comfortable using OOP programming techniques. If you already structure your PHP programs with OO principles, it'll be an issue of getting used to the language and, if I were guessing, that might take you a month or two. That's my 2 cents worth.
-
Hello everybody, im a novice on Developpement using Flex.
im working on a project which will be runned on BlackBerry Tablet (PlayBook), im using FlashBuilder Burrito + AIR SDK
my project is a CRUD application, so i follow this tutorial http://www.adobe.com/devnet/flex/testdrivemobile/articles/mtd_1_1.html and it works
now i try to do the same things on my DataBase, i can retrieve data but i can't Insert or Delete ...
this is the code of my application :
<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:valueObjects="valueObjects.*"
xmlns:affiliesservice="services.affiliesservice.*"
title="Accueil">
<fx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
protected function saveBtn_clickHandler(event:MouseEvent):void
aff.longitude=11111.1;
aff.lattitude=11111.3;
createAffilies(aff);
protected function createAffilies(item:Affilies):void
createAffiliesResult.token = affiliesService.createAffilies(item);
protected function createAffiliesResult_resultHandler(event:ResultEvent):void
navigator.popView();
navigator.pushView(ajoutValides);
]]>
</fx:Script>
<fx:Declarations>
<valueObjects:Affilies id="aff" />
<s:CallResponder id="createAffiliesResult" result="createAffiliesResult_resultHandler(event)"/>
<affiliesservice:AffiliesService id="affiliesService"/>
</fx:Declarations>
<s:Scroller left="0" right="0" top="0" bottom="103">
<s:VGroup x="38" y="110" width="100%" height="100%" gap="15" paddingBottom="15"
paddingLeft="15" paddingRight="15" paddingTop="15">
<s:Label text="Nom"/>
<s:TextInput width="100%" text="@{aff.nom}"/>
<mx:Spacer height="5"/>
<s:Label text="Adresse"/>
<s:TextInput width="100%" text="@{aff.adr}"/>
<mx:Spacer height="5"/>
<s:Label text="Telephone"/>
<s:TextInput width="100%" text="@{aff.tel}"/>
<mx:Spacer height="5"/>
<s:Label text="Url"/>
<s:TextInput width="100%" text="@{aff.lien}"/>
<mx:Spacer height="5"/>
</s:VGroup>
</s:Scroller>
<s:Button id="saveBtn" left="10" bottom="10" width="45%" label="Save"
click="saveBtn_clickHandler(event)"/>
<s:Button id="cancelBtn" right="17" bottom="10" width="45%" label="Cancel"/>
</s:View>
and for the service i generate it automatically and this is the code :
<?php
* README for sample service
* This generated sample service contains functions that illustrate typical service operations.
* Use these functions as a starting point for creating your own service implementation. Modify the
* function signatures, references to the database, and implementation according to your needs.
* Delete the functions that you do not use.
* Save your changes and return to Flash Builder. In Flash Builder Data/Services View, refresh
* the service. Then drag service operations onto user interface components in Design View. For
* example, drag the getAllItems() operation onto a DataGrid.
* This code is for prototyping only.
* Authenticate the user prior to allowing them to call these methods. You can find more
* information at http://www.adobe.com/go/flex_security
class AffiliesService {
var $username = "root";
var $password = "root";
var $server = "localhost";
var $port = "3306";
var $databasename = "expressway";
var $tablename = "affilies";
var $connection;
* The constructor initializes the connection to database. Everytime a request is
* received by Zend AMF, an instance of the service class is created and then the
* requested method is invoked.
public function __construct() {
$this->connection = mysqli_connect(
$this->server,
$this->username,
$this->password,
$this->databasename,
$this->port
$this->throwExceptionOnError($this->connection);
* Returns all the rows from the table.
* Add authroization or any logical checks for secure access to your data
* @return array
public function getAllAffilies() {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM affilies");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function getAffiliesByID($itemID) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
* Returns the item corresponding to the value specified for the primary key.
* Add authorization or any logical checks for secure access to your data
* @return stdClass
public function createAffilies($item) {
$stmt = mysqli_prepare($this->connection, "INSERT INTO affilies (nom, adr, tel, longitude, lattitude, lien) VALUES (?, ?, ?, ?, ?, ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'sssdds', $item->nom, $item->adr, $item->tel, $item->longitude, $item->lattitude, $item->lien);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$autoid = mysqli_stmt_insert_id($stmt);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $autoid;
* Updates the passed item in the table.
* Add authorization or any logical checks for secure access to your data
* @param stdClass $item
* @return void
public function updateAffilies($item) {
$stmt = mysqli_prepare($this->connection, "UPDATE $this->tablename SET nom=?, adr=?, tel=?, longitude=?, lattitude=?, lien=? WHERE id=?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'sssddsi', $item->nom, $item->adr, $item->tel, $item->longitude, $item->lattitude, $item->lien, $item->id);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Deletes the item corresponding to the passed primary key value from
* the table.
* Add authorization or any logical checks for secure access to your data
* @return void
public function deleteAffilies($itemID) {
$stmt = mysqli_prepare($this->connection, "DELETE FROM $this->tablename WHERE id = ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $itemID);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
* Returns the number of rows in the table.
* Add authorization or any logical checks for secure access to your data
public function count() {
$stmt = mysqli_prepare($this->connection, "SELECT COUNT(*) AS COUNT FROM $this->tablename");
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $rec_count);
$this->throwExceptionOnError();
mysqli_stmt_fetch($stmt);
$this->throwExceptionOnError();
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rec_count;
* Returns $numItems rows starting from the $startIndex row from the
* table.
* Add authorization or any logical checks for secure access to your data
* @return array
public function getAffilies_paged($startIndex, $numItems) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename LIMIT ?, ?");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'ii', $startIndex, $numItems);
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
$rows = array();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
while (mysqli_stmt_fetch($stmt)) {
$rows[] = $row;
$row = new stdClass();
mysqli_stmt_bind_result($stmt, $row->id, $row->nom, $row->adr, $row->tel, $row->longitude, $row->lattitude, $row->lien);
mysqli_stmt_free_result($stmt);
mysqli_close($this->connection);
return $rows;
* Utility function to throw an exception if an error occurs
* while running a mysql command.
private function throwExceptionOnError($link = null) {
if($link == null) {
$link = $this->connection;
if(mysqli_error($link)) {
$msg = mysqli_errno($link) . ": " . mysqli_error($link);
throw new Exception('MySQL Error - '. $msg);
?>
and i can't even find an error !! could anyone help me or even give me a solution to read the error report.
thx.so... while no one find the probleme or even give me an answer to it, i search another solution that correspond to my knowledge and i found : As-SQL it's easy to use and while u don't need to manage a lot of data this solution will be helpfull.
any way, even if i found another solution i still want to know the problem. -
Hi,
I have a CRUD application.. Where in the data is fetched, displayed n edited n stored back to db. Also there is a sequential access between pages & the information entered on the first page is needed on the second page & so forth. What would be the best scope & why ?
When to use which scope? What is the life-cycle of each scope.
Also, I couldn't find any good tutorial on scopes. If you are aware of the same, please guide.
Its urgent.
Thanks in advance.921331 wrote:
Hi,
I have a CRUD application.. Where in the data is fetched, displayed n edited n stored back to db. Also there is a sequential access between pages & the information entered on the first page is needed on the second page & so forth. What would be the best scope & why ?
When to use which scope? What is the life-cycle of each scope.
Also, I couldn't find any good tutorial on scopes. If you are aware of the same, please guide.
Its urgent.
Thanks in advance.You could use ViewScope and parameters to the next view or if using CDI have a look at conversation scope. You should read about them in detail yourself because even if someone chooses one for you it's still you who has to go on to use it correctly.
Maybe you are looking for
-
How to add javascript sections in a new form?
I've started livecycle development this week, and after going through JP Terry's book can't see how to incorporate sections of javascript into my new forms. I get the objects onto my form, but they have no functionality! Does anyone know where I can
-
When does capture/pump/replicat process do a checkpoint?
Dear Guru, May someone help me to know when capture/pump/replicat process does a checkpoint? There are 2 things which made me confused. - CHECKPOINTSECS parameter: There is no setting in the parameter file, that means it will be set by default (10s)
-
Problems with getting waveform using tektronix tds 6604
hello, i'm using the scope tds 6604 with tektronix lv-driver (TKTDS6K) under lv 6.0.2. I always want to read the displayed waveform via GPIB. This is not a problem. The waveform and the scales are correct. BUT if I stop the aquisition on the scope Ru
-
Exports have serious pink tint
Starting today, all of my exports whether through email or direct have a very serious pink tint that renders them useless. Anyone else have the problem? Any suggestions for a fix. MAC OSX 10.8.1 Aperture 3.3.2 Problem may have started with 10.8.1
-
I format a text box on the client side for dollar input(ie 1,375.00) I use Float.parseFloat('Text box') to get the float representation of the text box. It works fine, until I reach 1,000 because of the comma. Short of having a method parse the comma