Win a copy of Create an Uber Clone in 7 Days: Build a real world full stack mobile app in Java this week in the Android forum!

SoonAnn Lim

Ranch Hand
+ Follow
since Jun 21, 2001
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 SoonAnn Lim

I am not very clear about this.
<bean:write property="age" /> will output to the page. How can I assign this value in jsp scriptlet?
<% int age = <bean:write property="age"/> ; %>
Something like that?

Thanks
14 years ago
Hi,
I am using Struts 1.1 in this topic. I have a very simple page with only 1 input field for age. I assign it to DynaActionForm with request scope. Then I create a simple Action class that does nothing but forwarding to the landing page, which is a jsp page. At landing page, I want to display different messages based on the age field in Formbean. At landing page, I am trying to get the value of age field from the FormBean and assign it to a java variable so I can perform logic in jsp page, meaning using <% %> scriplet. Here is the pseudocode of landing page
########################################
<% Get Age field and assign to java variable.
If (Age < 10) {
%>
Hello Kid
<% }else if (Age between 10 - 20){
%>
Hello Dude
<% }else{
%>
Hello Folks
<% } %>
##########################################
Can someone give me some clue?
Thanks

########################################
14 years ago
###########################################
#app_types is an array of DTO, which is
#a collection of Javabean class.
##############################################
<form-beans>
<form-bean name="beanForm"
dynamic="true"
type="org.apache.struts.action.DynaActionForm">
<form-property name="app_types"
type="java.util.Collection" />
</form-bean>
</form-beans>
###########################################
<action-mappings>
<action path="/test/pattern/input"
type="test.action.InputAction"
name="beanForm"
scope="request">
<forward name="logininput" path="/logininputpage.jsp" />
</action>
</action-mappings>
###########################################
I do not edit web.xml. It is the default comes with Tomcate 4.

Regards,
14 years ago
Hi,
I am trying to create login page with a selection box. Content of the selection box is dynamic, ie. I need an action class to generate the content for the selection. Most examples I read use a static jsp page that contains hard coded selection and username/password field.
I have tried to create an action class return the content of selection box. This action class is configured to forward user to login page. I have setup struts-config.xml with appropriate form-bean and action. However, when I type in the path pattern for <action> tags configured in struts-config.xml, I get 404 error. If i create a dummy .jsp page with a html form button with post action url pointing to the path pattern configured in struts-config.xml, everything works just fine.
Can someone give me a hint here?

Thanks
14 years ago
Hi,
In tomcat4.1, I try to set a parameter in conf/server.xml so i can get it back from jsp page. In my jsp page, I always get a null string for the parameter i set in server.xml. I search through all document to verify my server.xml. I hit dead end. Hope someone will shine some light. This is the context in my server.xml.
*************************************
<Context path="/pw" docBase="pw" debug="0"
reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_pw_log." suffix=".txt"
timestamp="true"/>
<Environment name="maxExemptions" type="java.lang.Integer"
value="15"/>
<Parameter name="DEBUG" value="1" override="false"/>
</Context>
********************************************
THis is my jsp page under webapps/pw/check.jsp
*******************************************
<Html>
<head>
<title>Check Attribute</title>
</head>
<body>
<%@ page import="java.io.*" %>
<%@ page import="javax.servlet.*" %>
<%
ServletContext sc = getServletContext();
String creator = (String)sc.getAttribute("DEBUG");
System.out.println(creator);
%>
HH<%=creator%>YY
</body>
</html>
*******************************************
The page and log file show "null"
15 years ago
JSP
Hi all,
Out of curiousity, is it true, in general, that Java application (with GUI) runs slower on Linux platform compared to Windows? Does JVM consume more resources on Linux ( i see many threads are started) platform? For example, i run a java GUI apps on a P4 1.8GHz Linux platform and Celeron 600MHz Win2k both have same amount of 512MB Ram. I realize that Win2k fires up the apps much faster than Linux platform. If my observation is true, why? Can someone points me some articles on this topic or share your knowledge with us(me)?
Regards,
15 years ago
Hi all,
I am writing a simple client server application. Client application will send a serialized object (an object that implements Serializable interface) to the server. Server will recover the information on this object and do further procesing. Server also send by the same object to client after processing, client will get an update object with more and new information. If client is run via internet, how secured is this architecture? I don't encrypt the object at this point. If serialized object is unsecure, then i may consider to encrypt it before sending via the internet.
Thanks.
Hi,
I come across this weird problem in client server programming. The server application will use its writeObject method to output a customed object to client when a request comes in. This customed class implements Serialiable interface and it is put in the same directory as the server application. No packaging is applied in the code. At client side, the same customed class is put in the same directory as client application. When client reads in the object, the object is casted to the customed class. Data is read successfully from the customed class at client side.
Then i take a step further and put client application and the customed class in a package. The casting step fails. NoClassFoundError is caught. After some tweaking, i discover that if i use the same package name on server side, casting will work and everything. My concern is, should customed Serializable class must be packaged the same way at server and client side? Otherwise the casting will fail?
Regards,

PS. Please help me to move this topic to the appropriate forum. I accidentally put it here. Thanks.
[ August 16, 2002: Message edited by: SoonAnn Lim ]
16 years ago
Hi,
Thank you very much for the reply. I have solved this problem. The method i used is very close to your suggestion. So i think i am doing the right thing. I create a static counter in the applet which is incremented in the init() and decremented in stop(). It works very fine. However, i need to synchronize the applet as you mentioned. I forget that part at all.
Thank you very much..
Regards,
16 years ago
Hi,
I have an applet that runs in a thread. Somehow, when i refresh my browser, another instance of applet is initialized before the old one is killed and destroyed. I am thinking to put a simple checking mechanism in applet init method which will look for the applet instance from the same class. If the old instance still exists, wait until the old one is killed before the new instance is initialized. Can i do that?
Thanks,
16 years ago
Hi,
I have an applet that runs fine when it first loaded in IE 6(I don't have any jre installed except the default in IE). However, after i reload the applet, the applet does not run at all. I only see small grey area. The error shown in the java console is something like this
**********************************************
<code>
java.lang.LinkageError:Class already defined in the context of this loader: XXXpackage/YYYclass.
java.lang.ClassNotFoundExcep at com/ms/vm/loader/URLClassLoader.loadClasstion:XXXpackage/YYYclass.
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/vm/applet/AppletPanel.securedClassLoad
at com/ms/vm/applet/AppletPanel.processSentEvent
at com/ms/vm/applet/AppletPanel.processSentEvent
at com/ms/vm/applet/AppletPanel.run
at java/lang/Thread.run
</code>
<code>
************************************************
Can some one point me on this?
16 years ago
Hi,
I am trying to implement a unique web access counter similar to visitor counters
that we see at most web pages. I am doing it in an applet. The idea is when the applet
is loaded, i will have some sort of id for this particular visitor(can easily be done
using cookie via servlet). When browser leave the page, applet is unloaded and destroyed.
At this stage, applet will send back its own identification, which is its id, to the server.
Based on id, i can identify whether this is a new visit or a repeated visit. In order to do
this, i need to use a cookie. However, i avoid netscape api to minimize browser compatibility
issue.
It seems to me that cookie is the only way to acheive this. Unfornately, applet does not
work very well with cookie. I don't have a good solution yet. It appears to me this is a very
common problem in Java community. Most people use netscape api as solution.
16 years ago
How can i maintain applet state on client browser without using cookie? I am trying to avoid using netscape's api to access cookie information at client side. Any idea?
Thanks.
16 years ago
Sound's like your classpath is not set correctly for your driver. Echo your class path to check if mm.mysql driver is in the path.
16 years ago