John Smith

Greenhorn
+ Follow
since Oct 07, 2003
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 John Smith

I want to create JWindow that I can resize with a mouse. Here is my code. Dragging is fairly easy, but i can't figure out how to resize it.

public class Test extends JWindow implements MouseMotionListener,FocusListener
{
Point mousePointer;

public Test()
{
init();
setVisible(true);

}

public void init()
{
addMouseMotionListener(this);
setBounds(500, 500, 400, 400);

addFocusListener(this);
}

public void focusGained(FocusEvent aFocusEvent)
{
Point aPoint = getLocation();
setLocation(15000, 0);
setLocation(aPoint);
}

public void focusLost(FocusEvent aFocusEvent)
{
}

public void mouseDragged(MouseEvent aMouseEvent)
{
Point aPoint = aMouseEvent.getPoint();
int x = getX() + aPoint.x - mousePointer.x;
int y = getY() + aPoint.y - mousePointer.y;
setLocation(x, y);
Graphics graphics = getGraphics();
paint(graphics);
}

public void mouseClicked(MouseEvent me)
{
}

public void mouseMoved(MouseEvent aMouseEvent)
{
mousePointer = aMouseEvent.getPoint();
}

public void paint(Graphics graphics)
{
}

protected int getDefaultCursor(MouseEvent p_Evt)
{
return Cursor.DEFAULT_CURSOR;
}

public static void main(String[] args)
{
new Test();
}
}
15 years ago
this is my log4j.properties. I am using JBoss. I see log messages in my JBoss console, but for some reason, it is not writing to a log file.

I am not that familiar with the log4j. It would be grateful if someone can fix it.



log4j.rootLogger=INFO, stdout, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.appender.INFO=org.apache.log4j.ConsoleAppender

log4j.category.org=INFO


log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=D:\\example.log

log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=9
log4j.appender.R.append=true

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
I am using WSAD 5.1. I have a remote server where WebSphere 5 is installed. This remote server has JNDI name for oracle database connection pooling. What I am trying to do is that I am trying to get the db connection through this remote JNDI name(jdbc/MS). is there any way to do it? the server name is 'mslab'. Can someone write a code how to do it? i am not sure that this is related to InitialContext set up.

Thanks in advance.
17 years ago
which tag should I use to display the value in a JSP page by using struts tag?

Thanks..
17 years ago
I have a map to be iterated inside JSP with logic:iterate tag.

I have a sorted map, but when it is iterated over with logic:iterate tag, the sort order is not working. is there any way to keep the sort order?





messageTypeId is not sorted.. does anybody know why?

Thanks in advance.

[edited to remove smilies and make code more readable --JM]
[ March 28, 2005: Message edited by: Jason Menard ]
17 years ago
is there any resource or sample that shows how to disable radio button from action class?

I am trying to avoid java code inside the JSP page. I know that the attribute disable="false" disables radio button, but I am wondering if there is a way to set that attribute in the action class.

If someone knows, please teach me how to do it. It would be very grateful.
17 years ago
I have been trying to get some resources similar to my case, but i can't find any answers from anywhere. It would be very grateful if someone can solve this problem. I am just trying to retrieve data contained in iterate and display it in JSP by using logic:iterate tag. I can display it from bean:write, but i can't from html:radio tag.


DynaBean dynaForm = (DynaBean)form;
Map value = new HashMap();
value.put("2202", new AMSLabelValueBean("Client"));
dynaForm.set("field", value);
value.put("2203", new AMSLabelValueBean("Insurance"));
dynaForm.set("field", value);

request.setAttribute("messageTypes", value);


AMSLabelValueBean class contains setter and getter for 'label' field.



<logic:iterate id="types" name="messageTypes">
<bean efine id="labelKey"><bean:write name="types" property="key"/></bean efine>
<html:radio property='<%="field("+ labelKey + ")" %>' idName="types" value="label"/>
<tr>
<td><bean:write name="types" property="key"/>=<bean:write name="types" property="value"/></td>
</tr>
</logic:iterate>
17 years ago
I am trying to use Map for logic:iterate, but i can't figure it out. can someone help me out?

<form-bean name="messageOptionsForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="address" type="java.util.Map" />
</form-bean>

Map value = new HashMap();
value.put("city1", "Boston");
dynaForm.set("address", value);

value.put("city2", "New York City");
dynaForm.set("address", value);


request.setAttribute("addresses", value);


<logic:iterate id="address" name="addresses" indexId="idx">
<tr>
<td><html:radio name="address" property="value" value="address(key)"/>: <bean:write name="address" property="value"/></td>
</tr>
</logic:iterate>


Thanks..
17 years ago
My JSP
-------------------------------------------------------------------------
<logic:iterate id="choice" name="choices" indexId="idx"&rt;
<tr&rt;
<td&rt;<bean:write name="choice" property="label"/&rt;</td&rt;
<td&rt;<%=idx.intValue()%&rt;: <html:radio property='<%="control["+ idx + "]" %&rt;' idName="choice" value="intrusiveIndicator" "/&rt;</td&rt;
<td&rt;<html:radio property='<%="control["+ idx + "]" %&rt;' idName="choice" value="nonIntrusiveIndicator"/&rt;</td&rt;
<td&rt;<html:radio property='<%="control["+ idx + "]" %&rt;' idName="choice" value="unsubscribeIndicator"/&rt;</td&rt;
</tr&rt;
</logic:iterate&rt;
---------------------------------------------------------------------------

Struts-config.xml
---------------------------------------------------------------------------
<action path="/display_options" type="com.ubs.cmgr.ams.common.action.MessageOptionsAction" name="msgOptionForm"
scope="session" validate="false"&rt;
<forward name="success" path="/display_options_page.do" /&rt;
<forward name="fail" path="/index.do" /&rt;
</action&rt;
--------------------------------------------------------------------------

Action Class
--------------------------------------------------------------------------
DynaActionForm lf = (DynaActionForm)form;
String action = (String)request.getParameter("action");

log.info("lf.toString(): " + lf.toString());
Collection choices = new ArrayList();

choices.add(new AMSLabelValueBean("Client Letter"));
choices.add(new AMSLabelValueBean("COE Insurance - Cancel"));
choices.add(new AMSLabelValueBean("Dept Use Pending 1X"));

String[] choicesToArray = {};
if(action!=null)
{
//choicesToArray = (String[]) lf.get(CONTROL);
}

lf.set(CONTROL, new String[3]);
for(int i = 0; i < choicesToArray.length; i++)
{
log.info(CLASS_NAME +":messageType: " + choicesToArray[i]);
//lf.set(CONTROL, i, choicesToArray[i]);
}

saveToken(request);
request.getSession().setAttribute(CHOICES, choices);
---------------------------------------------------------------------------

does anybody know why I keep getting "java.lang.ArrayIndexOutOfBoundsException" error when I submit the form? The JSP code that I post is a part of form. it's Struts 1.1.

Thanks in advance.
17 years ago
here is my sample code from action class. The choices object might vary from ResultSet. I am using two items for testing iterate tag in JSP page.
-----------------------------------------------------------------
Collection choices = new ArrayList();
choices.add(new AMSLabelValueBean("Letter", "CL1", "CL2", "CL3"));
choices.add(new AMSLabelValueBean("Card", "CI1", "CI2", "CI3"));
request.setAttribute("choices", choices);


AMSLabelValueBean is just getter and setter method for "intrusiveIndicator" fields.
---------------------------------------------------------------------
here is struts-config.xml
<form-beans>
<form-bean name="radioForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="control" type="java.lang.String"/>
</form-bean>
</form-beans>
---------------------------------------------------------------------
Here is JSP
<logic:iterate id="choice" name="choices" indexId="idx">
<tr>
<td><bean:write name="choice" property="label"/></td>
<td><html:radio property="control" idName="choice<%=idx.intValue()%>" value="intrusiveIndicator"/></td>
</tr>
</logic:iterate>

I am trying to get incremental names for radio buttons, but it says "No getter method available for property control<%=idx.intValue()%> for bean under name org.apache.struts.taglib.html.BEAN". I am not sure that I am providing enouch code. but it would be very helpful if someone can answer. I am just trying to generate dynamic radio buttons depending on result set coming from a database.

Thanks.
17 years ago
great, thanks.
17 years ago
I have a collection that might contain 5 or 7 values. it might vary, but I want them to display in 3 rows by 3 columns by using iteration tag. so the tricky thing is that I don't know how to put "<br>" after each 3rd and 6th value. I am just wondering if it is possible to use it with Struts' currently existing tags or I have to create my own tags.

Thanks..
17 years ago
I just installed websphere application server 4 on oracle 9i. but i can't open the Administrator's console. I made sure that all the services related to IBM Websphere started without any problem.

Before I installed Websphere 4, i created new user/password(ejsadmin/ejsadmin_pswd) on oracle 9i for Websphere 4 and selected them when i was installing websphere 4. the installation was ok. but I can't open the console.

if i execute "adminclient" on the command prompt, the initial screen of the console starts and nothing happens.

but if i try "adminclient 6000" with a different port, i got
"ADGU2008E": The Administration Client failed to connect to the Administration Server. Start the local or remote Administration Server service before launching the Administration Client."

Here is the log that i got.
listContainedObjects /BeanId(admin#repository.jar#ClientAccess, null) �������� � IBM WebSphere AE 4.0.1 a0131.07 com.ibm.ws.naming.util.Helpers 7f4f2af2 3584 samson/__adminServer jndiNamingException (com.ibm.ws.naming.util.WsnResourceBundle 451-3584:samson/__adminServer } !com.ibm.ejs.ns.jndi.CNContextImpl lookup ,domainRoots/UnspecifiedDomainName/legacyRoot ejsadmin/homes/EnterpriseAppHome 3javax.naming.NameNotFoundException: ejsadmin/homes/EnterpriseAppHome
at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1435)
at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1115)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.ejs.sm.tasks.RoleAssignmentTaskBean.ejbCreate(RoleAssignmentTaskBean.java:1586)
at com.ibm.ejs.sm.tasks.EJSStatefulRoleAssignmentTaskHomeBean.create(EJSStatefulRoleAssignmentTaskHomeBean.java:29)
at com.ibm.ejs.sm.tasks.EJSRemoteStatefulRoleAssignmentTaskHome.create(EJSRemoteStatefulRoleAssignmentTaskHome.java:25)
at com.ibm.ejs.sm.tasks._EJSRemoteStatefulRoleAssignmentTaskHome_Tie._invoke(_EJSRemoteStatefulRoleAssignmentTaskHome_Tie.java:87)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2294)
at com.ibm.CORBA.iiop.OrbWorker.run(OrbWorker.java:185)
at com.ibm.ejs.oa.pool.ThreadPool$PooledWorker.run(ThreadPool.java:95)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
S IBM WebSphere AE 4.0.1 a0131.07 (com.ibm.ejs.container.util.ExceptionUtil 7f4f2af2 3584 samson/__adminServer BNon-application.exception.occurred.while.processing.method.{1}.{0} com.ibm.ejs.container.container 451-3584:samson/__adminServer } ,java.rmi.RemoteException: ADMT0314E: Could not get EnterpriseAppHome.; nested exception is:
javax.naming.NameNotFoundException: ejsadmin/homes/EnterpriseAppHome
javax.naming.NameNotFoundException: ejsadmin/homes/EnterpriseAppHome
at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1435)
at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1115)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.ejs.sm.tasks.RoleAssignmentTaskBean.ejbCreate(RoleAssignmentTaskBean.java:1586)
at com.ibm.ejs.sm.tasks.EJSStatefulRoleAssignmentTaskHomeBean.create(EJSStatefulRoleAssignmentTaskHomeBean.java:29)
at com.ibm.ejs.sm.tasks.EJSRemoteStatefulRoleAssignmentTaskHome.create(EJSRemoteStatefulRoleAssignmentTaskHome.java:25)
at com.ibm.ejs.sm.tasks._EJSRemoteStatefulRoleAssignmentTaskHome_Tie._invoke(_EJSRemoteStatefulRoleAssignmentTaskHome_Tie.java:87)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2294)
at com.ibm.CORBA.iiop.OrbWorker.run(OrbWorker.java:185)
at com.ibm.ejs.oa.pool.ThreadPool$PooledWorker.run(ThreadPool.java:95)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
----- Begin backtrace for detail
javax.naming.NameNotFoundException: ejsadmin/homes/EnterpriseAppHome
at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1435)
at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1115)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.ejs.sm.tasks.RoleAssignmentTaskBean.ejbCreate(RoleAssignmentTaskBean.java:1586)
at com.ibm.ejs.sm.tasks.EJSStatefulRoleAssignmentTaskHomeBean.create(EJSStatefulRoleAssignmentTaskHomeBean.java:29)
at com.ibm.ejs.sm.tasks.EJSRemoteStatefulRoleAssignmentTaskHome.create(EJSRemoteStatefulRoleAssignmentTaskHome.java:25)
at com.ibm.ejs.sm.tasks._EJSRemoteStatefulRoleAssignmentTaskHome_Tie._invoke(_EJSRemoteStatefulRoleAssignmentTaskHome_Tie.java:87)
at com.ibm.CORBA.iiop.ExtendedServerDelegate.dispatch(ExtendedServerDelegate.java:506)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:2294)
at com.ibm.CORBA.iiop.OrbWorker.run(OrbWorker.java:185)
at com.ibm.ejs.oa.pool.ThreadPool$PooledWorker.run(ThreadPool.java:95)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
create null

Please help me~
18 years ago
I have a simple web services for testing. it just returns data from a database. i don't know what is wrong. it seems to be wrong with my classpath, but i am just following an instruction that AXIS provided.



AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace: AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
faultActor:
faultNode:
faultDetail:

org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1204)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:393)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at localhost.ProjectDetailsSoapBindingStub.setProjectId(ProjectDetailsSoapBindingStub.java:196)
at ProjectDetailsImpl.main(ProjectDetailsImpl.java:34)


org.xml.sax.SAXNotRecognizedException: Feature: http://xml.org/sax/properties/lexical-handler
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:260)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:169)
at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1015)
at org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1403)
at org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator.java:1550)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:1204)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098)
at javax.xml.parsers.SAXParser.parse(SAXParser.java:393)
at org.apache.axis.encoding.DeserializationContextImpl.parse(DeserializationContextImpl.java:242)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:538)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:376)
at org.apache.axis.client.Call.invokeEngine(Call.java:2583)
at org.apache.axis.client.Call.invoke(Call.java:2553)
at org.apache.axis.client.Call.invoke(Call.java:2248)
at org.apache.axis.client.Call.invoke(Call.java:2171)
at org.apache.axis.client.Call.invoke(Call.java:1691)
at localhost.ProjectDetailsSoapBindingStub.setProjectId(ProjectDetailsSoapBindingStub.java:196)
at ProjectDetailsImpl.main(ProjectDetailsImpl.java:34)


here is my classpath in my client side.
set classpath=.;D:\Tomcat\webapps\axis\WEB-INF\lib\axis.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\lib\jaxrpc.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\lib\saaj.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\lib\commons-logging.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\lib\commons-discovery.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\lib\wsdl4j.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\lib\axis.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\lib\log4j-1.2.8.jar
set classpath=%classpath%;D:\Java\jar_library\xerces.jar
set classpath=%classpath%;D:\Tomcat\webapps\axis\WEB-INF\classes\;


The weird thing is that it works in my workplace, but it doesn't in my home PC. i am using the same classpath. please help...

thanks...
18 years ago
I want to place jsp/servlet files in other directory instead of Tomcat\webapps directory. is there any way to do this? or any documentation?

thanks in advance...
19 years ago