Need help on storing persistance records in J2EE JSP application
Hi,
I want to store a hashtable of info with about five attributes (id, name, username, date) in a persistent state in JSP order to not always call the database. I am either going to use session or request objects.
My question is if it's a good idea to store the hashtable with 2000 records just to avoid the database connection or should I just stick with using database connection using connection pooling? Thanks.
Mkie
Well it seems to be having a heavy session if you keep 2000 records Hashtable I think, I would have gone with a serialized to a file or database so that to handle more no. of sessions as well as persistant information. Anyway if you put the data in session object if server crashes you loose data of every active session :(
Just a thought !!
Similar Messages
-
Need help to fit the records of a table into a particular region
Hi All,
Need help in getting the records of table to be fitted into a particular region provided for it. But in my case as the records increases the textbox below are moving down accordingly into next page that i dont want.
As shown in the below image i have to fit 22 no. of records in that given area only not disturbing the below textbox alignments.
Thank in advance...
Sreekanth Note: Please vote/mark the post as answered if it answers your question/helps to solve your problem.*****Hello,
In SSRS, Report items within a report can be
kept together on a single page implicitly or explicitly by setting the keep with group or keep together properties.
In your case, you can try to specify the "KeepTogether" property to True on the Table properties windows.
If there are other report items under or above the Table and you want keep all items on the single page, you can try to add a Rectangle and put all items into the Rectangle.
Regards,
Fanny Liu
Fanny Liu
TechNet Community Support -
Help:How can I run the J2EE Client Application? Thanks
Help:How can I run the J2EE Client Application that will access the remote J2EE1.4 application server which runs on another host computer?
I have developped a stateles senterprise java bean name converter and deloyed it in the j2ee1.4 application server on the host machine A. The converterbean provides the remote home interface and remote interface. At the same time I have developped the j2ee application client named convertappclient. When I access the conveter bean at host computer A through the script 'appclient.bat' as 'appclient -client convertappclient.jar', the client can access the bean sucessfully. Now I want to access the bean through the script 'appclient.bat' at host computer B,what files should I copy from host computer A to host computer B;and what the command line should be like? Thanks!
The following are the code of the enterprise java bean and it's home interface .
The client code is also provided.
The enterprise java bean:
package converter;
import java.rmi.RemoteException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import java.math.*;
public class ConverterBean implements SessionBean {
BigDecimal yenRate = new BigDecimal("121.6000");
BigDecimal euroRate = new BigDecimal("0.0077");
public ConverterBean() {
public BigDecimal dollarToYen(BigDecimal dollars) {
BigDecimal result = dollars.multiply(yenRate);
return result.setScale(2, BigDecimal.ROUND_UP);
public BigDecimal yenToEuro(BigDecimal yen) {
BigDecimal result = yen.multiply(euroRate);
return result.setScale(2, BigDecimal.ROUND_UP);
public void ejbCreate() {
public void ejbRemove() {
public void ejbActivate() {
public void ejbPassivate() {
public void setSessionContext(SessionContext sc) {
The bean's remote home interface :
package converter;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface ConverterHome extends EJBHome {
Converter create() throws RemoteException, CreateException;
The bean's remote interface:
package converter;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
import java.math.*;
public interface Converter extends EJBObject {
public BigDecimal dollarToYen(BigDecimal dollars) throws RemoteException;
public BigDecimal yenToEuro(BigDecimal yen) throws RemoteException;
The j2ee application client:
import converter.Converter;
import converter.ConverterHome;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;
public class ConverterClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
System.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url","jnp://10.144.97.250:3700");
Context myEnv = (Context) initial.lookup("java:comp/env");
Object objref = myEnv.lookup("ejb/SimpleConverter");
ConverterHome home =
(ConverterHome) PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal("100.00");
BigDecimal amount = currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}Surprisingly I find an upsurge in the number of posts with this same problem. I recently found a post which gave a nice link for this. Follow the steps and it should help:
http://docs.sun.com/source/819-0079/dgacc.html#wp1022105 -
I need help whenever I want to install a new application I receive a message that I cannot be connected to I tunes store although I am connected to the Internet Help
Click here and follow the instructions to change the iTunes Store country.
(85848) -
Need Help With File Matching Records
I need help with my file matching program.
Here is how it suppose to work: FileMatch class should contain methods to read oldmast.txt and trans.txt. When a match occurs (i.e., records with the same account number appear in both the master file and the transaction file), add the dollar amount in the transaction record to the current balance in the master record, and write the "newmast.txt" record. (Assume that purchases are indicated by positive amounts in the transaction file and payments by negative amounts.)
When there is a master record for a particular account, but no corresponding transaction record, merely write the master record to "newmast.txt". When there is a transaction record, but no corresponding master record, print to a log file the message "Unmatched transaction record for account number ..." (fill in the account number from the transaction record). The log file should be a text file named "log.txt".
Here is my following program code:
// Exercise 14.8: CreateTextFile.java
// creates a text file
import java.io.FileNotFoundException;
import java.lang.SecurityException;
import java.util.Formatter;
import java.util.FormatterClosedException;
import java.util.NoSuchElementException;
import java.util.Scanner;
import org.egan.AccountRecord;
import org.egan.TransactionRecord;
public class CreateTextFile
private Formatter output1; // object used to output text to file
private Formatter output2; // object used to output text to file
// enable user to open file
public void openTransFile()
try
output1 = new Formatter("trans.txt");
catch (SecurityException securityException)
System.err.println("You do not have write access to this file.");
System.exit(1);
} // end catch
catch (FileNotFoundException filesNotFoundException)
System.err.println("Error creating file.");
System.exit(1);
} // end method openTransFile
// enable user to open file
public void openOldMastFile()
try
output2 = new Formatter("oldmast.txt");
catch (SecurityException securityException)
System.err.println("You do not have write access to this file.");
System.exit(1);
} // end catch
catch (FileNotFoundException filesNotFoundException)
System.err.println("Error creating file.");
System.exit(1);
} // end method openOldMastFile
// add transaction records to file
public void addTransactionRecords()
// object to be written to file
TransactionRecord record1 = new TransactionRecord();
Scanner input1 = new Scanner(System.in);
System.out.printf("%s\n%s\n%s\n%s\n\n",
"To terminate input, type the end-of-file indicator",
"when you are prompted to enter input.",
"On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
"On Windows type <ctrl> z then press Enter");
System.out.printf("%s\n%s",
"Enter account number (> 0) and amount.","? ");
while (input1.hasNext()) // loop until end-of-file indicator
try // output values to file
// retrieve data to be output
record1.setAccount(input1.nextInt()); // read account number
record1.setAmount(input1.nextDouble()); // read amount
if (record1.getAccount() > 0)
// write new record
output1.format("%d %.2f\n", record1.getAccount(), record1.getAmount());
} // end if
else
System.out.println("Account number must be greater than 0.");
} // end else
} // end try
catch (FormatterClosedException formatterClosedException)
System.err.println("Error writing to file.");
return;
} // end catch
catch (NoSuchElementException elementException)
System.err.println("Invalid input. Please try again.");
input1.nextLine(); // discard input so user can try again
} // end catch
System.out.printf("%s %s\n%s", "Enter account number (> 0) ",
"and amount.","? ");
} // end while
} // end method addTransactionRecords
// add account records to file
public void addAccountRecords()
// object to be written to file
AccountRecord record2 = new AccountRecord();
Scanner input2 = new Scanner(System.in);
System.out.printf("%s\n%s\n%s\n%s\n\n",
"To terminate input, type the end-of-file indicator",
"when you are prompted to enter input.",
"On UNIX/Linux/Mac OS X type <ctrl> d then press Enter",
"On Windows type <ctrl> z then press Enter");
System.out.printf("%s\n%s",
"Enter account number (> 0), first name, last name and balance.","? ");
while (input2.hasNext()) // loop until end-of-file indicator
try // output values to file
// retrieve data to be output
record2.setAccount(input2.nextInt()); // read account number
record2.setFirstName(input2.next()); // read first name
record2.setLastName(input2.next()); // read last name
record2.setBalance(input2.nextDouble()); // read balance
if (record2.getAccount() > 0)
// write new record
output2.format("%d %s %s %.2f\n", record2.getAccount(), record2.getFirstName(),
record2.getLastName(), record2.getBalance());
} // end if
else
System.out.println("Account number must be greater than 0.");
} // end else
} // end try
catch (FormatterClosedException formatterClosedException)
System.err.println("Error writing to file.");
return;
} // end catch
catch (NoSuchElementException elementException)
System.err.println("Invalid input. Please try again.");
input2.nextLine(); // discard input so user can try again
} // end catch
System.out.printf("%s %s\n%s", "Enter account number (> 0),",
"first name, last name and balance.","? ");
} // end while
} // end method addAccountRecords
// close file
public void closeTransFile()
if (output1 != null)
output1.close();
} // end method closeTransFile
// close file
public void closeOldMastFile()
if (output2 != null)
output2.close();
} // end method closeOldMastFile
} // end class CreateTextFile--------------------------------------------------------------------------------------------------
// Exercise 14.8: CreateTextFileTest.java
// Testing class CreateTextFile
public class CreateTextFileTest
// main method begins program execution
public static void main( String args[] )
CreateTextFile application = new CreateTextFile();
application.openTransFile();
application.addTransactionRecords();
application.closeTransFile();
application.openOldMastFile();
application.addAccountRecords();
application.closeOldMastFile();
} // end main
} // end class CreateTextFileTest-------------------------------------------------------------------------------------------------
// Exercise 14.8: TransactionRecord.java
// A class that represents on record of information
package org.egan; // packaged for reuse
public class TransactionRecord
private int account;
private double amount;
// no-argument constructor calls other constructor with default values
public TransactionRecord()
this(0,0.0); // call two-argument constructor
} // end no-argument AccountRecord constructor
// initialize a record
public TransactionRecord(int acct, double amt)
setAccount(acct);
setAmount(amt);
} // end two-argument TransactionRecord constructor
// set account number
public void setAccount(int acct)
account = acct;
} // end method setAccount
// get account number
public int getAccount()
return account;
} // end method getAccount
// set amount
public void setAmount(double amt)
amount = amt;
} // end method setAmount
// get amount
public double getAmount()
return amount;
} // end method getAmount
} // end class TransactionRecord -------------------------------------------------------------------------------------------------
// Exercise 14.8: AccountRecord.java
// A class that represents on record of information
package org.egan; // packaged for reuse
import org.egan.TransactionRecord;
public class AccountRecord
private int account;
private String firstName;
private String lastName;
private double balance;
// no-argument constructor calls other constructor with default values
public AccountRecord()
this(0,"","",0.0); // call four-argument constructor
} // end no-argument AccountRecord constructor
// initialize a record
public AccountRecord(int acct, String first, String last, double bal)
setAccount(acct);
setFirstName(first);
setLastName(last);
setBalance(bal);
} // end four-argument AccountRecord constructor
// set account number
public void setAccount(int acct)
account = acct;
} // end method setAccount
// get account number
public int getAccount()
return account;
} // end method getAccount
// set first name
public void setFirstName(String first)
firstName = first;
} // end method setFirstName
// get first name
public String getFirstName()
return firstName;
} // end method getFirstName
// set last name
public void setLastName(String last)
lastName = last;
} // end method setLastName
// get last name
public String getLastName()
return lastName;
} // end method getLastName
// set balance
public void setBalance(double bal)
balance = bal;
} // end method setBalance
// get balance
public double getBalance()
return balance;
} // end method getBalance
// combine balance and amount
public void combine(TransactionRecord record)
balance = (getBalance() + record.getAmount());
} // end method combine
} // end class AccountRecord -------------------------------------------------------------------------------------------------
// Exercise 14.8: FileMatch.java
import java.io.File;
import java.io.FileNotFoundException;
import java.lang.IllegalStateException;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.Formatter;
import java.util.FormatterClosedException;
import org.egan.AccountRecord;
import org.egan.TransactionRecord;
public class FileMatch
private Scanner inTransaction;
private Scanner inOldMaster;
private Formatter outNewMaster;
private Formatter theLog;
// enable user to open file
public void openTransFile()
try
inTransaction = new Scanner(new File("trans.txt"));
} // end try
catch (FileNotFoundException fileNotFoundException)
System.err.println("Error opening file.");
System.exit(1);
} // end catch
} // end method openTransFile
// enable user to open file
public void openOldMastFile()
try
inOldMaster = new Scanner(new File("oldmast.txt"));
} // end try
catch (FileNotFoundException fileNotFoundException)
System.err.println("Error opening file.");
System.exit(1);
} // end catch
} // end method openOldMastFile
// enable user to open file
public void openNewMastFile()
try
outNewMaster = new Formatter("newmast.txt");
catch (SecurityException securityException)
System.err.println("You do not have write access to this file.");
System.exit(1);
} // end catch
catch (FileNotFoundException filesNotFoundException)
System.err.println("Error creating file.");
System.exit(1);
} // end method openNewMastFile
// enable user to open file
public void openLogFile()
try
theLog = new Formatter("log.txt");
catch (SecurityException securityException)
System.err.println("You do not have write access to this file.");
System.exit(1);
} // end catch
catch (FileNotFoundException filesNotFoundException)
System.err.println("Error creating file.");
System.exit(1);
} // end method openLogFile
// update records
public void updateRecords()
TransactionRecord transaction = new TransactionRecord();
AccountRecord account = new AccountRecord();
try // read records from file using Scanner object
System.out.println("Start file matching.");
while (inTransaction.hasNext() && inOldMaster.hasNext())
transaction.setAccount(inTransaction.nextInt()); // read account number
transaction.setAmount(inTransaction.nextDouble()); // read amount
account.setAccount(inOldMaster.nextInt()); // read account number
account.setFirstName(inOldMaster.next()); // read first name
account.setLastName(inOldMaster.next()); // read last name
account.setBalance(inOldMaster.nextDouble()); // read balance
if (transaction.getAccount() == account.getAccount())
while (inTransaction.hasNext() && transaction.getAccount() == account.getAccount())
account.combine(transaction);
outNewMaster.format("%d %s %s %.2f\n",
account.getAccount(), account.getFirstName(), account.getLastName(),
account.getBalance());
transaction.setAccount(inTransaction.nextInt()); // read account number
transaction.setAmount(inTransaction.nextDouble()); // read amount
else if (transaction.getAccount() != account.getAccount())
outNewMaster.format("%d %s %s %.2f\n",
account.getAccount(), account.getFirstName(), account.getLastName(),
account.getBalance());
theLog.format("%s%d","Unmatched transaction record for account number ",transaction.getAccount());
} // end while
System.out.println("Finish file matching.");
} // end try
catch (NoSuchElementException elementException)
System.err.println("File improperly formed.");
inTransaction.close();
inOldMaster.close();
System.exit(1);
} // end catch
catch (IllegalStateException stateException)
System.err.println("Error reading from file.");
System.exit(1);
} // end catch
} // end method updateRecords
// close file and terminate application
public void closeTransFile()
if (inTransaction != null)
inTransaction.close();
} // end method closeTransFile
// close file and terminate application
public void closeOldMastFile()
if (inOldMaster != null)
inOldMaster.close();
} // end method closeOldMastFile
// close file
public void closeNewMastFile()
if (outNewMaster != null)
outNewMaster.close();
} // end method closeNewMastFile
// close file
public void closeLogFile()
if (theLog != null)
theLog.close();
} // end method closeLogFile
} // end class FileMatch-------------------------------------------------------------------------------------------------
// Exercise 14.8: FileMatchTest.java
// Testing class FileMatch
public class FileMatchTest
// main method begins program execution
public static void main( String args[] )
FileMatch application = new FileMatch();
application.openTransFile();
application.openOldMastFile();
application.openNewMastFile();
application.openLogFile();
application.updateRecords();
application.closeLogFile();
application.closeNewMastFile();
application.closeOldMastFile();
application.closeTransFile();
} // end main
} // end class FileMatchTest-------------------------------------------------------------------------------------------------
Sample data for master file:
Master file
Account Number Name Balance
100 Alan Jones 348.17
300 Mary Smith 27.19
500 Sam Sharp 0.00
700 Suzy Green -14.22Sample data for transaction file:
Transaction file Transaction
Account Number Amount
100 27.14
300 62.11
300 83.89
400 100.56
700 80.78
700 1.53
900 82.17 -------------------------------------------------------------------------------------------------
My FileMatch class program above has bugs in it.
The correct results for the newmast.txt:
100 Alan Jones 375.31
300 Mary Smith 173.19
500 Sam Sharp 0.00
700 Suzy Green 68.09The correct results for the log.txt:
Unmatched transaction record for account number 400Unmatched transaction record for account number 900------------------------------------------------------------------------------------------------
My results for the newmast.txt:
100 Alan Jones 375.31
300 Mary Smith 111.08
500 Sam Sharp 0.00
700 Suzy Green -12.69My results for the log.txt
Unmatched transaction record for account number 700-------------------------------------------------------------------------------------------------
I am not sure what is wrong with my code above to make my results different from the correct results.
Much help is appreciated. Please help.From the output, it looks like one problem is just formatting -- apparently you're including a newline in log entries and not using tabs for the newmast output file.
As to why the numbers are off -- just from glancing over it, it appears that the problem is when you add multiple transaction values. Since account.combine() is so simple, I suspect that you're either adding creating transaction objects incorrectly or not creating them when you should be.
Create test input data that isolates a single case of this (e.g., just the Mary Smith case), and then running your program in a debugger or adding debugging code to the add/combine method, so you can see what's happening in detail.
Also I'd recommend reconsidering your design. It's a red flag if a class has a name with "Create" in it. Classes represent bundles of independant state and transformations on that state, not things to do. -
Need help pointing email mx records to correct locations
Hello,
My customer stopped recieving emails when I took his site live with BC. I called Godaddy who his email was already set up with. They told me I needed to get two mx records pointed to the correct locations. THey gave me the locations, but I can not find where I can change them in Muse.
Thank you in advance for any help that masy be offered.Hi,
Are you still experiencing this issue. If yes, please let me know and I will help you further. -
Need help in storing data from JList into a vector
need help in doing the following.-
alright i click a skill on industryskills Jlist and press the add button and it'll be added to the applicantskills Jlist. how do i further store this data that i added onto the applicantskills JList into a vector.
here are the codes:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.text.*;
import java.util.*;
import java.util.Vector;
import javax.swing.JScrollPane.*;
//import javax.swing.event.ListSelectionListener;
public class Employment extends JFrame
//declare class variables
private JPanel jpApplicant, jpEverything,jpWEST, jpCENTRE, jpEAST, jpAddEditDelete,
jpCentreTOP, jpCentreBOT, jpEastTOP, jpEastCENTRE, jpEastBOT,
jpBlank1, panel1, panel2, panel3, panel4,jpBottomArea,
jpEmptyPanelForDisplayPurposes;
private JLabel jlblApplicantForm, jlblAppList, jlblName, jlblPhone,
jlblCurrentSalary, jlblPassword, jlblDesiredSalary,
jlblNotes, jlblApplicantSkills, jlblIndustrySkills,
jlblBlank1, jlblBlank2, ApplicantListLabel,
NotesListLabel, ApplicantSkillsLabel,
IndustrySkillsLabel,jlblEmptyLabelForDisplayPurposes;
private JButton jbtnAdd1, jbtnEdit, jbtnDelete, jbtnSave, jbtnCancel,
jbtnAdd2, jbtnRemove;
private JTextField jtfName, jtfPhone, jtfCurrentSalary, jtfPassword,
jtfDesiredSalary;
private JTabbedPane tabbedPane;
private DefaultListModel /*listModel,*/listModel2;
String name,password,phone,currentsalary,desiredsalary,textareastuff,NotesText;
String selectedname;
final JTextArea Noteslist= new JTextArea();;
DefaultListModel listModel = new DefaultListModel();
JList ApplicantSkillsList = new JList(listModel);
private ListSelectionModel listSelectionModel;
JList ApplicantList, /*ApplicantSkillsList,*/ IndustrySkillsList;
//protected JTextArea NotesList;
//Vector details = new Vector();
Vector<StoringData> details = new Vector<StoringData>();
public static void main(String []args)
Employment f = new Employment();
f.setVisible(true);
f.setDefaultCloseOperation(EXIT_ON_CLOSE);
f.setResizable(false);
}//end of main
public Employment()
setSize(800,470);
setTitle("E-commerce Placement Agency");
Font listfonts = new Font("TimesRoman", Font.BOLD, 12);
JPanel topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );
createPage1();
createPage2();
createPage3();
createPage4();
tabbedPane = new JTabbedPane();
tabbedPane.addTab( "Applicant", panel1 );
tabbedPane.addTab( "Job Order", panel2 );
tabbedPane.addTab( "Skill", panel3 );
tabbedPane.addTab( "Company", panel4 );
topPanel.add( tabbedPane, BorderLayout.CENTER );
public void createPage1()//PAGE 1
/*******************TOP PART********************/
panel1 = new JPanel();
panel1.setLayout( new BorderLayout());
jpBottomArea = new JPanel();
jpBottomArea.setLayout(new BorderLayout());
jpApplicant= new JPanel();
jpApplicant.setLayout(new BorderLayout());
Font bigFont = new Font("TimesRoman", Font.BOLD,24);
jpApplicant.setBackground(Color.lightGray);
jlblApplicantForm = new JLabel("\t\t\t\tAPPLICANT FORM ");
jlblApplicantForm.setFont(bigFont);
jpApplicant.add(jlblApplicantForm,BorderLayout.EAST);
panel1.add(jpApplicant,BorderLayout.NORTH);
panel1.add(jpBottomArea,BorderLayout.CENTER);
/********************************EMPTY PANEL FOR DISPLAY PURPOSES*************************/
jpEmptyPanelForDisplayPurposes = new JPanel();
jlblEmptyLabelForDisplayPurposes = new JLabel(" ");
jpEmptyPanelForDisplayPurposes.add(jlblEmptyLabelForDisplayPurposes);
jpBottomArea.add(jpEmptyPanelForDisplayPurposes,BorderLayout.NORTH);
/*****************************************WEST*********************************/
jpWEST = new JPanel();
jpWEST.setLayout( new BorderLayout());
//Applicant List
listModel2=new DefaultListModel();
ApplicantList = new JList(listModel2);
listSelectionModel = ApplicantList.getSelectionModel();
listSelectionModel.addListSelectionListener(new SharedListSelectionHandler());
JScrollPane scrollPane3 = new JScrollPane(ApplicantList);
ApplicantList.setPreferredSize(new Dimension(20,40));
scrollPane3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
scrollPane3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
ApplicantListLabel = new JLabel( "Applicant List:");
jpWEST.add(ApplicantListLabel,"North");
jpWEST.add(scrollPane3,"Center");
jpBottomArea.add(jpWEST,BorderLayout.WEST);
/*********CENTRE*********/
jpCENTRE = new JPanel();
jpCENTRE.setLayout(new GridLayout(2,1));
jpCentreTOP = new JPanel();
jpBottomArea.add(jpCENTRE,BorderLayout.CENTER);
jpCENTRE.add(jpCentreTOP);
jpCentreTOP.setLayout(new GridLayout(6,2));
//Creating labels and textfields
jlblName = new JLabel( "Name:");
jlblBlank1 = new JLabel ("");
jtfName = new JTextField(18);
jlblBlank2 = new JLabel("");
jlblPhone = new JLabel("Phone:");
jlblCurrentSalary = new JLabel("Current Salary:");
jtfPhone = new JTextField(13);
jtfCurrentSalary = new JTextField(7);
jlblPassword = new JLabel("Password:");
jlblDesiredSalary = new JLabel("Desired Salary:");
jtfPassword = new JTextField(13);
jtfDesiredSalary = new JTextField(6);
//Add labels and textfields to panel
jpCentreTOP.add(jlblName);
jpCentreTOP.add(jlblBlank1);
jpCentreTOP.add(jtfName);
jpCentreTOP.add(jlblBlank2);
jpCentreTOP.add(jlblPhone);
jpCentreTOP.add(jlblCurrentSalary);
jpCentreTOP.add(jtfPhone);
jpCentreTOP.add(jtfCurrentSalary);
jpCentreTOP.add(jlblPassword);
jpCentreTOP.add(jlblDesiredSalary);
jpCentreTOP.add(jtfPassword);
jpCentreTOP.add(jtfDesiredSalary);
//Noteslist
jpCentreBOT = new JPanel();
jpCentreBOT.setLayout( new BorderLayout());
jpCENTRE.add(jpCentreBOT);
jpBlank1 = new JPanel();
// Noteslist = new JTextArea(/*Document doc*/);
JScrollPane scroll3=new JScrollPane(Noteslist);
scroll3.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scroll3.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
NotesListLabel = new JLabel( "Notes:");
jpCentreBOT.add(NotesListLabel,"North");
jpCentreBOT.add(scroll3,"Center");
jpCentreBOT.add(jpBlank1,"South");
jpBottomArea.add(jpCENTRE,BorderLayout.CENTER);
/**********EAST**********/
//Applicant Skills Panel
//EAST ==> TOP
jpEAST = new JPanel();
jpEAST.setLayout( new BorderLayout());
jpEastTOP = new JPanel();
jpEastTOP.setLayout( new BorderLayout());
ApplicantSkillsLabel = new JLabel( "Applicant Skills");
JScrollPane scrollPane1 = new JScrollPane(ApplicantSkillsList);
scrollPane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
ApplicantSkillsList.setVisibleRowCount(6);
jpEastTOP.add(ApplicantSkillsLabel,"North");
jpEastTOP.add(scrollPane1,"Center");
jpEAST.add(jpEastTOP,BorderLayout.NORTH);
jpBottomArea.add(jpEAST,BorderLayout.EAST);
//Add & Remove Buttons
//EAST ==> CENTRE
jpEastCENTRE = new JPanel();
jpEAST.add(jpEastCENTRE,BorderLayout.CENTER);
jbtnAdd2 = new JButton("Add");
jbtnRemove = new JButton("Remove");
//add buttons to panel
jpEastCENTRE.add(jbtnAdd2);
jpEastCENTRE.add(jbtnRemove);
//add listener to button
jbtnAdd2.addActionListener(new Add2Listener());
jbtnRemove.addActionListener(new RemoveListener());
//Industry Skills Panel
//EAST ==> BOTTOM
jpEastBOT = new JPanel();
jpEastBOT.setLayout( new BorderLayout());
String[] data = {"Access97", "Basic Programming",
"C++ Programming", "COBOL Programming",
"DB Design", "Fortran programming"};
IndustrySkillsList = new JList(data);
JScrollPane scrollPane = new JScrollPane(IndustrySkillsList);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
IndustrySkillsLabel = new JLabel( "Industry Skills:");
jpEastBOT.add(IndustrySkillsLabel,"North");
jpEastBOT.add(scrollPane,"Center");
jpEAST.add(jpEastBOT,BorderLayout.SOUTH);
//BOTTOM
jpAddEditDelete= new JPanel();
jbtnAdd1= new JButton("Add");
jbtnEdit= new JButton("Edit");
jbtnDelete= new JButton("Delete");
jbtnSave= new JButton("Save");
jbtnCancel= new JButton("Cancel");
jpAddEditDelete.add(jbtnAdd1);
jpAddEditDelete.add(jbtnEdit);
jpAddEditDelete.add(jbtnDelete);
jpAddEditDelete.add(jbtnSave);
jpAddEditDelete.add(jbtnCancel);
jbtnEdit.addActionListener(new EditListener());
jbtnDelete.addActionListener(new DeleteListener());
jbtnEdit.addActionListener(new EditListener());
jbtnAdd1.addActionListener(new Add1Listener());
jbtnCancel.addActionListener(new CancelListener());
jpBottomArea.add(jpAddEditDelete,BorderLayout.SOUTH);
public void createPage2()//PAGE 2
panel2 = new JPanel();
panel2.setLayout( new GridLayout(1,1) );
panel2.add( new JLabel( "Sorry,under construction" ) );
public void createPage3()//PAGE 3
panel3 = new JPanel();
panel3.setLayout( new GridLayout( 1, 1 ) );
panel3.add( new JLabel( "Sorry,under construction" ) );
public void createPage4()//PAGE 4
panel4 = new JPanel();
panel4.setLayout( new GridLayout( 1, 1 ) );
panel4.add( new JLabel( "Sorry,under construction" ) );
public class Add1Listener implements ActionListener
public void actionPerformed(ActionEvent e)
name = jtfName.getText();
password = jtfPassword.getText();
phone = jtfPhone.getText();
currentsalary = jtfCurrentSalary.getText();
int i= Integer.parseInt(currentsalary);
desiredsalary = jtfDesiredSalary.getText();
int j= Integer.parseInt(desiredsalary);
StoringData person = new StoringData(name,password,phone,i,j);
// StoringData AppSkillsList = new StoringData(listModel);
details.add(person);
// details.add(AppSkillsList);
listModel2.addElement(name);
jtfName.setText("");
jtfPassword.setText("");
jtfPhone.setText("");
jtfCurrentSalary.setText("");
jtfDesiredSalary.setText("");
// NotesList.setText("");
public class Add2Listener implements ActionListener
public void actionPerformed(ActionEvent e)
String temp1;
temp1 = (String)IndustrySkillsList.getSelectedValue();
listModel.addElement(temp1);
public class RemoveListener implements ActionListener
public void actionPerformed(ActionEvent e)
int index = ApplicantSkillsList.getSelectedIndex();
listModel.remove(index);
public class EditListener implements ActionListener
public void actionPerformed(ActionEvent e)
jtfName.setEditable(true);
jtfPassword.setEditable(true);
jtfPhone.setEditable(true);
jtfCurrentSalary.setEditable(true);
jtfDesiredSalary.setEditable(true);
Noteslist.setEditable(true);
jbtnAdd2.setEnabled(true);
jbtnRemove.setEnabled(true);
jbtnSave.setEnabled(true);
jbtnCancel.setEnabled(true);
public class DeleteListener implements ActionListener
public void actionPerformed(ActionEvent e)
int index1 = ApplicantList.getSelectedIndex();
listModel2.remove(index1);
public class SaveListener implements ActionListener
public void actionPerformed(ActionEvent e)
public class CancelListener implements ActionListener
public void actionPerformed(ActionEvent e)
jtfName.setText("");
jtfPassword.setText("");
jtfPhone.setText("");
jtfCurrentSalary.setText("");
jtfDesiredSalary.setText("");
public class SharedListSelectionHandler implements ListSelectionListener
public void valueChanged(ListSelectionEvent e)
selectedname =ApplicantList.getSelectedValue().toString();
StoringData selectedPerson = null;
jtfName.setEditable(false);
jtfPassword.setEditable(false);
jtfPhone.setEditable(false);
jtfCurrentSalary.setEditable(false);
jtfDesiredSalary.setEditable(false);
Noteslist.setEditable(false);
jbtnAdd2.setEnabled(false);
jbtnRemove.setEnabled(false);
jbtnSave.setEnabled(false);
jbtnCancel.setEnabled(false);
for (StoringData person : details)
if (person.getName1().equals(selectedname))
selectedPerson = person;
jtfName.setText(person.getName1());
jtfPassword.setText(person.getPassword1());
jtfPhone.setText(person.getPhone1());
//String sal1 = Integer.parseString(currentsalary);
// String sal2 = Integer.parseString(desiredsalary);
// jtfCurrentSalary.setText(sal1);
// jtfDesiredSalary.setText(sal2);
break;
// if (selectedPerson != null)
}Quit posting 300 line programs to ask a question. We don't care about your entire application. We only care about code that demonstrates your current problem. We don't want to read through 300 lines to try and find the line of code that is causing the problem.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags so the code retains its original formatting.
Here is a simple SSCCE. Now make your changes and if you still have problems you have something simple to post. If it works then you add it to your real application.
Learn to simplify your problem by simplifying the code.
import java.awt.*;
import javax.swing.*;
public class ListTest2 extends JFrame
JList list;
public ListTest2()
String[] numbers = { "one", "two", "three", "four", "five", "six", "seven" };
list = new JList( numbers );
JScrollPane scrollPane = new JScrollPane( list );
getContentPane().add( scrollPane );
public static void main(String[] args)
ListTest2 frame = new ListTest2();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.setSize(200, 200);
frame.setLocationRelativeTo( null );
frame.setVisible( true );
} -
Need help in countdowntimer in java bean for jsp page
hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx
hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx
-
Navigation between records in a JSP application
Hi,
I would like to know how to provide navigation between records in a tabular form liked JSP application using JDeveloper 3.2
without using the Oracle or Default template.
I can do it with a singular record view but not in a tabular view. I like to know now I can mimic the navigation provided in Oracle template in which the current selected record is hightlighted. Can we navigate between records using Up and Down
arrow key like in Oracle form instead of using Navigation Bar. Please provide details code.
Thanks a bunch,
Khanh HoangYou can refer to the source code in jbohtmlsrc.zip for deriving your own implementation.
-
HR_INFOTYPE_OPERATION - Need help w/Deleting infotype records
Hello all,
We have an issue where infotype records got created where the ENDDA is less than the BEGDA (ENDDA = 06/30/2006 and BEGDA = 07/01/2006). We are trying to delete these using HR_INFOTYPE_OPERATION but we are getting message PG-009 (No data stored for 9001 in the selected period) returned in our tests.
BTW, 9001 is one of our customer infotypes.
I know I can remove these records using a direct SQL statement, but I would prefer to remove them more gracefully if possible. Is there a way around this error? I actually think function module HR_READ_INFOTYPE is raising the error.
Any suggestions would be greatly appreciated.
Thanks,
AlYou can check report RHRHDC00, I think it can help you with custom infotype too.
Otherwise you might need to delete the records forcefully using DELETE statement, which is not suggested since all the standard FM consider BEGDA and ENDDA and in your case they will always return blank.
You can also check FM -
HR_ECM_DELETE_INFOTYPE
Regards,
Amit
Reward all helpful replies. -
Really need help!! I cannot start J2EE server
Hi,
I have installed:
j2sdk-1_3_1_02-win.exe and j2sdkee-1_3_1-win.exe
and I have set the environment variables like this:
set PATH = C:\windows;C:\windows\command;c:\jdk1.3.1_02\bin;
set JAVA_HOME = c:\jdk1.3.1_02;
set J2EE_HOME = c:\j2sdkee1.3.1;
However, it still doesn't work when I type:
j2ee -verbose
it said:
ERROR; Set J2EE_HOME to the path of a valid j2sdkee.
Is there anything that I did it wrong?
Really sorry to raise such a silly question, but I really need to solve this problem.
Any help is really appreciated much!
regards,
EatonAs a last resort, you might try wrapping j2ee.bat in your own batch file, eg something like.
set J2EE_HOME=whatever
set PATH=%PATH%;%J2EE_HOME%\bin
call j2ee.bat -verbose
pause
I've had wierdness on WindowsME with environment variables (can't get at the environment AT ALL)
If you're using Win2K then you also have to contend with global env vars and user env vars, it might be worth checking which you've set. -
Need help with adobe audtion recording using a mic i wantto plug in
i need to record audio into adobe audtion using an external mic that i will plug intgo the mac. But whe i plug in the chord i still geth thw internal mic recording..any help please??????????????@
I'll stress that I use Windows not a Mac so I'm not expert on that sort of thing but this guide seems to give the information you need: How to Setup External Microphone in Mac - Make Tech Easier
Once you have the computer itself set up, the controls you need within Audition are on the Edt/Preferences/Audio Hardware menu. If the mic is properly recognised by the Mac operating system as per the link above, you should then find it on a drop down menu you can select from in Audition. -
Beginner! Need help getting started with recording music.
I am the definition of 'new' at the moment. I want to record my own music at home and I've been told that using an Apple Mac is one of the better ways to go about it at home.
I have a number of questions, most of which have probably been asked before (apologies!) starting right from the beginning.
1. What type of Mac would be best suited as a dedicated tool for recording music? Obviously speed and memory are big factors, but are there any other considerations here (available inputs, drivers, sound cards etc)? I'm hoping to keep the cost below AUS$3000 if possible.
2. Do i need any other hardware for this application? (this is where you can tell how inexperienced I am haha) such as mixers etc? If I should need a mixer, is there a particular type or brand of mixer that works well with Macs?
3. Will plugging a guitar amp into the mac improve sound quality over plugging the guitar directly into the Mac? I bought a Griggin Garage Band guitar cable a while ago to record some background music for a friend's DVD, and I found it worked well, but I'm looking for the best quality sound now.
4. What would be the most effective software to use? I've briefly used Garage Band and found that to be simple and useful, but I've heard that there are better software packages available.
I'm hoping to be able to record guitar, bass and vocals directly on to the Mac, and create drum tracks using samples and loops. I know how to play music but as you can tell I know very little about recording it! Any help or suggestions would be appreciated!
Thanks..I would presume one line level input will suffice?
Close, you need a Line Level AND Mic Level input since you'll want to record vocals.
Thanks for the link to your Q&A page, I found some very useful info there.
It's showing its age, and will hopeful get updated soon, but most of the info is good at least for a background.
Anyway, I think I might recommend this Presonus INSPIRE over the FireBox, it'll save you about $100 and since PreSonus makes excellent equipment (and we have an active member here that uses the Inspire), I'm confident that it offers great quality.
I think the firepod that you use looks great, but might be overkill
I agree, the FirePod would be serious overkill for your needs. Again, an awesome interface, but you'd be paying for all those Mic PREs, and using 1. That wouldn't make sense, and since the FP isn't cheap...
my talent and engineering knowledge is quite limited
Then I would strongly suggest GB as the software, and then do lots of reading. The weakest link in music production is your engineering skills. Mixing and Mastering (especially the latter) are art forms. A bad engineer using a $10,000 bit of software and hardware would make a fantastic performance sound like garbage. With good engineering skills you can make a pro recording with GB.
The learning curve with something like Logic is dramatically increased, and again, without the skills to take advantage of what it offers, your recordings are not going to sound any better. At the very least, start with GB to learn the skills of Recording/Editing/Mixing/Mastering. The "price of admission" is low enough that if in a year you find that you need a feature GB doesn't offer, your money will not have been wasted, it will have been valuable learning time.
Hope those more specific answers help
~~HangTIme [Will Compute for Food] %-)>
Note: I am an Amazon Associate, if you purchase this item via my link I will get a small commission) -
Need help on selection of records in dynamically created table
hi,
Ia m able to bind the onleadSelect event to the dynamially created table .
But i was not able to select the table records.
default first record was only selected.
can u help me out to find the way.
i am pasting the code for reference.
can u suggest me the right direction.
i want the selected record in the table to be dispalyed in another view thru this action event.
but only the forst record is now getting selected by default.
here the code.
IWDNode node =wdContext.currentContextElement().node().getChildNode(nodename,0);
for (int l = 0; l < node.size(); l++) {
int ele = node.getLeadSelection();
IWDNodeElement element= node.getElementAt(ele);
table.setOnLeadSelect(wdThis.wdGetObjectSelectedAction());Hi,
<a href="/people/sap.user72/blog/2005/05/09/have-you-played-blindfold-chess's</a> how to create a dynamic table, though I think you have already done this.
Do look at the comment that Armin Reichert has put in. Now in the source code that he has provided, the last line should be
table.setOnLeadSelect(wdThis.wdGetLeadSelectAction());
Have you done something similar to this?
Have you set the initializeLeadSelect property of the datasource node to true?
Regards,
Satyajit.
Message was edited by: Satyajit Chakraborty -
Need help:Urgent:MS SQL Server and J2EE Server
Hello,
i am developing simple bean managed persistence bean. i want to know how could i use microsoft SQL Server as my database with ejb's in J2EE. i don't want to use cloudscape rather i want to connect through jdbc bridge with sql server. can any body help me out ?
i have developed DSN for my database with the name of DsnProduct and user name for DB is guest and password is guest123.
so do i have to change configuration is my J2EE server . or put some additional code. so far i have added the following line in my implementation class
private String dbName= "java:comp/env/jdbc/ProductDB";
DataSource ds = (DataSource) ic.lookup(dbName);
con = ds.getConnection("guest","guest123");
moreover in server configuration i have added driver
sun.jdbc.odbc.JdbcOdbcDriver
and also provide the following JNDI Name
jdbc/ProductDB
and
it's url is
jdbc:odbc:DsnProduct
i am thankfull for your support.
[email protected]hi llturro,
Thanks for answering my question. I have tried out what you suggested, but I still can't fix my problem. The following are the messages that display when I try to run my servlet. It seems that the DataSource, Connection and Statement are ok, however when it comes to the ResultSet the error message appear. What's wrong with my ResultSet coding ?
ResultSet rs = stat.executeQuery("SELECT ISBN FROM BOOKSINFO WHERE ISBN='"+primarykey+"'");
setEntityContext Method
Find by primary key
DataSource OK
Connection OK
Primary Key = 013-00-675721-9
Statement OK
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
java.lang.NullPointerException
java.rmi.RemoteException: Unknown Exception/Error thrown by EJB method.; nested exception is:
java.lang.NullPointerException
java.lang.NullPointerException
<<no stack trace available>>
Maybe you are looking for
-
IPod is not showing up in ITune, but it is showing up in My computer
IPod is not recognized by ITune. It is recognized by my computer
-
Youtube playlists broken again?
I did a search on this and see several older lists with videos in playlists or favorites not being available in Apple TV. I have a couple playlists I regularly use that WERE working fine until the last s/w update. Now, those same playlists are missin
-
Windows command line to invoke jabber client
Hi there, We have an application running when jabber starts. Currently users have to start Jabber manually first and then start working with the app. Is there a way to invoke jabber from command-line with parameters such as credential? Thanks! L
-
Stackpower switches show in standalone mode
Hi, I have a stack of 8 3750x switches connected via Stackwise. In addition, I have these switches configured as two Powerstacks. When I look at the Powerstacks, they are showing as being in power-sharing mode. When I look at the individual switche
-
Satellite A100-192 (PSAA9E) FN+F8 key not working after updating BT driver
I've just download the update for the Bluetooth driver "blt-mon-20071009150856" and install the "BtMon2Inst_v212" driver on my A100-192 (PSAA9E). after the installation of "Toshiba Bluetooth 4" driver the BT works fine. BUT I can't use the wireless k