ravindran shanmugam

Greenhorn
+ Follow
since Aug 30, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ravindran shanmugam

Hi,
Set a default border for the desired button,
add a mouse listener to it.
use the mouse entered and mouse exited property toggle the border property of the button.
Try this code

regards
Ravindran Shanmugam
20 years ago
This works

- Ravindran.
20 years ago
1. Define an instance of JTableHeader as class level variable.
eg.

2. Define an instance of TableColumnModel as class level variable.
eg.


3. After creating the table, call getTableTeader on the JTable instance ( say jt) and set the value to jTableHeader.
eg.

4. Call getColumnModel method on jTableHeader instance and set the value to tableColumnModel
eg.

say you want to add a column on button Click,
add the following code in actionPerformed method
21 years ago
This problem happens when the server is not able to find mapping for the parameter you are passing as action.
for ex. if your JSP has

your struts-config.xml should have mapping for action parameter i.e. "/login"
something like

and you should have Action (LoginAction) and ActionForm (LoginFormBean) inside WEB-INF/classes folder.
Even after doing this if you are not getting the page try to
give a mapping for login page in struts-config.xml like this

and forward the request to login page from LoginAction.

in the browser call login.do instead of login.jsp
( i.e. here you are calling the Action class which forwards the request to JSP )
- Ravindran.
21 years ago
Yes, you can have many forms for a page in struts. but don't nest them.
Whenever a submit button is clicked the form tag covering it will be submitted.
- Ravindran.
21 years ago
JSP
I am getting an Exception while trying to access Web services behind a proxy server setup. I am using JWSDP(Java Web Services DevelopmentPack)for the development.
I am using the following fragment of code in my client program.

//Setting the proxy properties
Properties myprops = new Properties();
myprops.setProperty("http.proxySet","true");
myprops.setProperty("http.proxyHost","hostname");
myprops.setProperty("http.proxyPort","port");
//encoding the authentication information
String userid = new sun.misc.BASE64Encoder().encode("user".getBytes());
String password = new sun.misc.BASE64Encoder().encode("password".getBytes());
myprops.setProperty("http.proxyUserName",userid);
myprops.setProperty("http.proxyPassword",password);
//Setting the system properties
Properties props = System.getProperties();
Enumeration iter = myprops.propertyNames();
while (iter.hasMoreElements()) {
String s = (String) iter.nextElement();
props.put(s, myprops.getProperty(s));

//Rest of the codes are for constructing the soap connection and message object.
I am getting proxy authentication error, listed below
javax.xml.soap.SOAPException: Bad response: (407Proxy Authentication Required ( The ISA Server requi
res authorization to fulfill the request. Access to the Web Proxy service is denied. )
at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:267)

When we checked in our office proxy the request is coming from an anonymous user instead of the mentioned user id and password.
We are getting the same problem when we are suing the Apache AXIS tool kit.

In Apache SOAP tool kit there is an option for setting the proxy user id and password by using SOAPHTTPConnection. But we need to
use either JWSDP or Apache AXIS.
Solution to this problem would be highly appreciated.
Regards,
Saji
21 years ago
Try JavaCC, it is a compiler compiler tool ( JavaCC - Java Compiler Compiler )
it is close lex and yacc.
- Ravindran
21 years ago
Try this,
I've made two changes.
1) Include import java.awt.*;
2) adding the menu to a menubar and then setting the menubar to the JFrame.
**********************************************
import javax.swing.*;
import java.awt.*;
public class User_Case extends JFrame {
public static void main(String args[]){
new User_Case().show();
}
JToolBar tb ;
JButton sigB,invB,nandB,norB,andB,orB ;
Scrollbar sbV, sbH ;
public User_Case(){
super("User Cases");
setBackground( Color.white);
sbV = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 500 );
getContentPane().add( sbV, BorderLayout.EAST );
sbH = new Scrollbar(Scrollbar.HORIZONTAL, 0,5, 0,500 );
getContentPane().add( sbH, BorderLayout.SOUTH );
JPanel cenP = new JPanel();
getContentPane().setBackground(Color.white) ;
cenP.setBackground( Color.white );
getContentPane().add( cenP, BorderLayout.CENTER );
tb = new JToolBar() ;
tb.setBorderPainted( true );
tb.add(sigB = new JButton(new ImageIcon("button.jpg")) );
tb.add(invB = new JButton(new ImageIcon("button.jpg")) );
tb.add(nandB = new JButton(new ImageIcon("button.jpg")) );
tb.setFloatable( true );
tb.add(norB = new JButton(new ImageIcon("button.jpg")) );
tb.add(andB = new JButton(new ImageIcon("button.jpg")) );
tb.add(orB = new JButton(new ImageIcon("button.jpg")) );
getContentPane().add( tb, BorderLayout.NORTH );
//PROBLEM START
Menu fileMenu = new Menu("File");
MenuBar mb = new MenuBar();
fileMenu.add("New");
fileMenu.add("Open...");
fileMenu.addSeparator();
fileMenu.add("Close");
fileMenu.add("Save");
fileMenu.add("Save As...");
fileMenu.addSeparator();
fileMenu.add("Page Setup...");
fileMenu.add("Print");
fileMenu.addSeparator();
fileMenu.add("Quit");
mb.add(fileMenu);
setMenuBar(mb);
//add(fileMenu); //ERROR
setSize( 900, 700 ); // initial width, height
setLocation( 20,20 );
}
}
- Ravindran.
21 years ago
Check whether you have included,
1) IBM Enterprise Extension Libraries and
2) IBM WebSphere Test Environment.
in your Class path ( preferably press "Select All" and include all in the class path.)
Second thing is try giving JNDI lookup name as

Regards
Ravindran.
[ February 19, 2002: Message edited by: ravindran shanmugam ]
22 years ago
How do we actually get the database connection after that ?

I'm using the following class for getting connection ,

class DBConnect {
static DataSource ds = null;
static {
try {
Hashtable parms = new Hashtable();
parms.put(
Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
Context ctx = new InitialContext(parms);
ds = (DataSource) ctx.lookup("jdbc/jndi");
}catch(Exception e) {
}
}
public Connection getDBConnection(){
Connection conn = null;
try {
conn = ds.getConnection("USER","PASSWD");
}catch(Exception e) {
}
}
}
and calling getconnection whenever I need a connection. Will this not maintain a connection pool. In the help page Websphere states that getting connection thorugh DataSource will automatically maintain a connection Pool.
please include me in your loop
Regards
Ravindran.
22 years ago
import javax.swing.*;
import java.awt.event.*;
import javax.swing.event.*;
import java.awt.*;
public class Mycombo extends JFrame
{
public Mycombo()
{
JButton btnClear = new JButton("Clear");
final JComboBox cmbSelect = new JComboBox();
cmbSelect.addItem("");
cmbSelect.addItem("sdfw");
cmbSelect.addItem("mnbj");
cmbSelect.addItem("qerre");
cmbSelect.setEditable(true) ;
JPanel contentPane = new JPanel();
contentPane.setLayout(new BorderLayout());
contentPane.setPreferredSize(new Dimension(400, 150));
contentPane.add(cmbSelect, BorderLayout.CENTER);
contentPane.add(btnClear, BorderLayout.SOUTH);
setContentPane(contentPane);
btnClear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
cmbSelect.setSelectedItem("");
System.out.println("Selected value is "+ (cmbSelect.getSelectedItem()).toString()+ "edsrtger");
}
});
}
public static void main(String[] args)
{
JFrame frame = new Mycombo();
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
frame.pack();
frame.setVisible(true);
}
}
22 years ago
public static void main(String args[])
{
JButton jb[] = new JButton[Integer.parseInt(args[0])];
jb[0] = new JButton("df");
jb[1] = new JButton("dfsd");
// and then add it to the required frame
}
22 years ago
if your class extends JFrame,JWindow,Frame or any other container
use
Dimension d = getToolkit().getScreenSize();
otherwise ,
([frameinstance]).getToolkit().getScreenSize();
u can also get the screenResolution using
getToolkit().getScreenRevolution();
22 years ago
How can I transfer the focus to the previously focussed component . just like the transferFocus() which transfers the focus to next focussable component, I want to transfer the focus to the previuos focussable component ?
Thanx in advance.
22 years ago

Try this
JButton jb = new JButton("< HTML > Hello < BR > World < /HTML >");

[This message has been edited by ravindran shanmugam (edited August 30, 2001).]
22 years ago