stupid Q: setters are not called if properties are empty

2001-02-27 Thread Kan Leung, MK

Sorry if you find if this is a bit off topic. ;)

Hi all,

Hope this is not a FAQ. (I spent 2 hours to do net search but didn't
get a good answer)

8
jsp:useBean name="abc" scope="session"  /
jsp:setProperty name="abc" property="*"/
8

Introspection magic makes the property setters called if they match the
input parameters by GET or by POST.

e.g. URL?address1=aaddress2=address3=


There are exceptions: setters of some parameters which have no value
won't get called. In the above string, the later two are not called
because they have no values assigned. Suppose my bean has session scope.
Values kept unchanged.

My question is: how can the web users clear a text field if the field is
incorrectly filled?

I suppose the introspection magic is a life-saver. I just don't want to
check the return value of request.getParameter("address2) for each input
to determine if it's empty.

Can anybody give me a good alternative to clear unwanted fields easily?

--
Kan LEUNG, M K
email: [EMAIL PROTECTED]
Digital Empires Company Limited







Re: auto reload of message resource and URL-rewrite

2001-02-26 Thread Kan Leung, MK

I got the URL loaded finally. I need to create the directory 'admin'
myself before calling .../admin/reload.do . Oops! Thanks Maya.

--
Kan LEUNG, M K
email: [EMAIL PROTECTED]
Digital Empires Company Limited


- Original Message -
From: "Maya Muchnik" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, February 26, 2001 9:44 PM
Subject: Re: auto reload of message resource and URL-rewrite


 Hi,
 I am sorry for my "stupidity". Need to read more careful email, and
what
 people ask. I have tried myself the following link:
 "http://localhost:8080/struts-example/admin/reload.do" and it works. I
can
 see messages about updating of ActionFormBean, ActionForward,...
properties
 on a command line (where I have started Tomcat)  and in browser window
the
 message - "OK".
 Maya

 Maya Muchnik wrote:

  Kan is correct. I did have admin subdir under struts-example either.
 
  "Kan Leung, MK" wrote:
 
   - Original Message -
   From: "Craig R. McClanahan" [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Thursday, February 22, 2001 2:06 AM
   Subject: Re: auto reload of message resource and URL-rewrite
  
At the bottom of the struts-config.xml file for the example
   application, you
will see an action definition:
   
action path="/admin/reload"
type="org.apache.struts.actions.ReloadAction"/
   
which means you can send a request to the following URL
(assuming the
   normal
*.do mapping):
   
http://localhost:8080/struts-example/admin/reload.do
   
and the Struts controller servlet will reload all of the
configuration
   files
and message resources (but not the Java classes -- you have to
ask
   your
servlet container to reload the app in order to accomplish
that).
   
You can use any of these standard actions in your own
applications as
   well.
  
   Apache "page not found" error is experienced. I did include a
handler
   for *.do in tomcat-apache.conf file! I'm still unable to reload
resource
   file in runtime.
  
   ===CUT===
   Not Found
  
   The requested URL /struts-example/admin/reload.do was not found on
this
   server.
  
   Apache/1.3.12 Server at localhost Port 80
   ===CUT===
  
   --
   Kan LEUNG, M K
   email: [EMAIL PROTECTED]
   Digital Empires Company Limited






message error after compiling other classes

2001-02-25 Thread Kan Leung, MK

Hi,

During development, I always recompile my classes when the container is
up and running. Newly compiled classes can be reloaded correctly.
However, the browser always shows Message Tag errors if the page contain
bean:message .../ tags. The classes which I re-compiled haven't use
any Struts-specific libraries.

The only relation is in the JSP page, that contains bean:message  .../
tags and uses the beans which I just recompiled. Any clue?

==8==
Internal Servlet Error:

javax.servlet.ServletException:
org.apache.struts.util.PropertyMessageResources
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:459)
at
_0002fregister_0005fdn_0005fpasswd_0002ejspregister_0005fdn_0005fpasswd_
jsp_13._jspService(_0002fregister_0005fdn_0005fpasswd_0002ejspregister_0
005fdn_0005fpasswd_jsp_13.java:228)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 ..
 ..

Root cause:

java.lang.ClassCastException:
org.apache.struts.util.PropertyMessageResources
at
org.apache.struts.util.RequestUtils.message(RequestUtils.java:282)
at
org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:239)
at
_0002fregister_0005fdn_0005fpasswd_0002ejspregister_0005fdn_0005fpasswd_
jsp_13._jspService(_0002fregister_0005fdn_0005fpasswd_0002ejspregister_0
005fdn_0005fpasswd_jsp_13.java:145)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 ..
 ..
 ..
==8==


--
Kan LEUNG, M K
email: [EMAIL PROTECTED]
Digital Empires Company Limited








file upload, use of DiskFile class?

2001-02-23 Thread Kan Leung, MK

I am working on upload file via HTTP. I found a class called DiskFile in
the Javadoc. However, I am unable to find out how does it work. Any
clue?


--
Kan LEUNG, M K
email: [EMAIL PROTECTED]
Digital Empires Company Limited







i18n, formatting message

2001-02-21 Thread Kan Leung, MK

Hi all,

I have a property file like this:

  common.copyright={0} Copyright

I used the following tag to retrieve the message:

  bean:message key="common.copyright" arg0="2001"/

The displayed message becomes:

  [Ljava.lang.Object;@47393f Copyright


Any clue?


--
Kan LEUNG, M K
email: [EMAIL PROTECTED]
Digital Empires Company Limited