Struts TLD problem

2005-10-23 Thread Koon Yue Lam
Hi,

Assume I have 2 jsp(s), header.jsp and content.jsp

In header.jsp, I have:
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/element.tld" prefix="element" %>

In content.jsp, I include header.jsp like the following:
<%@ include file="../common/header.jsp" %>

The problem is, when I surf to content.jsp, all HTML tags can't be rendered,
they just don't show up. Every HTML tag which using Struts-HTML havn't show
up 

but if I put those <%@ taglib uri=XXX statement in content.jsp, everything
work fine.

In web.xml, I already declare all tag lib and the URI are all correct

I also try using JSP include and toogle between absolute and relative path,
no luck at all

Any help would be appreciated

thanks


Re: Strange Struts tld problem

2005-10-19 Thread Koon Yue Lam
sorry, the include in my first mail was wrong, it should be:
<%@ include file="../common/header.jsp" %>

and it still can't locate those tld

On 10/20/05, Wendy Smoak <[EMAIL PROTECTED]> wrote:
>
> From: "Koon Yue Lam" <[EMAIL PROTECTED]>
>
> > Assume I have 2 jsp(s), header.jsp and content.jsp
> >
> > In content.jsp, I include header.jsp like the following:
> > <%@ include file="../common/Header.jsp" %>
>
> The include isn't working. Possibly because your file is named 'header.jsp
> '
> and you're including 'Header.jsp', (watch the case!) or possibly because
> it
> isn't where you think it is relative to content.jsp.
>
> In addition, unless you're on Servlet 2.2, you don't need to put the tlds
> under WEB-INF and map them in web.xml. Just use the URIs such as
> <%@ taglib uri="http://struts.apache.org/tags-html"; prefix="html" %>
> and the tld file that's in struts.jar will be used.
>
> --
> Wendy Smoak
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Strange Struts tld problem

2005-10-19 Thread Koon Yue Lam
Hi,

Assume I have 2 jsp(s), header.jsp and content.jsp

In header.jsp, I have:
<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/element.tld" prefix="element" %>

In content.jsp, I include header.jsp like the following:
<%@ include file="../common/Header.jsp" %>

The problem is, when I surf to content.jsp, all HTML tags can't be rendered,
they just don't show up. Every HTML tag which using Struts-HTML havn't show
up 

but if I put those <%@ taglib uri=XXX statement in content.jsp, everything
work fine.

In web.xml, I already declare all tag lib and the URI are all correct

I also try using JSP include and toogle between absolute and relative path,
no luck at all

Any help would be appreciated

thanks


[OT] For those who love fur, please take a look

2005-02-16 Thread Koon Yue Lam
** Be prepared, rate R **
http://hk.geocities.com/blood1213/fur.html

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts 1.1 UTF-8 problem

2005-01-09 Thread Koon Yue Lam
Hi, here is the situation:
Tomcat 5.25
MySQL 4.1
Struts 1.1

when I use Struts form to get some form data submited by a webpage, it
is encode in latin but not utf-8. I have already set the page encoding
to UTF-8 in my JSP.

I need to new a String specific the encoding to UTF-8 in order to save
unicode data into MySQL

Is there any way to tell Struts encode all data in UTF-8 ??

btw, display UTF-8 character is fine

Thanks

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About *.do

2004-11-11 Thread Koon Yue Lam
ok, I got it, thanks a lot !

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About *.do

2004-11-11 Thread Koon Yue Lam
so I need to map all actions of my webapp?
something like 
/login map to /login.do ???

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



About *.do

2004-11-11 Thread Koon Yue Lam
Hi !
How can I access an action of its name instead of its "name.do" ?

eg. localhost/MyApp/login
I don't want the ".do" at all

thanks

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Action Form

2004-10-17 Thread Koon Yue Lam
ok, I get your point now, ^^

thank for help !

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Action Form

2004-10-17 Thread Koon Yue Lam
thanks to Frank !
and Michael:
what u mean an application level multi-threaded program? is it a
background deamon / process to store data that likely to be store by
session ?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Action Form

2004-10-16 Thread Koon Yue Lam
oh, so I need some way to store data in the respond object
I know session can be help, is it a right way to do?
It is not very big object but it would be an array of String (which
contains user's multiple selection)

thanks for your help, ^^

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



About Action Form

2004-10-15 Thread Koon Yue Lam
Hi, suppose I have 2 actions which each has its own action form
A1 will have F1
A2 will have F2

and we have JSP1, JSP2 and JSP3

it is like a 2 steps wizard, 
user first access JSP1 and when submit, A1 is executed and populate
F1, it then forward to JSP2

user will select some data in JSP2 and when submit, A2 is executed and
populate F2

The question is the data need to populate F2 is determined by what
user select on F1, but only one action form can be associated to
action. How do A2 know what user has selected??

any help will be appreciated

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: never, ever bury an exception!

2004-09-02 Thread Koon Yue Lam
Hi !!
I agree with all of you but still have a question. If my application
is divided into a few layers, say:

Web <---> BizDelegate --- <---> EJB  
  |__<--> DAO / server side program

My practice is catch all SQLException in DAO(s), but never throws
excepion from my DAO, all DAOs will return primitive, at least a
boolean to indicate the query is success or not
It is because there is nothing to do with the above layers when
something goes wrong in DB.

However if every method have a try -- catch block, especially in EJB
and DAO layers, it would become a speed lose. My practice is to catch
ALL kind of Exception in just BizDelegate, whenever an exception is
caught, it return some primitive to the above Web layer. Because the
data between Web and BizDelegate can be throught network, sending an
Exception would be much inefficient than just True of False.

The bottom line is, my Web layer doesn't need to know what going
wrong, it just need to know IS IT going wrong. Then forward to some
error pages, or maybe retry one more time.

But it still can't suit to all situation, some methods in BizDelegate
will thorws Exception of the type BizDelegateException. When the web
layer can do something to the exception, BizDelegate will include the
Exception thrown from under layer to the cause of
BizDelegateException, then throw up to Web layer.

Is it sounds good ??

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: how not to use actionform and pass things around

2004-08-18 Thread Koon Yue Lam
Hi !
I don't see a good reason that you are not going to use action form.
Since Action form is just a Java bean, which is pretty much the same
as the "Object" that you want to pass around

and about this:
"use an ActionForm I have to write the entities of my ActionForm into
the JSP for it to be picked up"

If you use plain Object to pass around JSP, u still need to declare
those object in order to use it (). Which means u still
need a Java bean in order to use it in JSP, and that's why Acton form
is here to help u!

lastly, can u sure that your site will only has 2 page in the future?
and won't do some validation?

hopes this help

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Tiles

2004-08-17 Thread Koon Yue Lam
thanks for the help ! I will spend some time on the above links !

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Tiles

2004-08-17 Thread Koon Yue Lam
thanks David !

after reading the doc. in Struts, Tiles site, I found very little
resource talking about Tiles...

I know I need a template, a definition etc...

but I still can't figure out how to glue them together !

The problem go worse if I want to use Tiles with Struts, I just don't
know how...
any link, tutorial ??

However I think using Tiles and OSCache seems to be a very attractive
solution for my situation.

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



About Tiles

2004-08-16 Thread Koon Yue Lam
Hi, I want to build a webpage using tiles, the structure is:

Header
Body
Footer

super classic layout but I have one question, if the content in Header
and Footer are read only and will be nearly the same throughout entire
user session. How can I just reload the body part? and keep the Header
and Footer static?
(the content of Body is generated according to the content of Header)

however, each user will have a page to modify their info (name,
age...), and after these changes have made to DB. Both Header and
Footer must force to reload

so how can I trigger reload of Tiles as I wish, but keep those tiles
static for the rest of time??

Best regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts, checkbox and optionally displaytag

2004-08-08 Thread Koon Yue Lam
Hi !

>From your question, I guess that you need a multiple of checkboxes, so
you need  instead of 

for your reference:
http://struts.apache.org/userGuide/struts-html.html#multibox

and a wonderful example:
http://j2ee.lagnada.com/struts/multibox-example1.htm

you would need an action form, which contains 2 arrays (normally they
would be String array)
eg. an Action form called FrmMultiBox with properties :
String [] options; String[] selected;

options[] is holding the "options" of the checkboxes that user going to select
selected[] would be populated by Struts after form submission, value
of selected[] is the value of "checked" checkboxes.

so if options = new String {"1", "2", "3"} (you can made them final or
load the values from another Action dynamically from somewhere else)

in your JSP:


   
 
   
   


if user check "1" and "3" then selected[] would contains "1" and "3"
(Thanks Struts !)

and don't forget the formal getter and setter method of your Action form

Hope this help

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: not quite struts: handling Images

2004-07-27 Thread Koon Yue Lam
Hi all !
I have similar problem to ron1 and these mails really help !
However if I want to extract the exif metadata of JPEG, can it be done
in Java without third party component?

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Struts + JBoss preference issue

2004-07-22 Thread Koon Yue Lam
yeah, I think so, thanks for advice !

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Struts + JBoss preference issue

2004-07-22 Thread Koon Yue Lam
Oh! thanks for all of these help !
I don't expect over 10 mails in one night to this issue~~
Maybe becasue the timezone because I am from Hong Kong, ^^

[About Struts]
After some testing, I prove myself wrong !
The delay wasn't cause by Struts, it is cause by JSP instead. The
delay time is the time that use to compile and transform the JSP to
servlet, sorry for the silly question because I haven't read through
all the spec. ^^

[To HG]
I said the problem deal with cluster means:
assume we have 3 servers (S1, S2, S3) form a cluster and one Struts
plugins deal with home object caching (P1)

when the application start up, P1 with get all home interfaces from
the cluster and also create all home objects and cache them.

so if P1 get an object (O1) from S1 and cache it, this O1 is indeed an
instance created by S1 and if S1 go down, O1 would still reference to
S1 and become NULL

The question comes to if i call some method to O1 at this time, will
the cluster manager redirect the request to another machine?? I don't
think it will hapen because you locally cache the object reference.
But if you get the home object from the JNDI tree again, I am sure the
cluster manager will preform a failover and redirect all request
target to S1 to another machine

do I make any sense?

great to have this disussion

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Struts + JBoss preference issue

2004-07-22 Thread Koon Yue Lam
some drawbacks I can see:
1. longer server start up time (but it is OK)
2. If the application scale up to cluster, this design seems can't deal with it
(because the client always invoke remote object that was downloaded to
cache, which is not dynamically locate by app. server in a cluster
environment.)

however if it is a single JVM application (like mine, ^^), I will
consider it a try

thanks for help

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About Struts + JBoss preference issue

2004-07-22 Thread Koon Yue Lam
Thanks !
It seems like a great solution and I will try that out tonight, thanks
for help ^^

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



About Struts + JBoss preference issue

2004-07-21 Thread Koon Yue Lam
Hi ! My application has change from Struts + Tomcat to Struts + Jboss 3.X

I create various struts Actions to deal with incoming request, in the
Action class, it preform remote lookup of session bean's home
interface and create, destory ... it.

My session bean has an DAO attach to it to preform database related stuffs
NO entiy beans in my application since transaction is not a problem
and most DB query are read only

The question is the speed, it is much slower when I request an Action
instead of directly request a servlet. Is it normal ? I don't mind a
little bit preformance tradeoff but I want to know the delay is caused
by Struts or something else.

Any help?

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Datasource problem again..

2004-07-20 Thread Koon Yue Lam
yes, clearly a context file for each web app is a better / wiser
choice, thanks for the advice !

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Datasource problem again..

2004-07-20 Thread Koon Yue Lam
Tthanks for the help for all of u !
Finally I get it done, I create a  element and nest a
 with details of MySql in server.xml and it just work
smoothly~~~

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Datasource problem again..

2004-07-19 Thread Koon Yue Lam
thanks for the help ! I will give it a try

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Datasource problem again..

2004-07-19 Thread Koon Yue Lam
Thx !! I will try it out tonight after work !!
and let u know if I sucess or not, ^^

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Datasource problem again..

2004-07-19 Thread Koon Yue Lam
Thx !
Since I am using Tomct 5 with auto-depoly, my Webapp DOESN'T has a
 element in server.xml. I think I will has a try to setup in
, or should I manually all a  element of my
Webapp in server.xml??

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Datasource problem again..

2004-07-19 Thread Koon Yue Lam
Yes, it helps and I know I can get it done if I set the context
element in server.xml,
but if I set the datasource in server.xml, do I need to set the
 in struts-config.xml again??

If I am right, I think if datasource is setup in server.xml, it has
the scope of entire Tomcat, that means all webapps can use that
datasource. Also it can be retrieved by JNDI.

If the datasource is setup in struts-config.xml, the scope becomes
struts only and is specific to only one webapp, and it can't be
retrieved by JNDI.

So I can setup datasource in both ways, setup in server.xml has much
more flexibilty and benifit from JNDI, why do I need to setup in
struts-config.xml??

once again, thanks, ^^

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Datasource problem again..

2004-07-19 Thread Koon Yue Lam
Hi !
I have try the follow to retrieve a datasource from Struts using JNDI:

 Context initCtx = new InitialContext();
 Context envCtx = (Context) initCtx.lookup("java:comp/env");
 DataSource ds = (DataSource) envCtx.lookup("jdbc/kiss_web_news");

but it doesn't work

it is my struts-config,xml:
 





  


Do I need to modify the web.xml under $Tomcat/conf ?? It seems that
Stucts doesn't registry the datasource to JNDI and I always get a null
pointer of datasource.

any help?

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About datasource

2004-07-16 Thread Koon Yue Lam
^^ thanks so much !
I am going to have a try and let see what will happen (maybe somemore
question, ^^)

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About datasource

2004-07-16 Thread Koon Yue Lam
Hi, after some thinking, I have another problem, ^^
If I am using an Action (which extent the Struts' Action class), I can
get the Datasource by calling getDataSource()
But now I want to write my own data assess object which shouldn't
extent Action, I don't know what way I can get the datasource from the
pool.

any help??

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: About datasource

2004-07-15 Thread Koon Yue Lam
Thanks so much !!
u really helps and quick response !!

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



About datasource

2004-07-15 Thread Koon Yue Lam
Hi !
I have successfully use struts to connect MySql but I wonder do I
using the database connection pool, or just a new connection for each
request??
All I did is very simple stuffs and I follow strict to the database
How-To section of struts doc.
How can I know I am actually using a connection pool ??

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts design problem, any help?

2004-07-12 Thread Koon Yue Lam
ok then , I try to figure out myself
thanks a lot, ^^

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts design problem, any help?

2004-07-12 Thread Koon Yue Lam
thanks for your kind reply
For example, for a classic online shop, 
1 BD for customer (for check-in, check-out, list product etc...)
1 BD for admin (for update product price, stock etc...)
1 BD for normal user (for web forum, enquiry, feeback etc...)

does it looks good? 

so if my BD doesn't map to exactly one business object that implement
the service,
like my BD for customer need services from more than one business
object (at least one for product, and one for shopping cart)
is it the role of BD to handle various object ? or use some others pattern ??

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts design problem, any help?

2004-07-12 Thread Koon Yue Lam
Hi, me again, ^^
I want to know if I implement business delagate as POJO singleton, can
u give me some advice on how to multi-thread this business delagate to
various request ???
and how about caching ?? How to cache the handler of a business service ??

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts design problem, any help?

2004-07-12 Thread Koon Yue Lam
sorry, one more question..
I have read the business delagate pattern a while but still have little confuse

Do the system has only one business delagate to control the mapping of
request to business service
OR
the system has the same number of business delagate and business
service?? so one service would has their own business delagate

any sample code??

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Struts design problem, any help?

2004-07-12 Thread Koon Yue Lam
Thanks for the reply and I want to know more... ^^
I know what means by Business delegate Factory, but what is "a plugIn
for your factory" ??

Do I need to implement Business delegate Factory by myself? Will
Struts help me in some way??

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts design problem, any help?

2004-07-12 Thread Koon Yue Lam
Hi, I am very new in Struts. Can anyone give me some suggestion on the
design of a Service Locator ??

I use ActionServlet as a front controller, and dispatch request to
various Action, then I want all the Actions access my business tier
only by the Service Locator, which return an interface of the
requested service.

I don't want to use session bean currently but I want my design can
upgrade to session bean easily. So I think using a Service locator and
return an interface of a business service is similiar to the EJBHome /
EJBRemote concept. Which I can easily upgrade my application to using
session bean.

However how can I implement the Service Locator? Is it a POJO /
Servlet / or another Struts Action ??

I try to implement it as a POJO Singleton and then share by many
request, but do I need to program the multi-thread part of this POJO
Service Locator by myself ?? What happen if a large number of
concurrent request to that Service Locator?

Any help would be appreciate

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]