Tile controller class

2008-07-22 Thread Zhang, Larry (L.)
I am using a tile controller class to render the tile on the page. Say
if my main action rendering the page is called myAction.do and when I
send the request like https://.../myWeb/myAction.do, myAction.do
will do something and then forward to the page containing the tile.(then
the tile controller comes to the picture). My tile controller have the
following method:

public class MyTileController implements Controller {
public void execute(ComponentContext arg0, HttpServletRequest
request,
HttpServletResponse arg2, ServletContext arg3)
throws Exception {

// how to the the path myAction.do??

// process business logic

}
}
My question is that how to get the path info like myAction.do in the
above method? Thanks.

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



Action form in session scope

2008-07-17 Thread Zhang, Larry (L.)
Hello, which is a prefered way to add actionform into session scope or
in the request scope? Is that true that putting actionForm into the
session is a bad idea? Thanks.

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



Tiles questions

2008-07-14 Thread Zhang, Larry (L.)
I have a mainLayout which has a header, body and footer.(and thus I have
4 jsps, mainLayout.jsp, header.jsp, body.jsp, and footer.jsp, and notice
that body.jsp will be different for each different screen page).

One setting can be of:

!-- shared by all --
definition name=mainLayout path=/jsp/common/mainLayout.jsp
put name=header value=/jsp/common/header.jsp /
  put name=body value= /
put name=footer value=/jsp/common/footer.jsp /
/definition

!-- this is different from each screen page --
definition name=viewemployee extends=mainLayout
   put name=body value=/jsp/employee/employee.jsp /
/definition   


Then I have a further requirement: Manager pages's body has left, middle
and right. All manager pages will have common left and right, but middle
will be different. So I define the managerBody like

!-- every manager page shares this --
 definition name=managerBody
path=/jsp/common/managerBodyLayout.jsp
put name=left value=/jsp/common/left.jsp/
put name=middle value=/
put name=right value=/jsp/common/right.jsp/
/definition

Then if I have managerPage1, I can define as:

 definition name=managerPage1 extends=mainLayout
put name=bodyContent value=managerBody/
put name=middle
value=/jsp/manager/managerMiddle1.jsp//
 /definition  

Unfortunately, this doesn't work. Can somebody help? Thanks.

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



Tiles questions

2008-07-14 Thread Zhang, Larry (L.)


I have a mainLayout which has a header, body and footer.(and thus I have
4 jsps, mainLayout.jsp, header.jsp, body.jsp, and footer.jsp, and notice
that body.jsp will be different for each different screen page).

One setting can be of:

!-- shared by all --
definition name=mainLayout path=/jsp/common/mainLayout.jsp
put name=header value=/jsp/common/header.jsp /
  put name=body value= /
put name=footer value=/jsp/common/footer.jsp /
/definition

!-- this is different from each screen page --
definition name=viewemployee extends=mainLayout
   put name=body value=/jsp/employee/employee.jsp /
/definition   


Then I have a further requirement: Manager pages's body has left, middle
and right. All manager pages will have common left and right, but middle
will be different. So I define the managerBody like

!-- every manager page shares this --
 definition name=managerBody
path=/jsp/common/managerBodyLayout.jsp
put name=left value=/jsp/common/left.jsp/
put name=middle value=/
put name=right value=/jsp/common/right.jsp/
/definition

Then if I have managerPage1, I can define as:

 definition name=managerPage1 extends=mainLayout
put name=body value=managerBody/
put name=middle
value=/jsp/manager/managerMiddle1.jsp//
 /definition  

Unfortunately, this doesn't work. Can somebody help? Thanks.

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



Struts global-exception and web.xml's error-page

2008-05-15 Thread Zhang, Larry (L.)
Can anyone let me know the differences between (1) and (2): Thanks


(1) In struts-config.xml
global-exceptions
exception key=someerryorKey 
type=java.lang.Exception 
 
handler=com.handler.MyCustomExceptionHandler 
path=errorPageForward
/exception
/global-exceptions

(2) In web.xml
error-page
  exception-typeException/exception-type
  location/MyError.jsp/location
/error-page

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



Struts validator framework

2008-05-15 Thread Zhang, Larry (L.)
 
Say if I have two text fields, one label is Please enter name:, and the
other label is Please enter SSN:. In struts validator framework, if I
need to validate these two fields using required validator, is there any
way to relate the field label to the message? Or does struts validator
support displaying the validation message right next to the field (so
that the user easily know which fields are invalid)?

Thank you very much.

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



RE: Business object in the action form?

2008-03-12 Thread Zhang, Larry (L.)
Thanks, but it didn't say that whether it is appropriate to put the bo
inside action form. Any more relevant website? 

-Original Message-
From: Randy Burgess [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, March 11, 2008 5:20 PM
To: Struts Users Mailing List
Subject: Re: Business object in the action form?

I wouldn't put a DAO or a business object there. Here is a good example.

http://struts.apache.org/1.x/faqs/actionForm.html

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



 From: Zhang, Larry (L.) [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Date: Tue, 11 Mar 2008 11:33:28 -0400
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Business object in the action form?
 
 I have a question regarding ActionForm... Is it a good idea to place
the
 Business Object in the action form? In my project, I do put the Data
 transfer object into the action form, but I am not certain if this is
a
 good idea to put the business object as well into the action form. See
 the following link to understand what the business object is.
 
 Thanks a lot.
 
 

http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObjec
 t.html  
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



This email and any attachments (Message) may contain legally
privileged and/or confidential information.  If you are not the
addressee, or if this Message has been addressed to you in error, you
are not authorized to read, copy, or distribute it, and we ask that you
please delete it (including all copies) and notify the sender by return
email.  Delivery of this Message to any person other than the intended
recipient(s) shall not be deemed a waiver of confidentiality and/or a
privilege.

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


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



Business object in the action form?

2008-03-11 Thread Zhang, Larry (L.)
I have a question regarding ActionForm... Is it a good idea to place the
Business Object in the action form? In my project, I do put the Data
transfer object into the action form, but I am not certain if this is a
good idea to put the business object as well into the action form. See
the following link to understand what the business object is.

Thanks a lot.


http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObjec
t.html  

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



Database resources

2008-02-05 Thread Zhang, Larry (L.)
 
In struts-fonfig.xml I configured as following to get the messages from
DB instead of MessageResource.properties. I have wrote a method to
getMessage(Locale loc, String key)  to get the message from db. This
works for en_US locale, Now my question is how can I pass the locale so
that I get the locale specific messages?

Thanks.



message-resources factory=com.fordMyDbResourceBundleFactory 
parameter= null=false / 

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



DAO pattern

2008-02-04 Thread Zhang, Larry (L.)
Sorry if this is not too on topic.

I have a user object whose data is from three resources: Db2, LDAP, and
other flat file. Per dao pattern, do you think I should have three daos
or one dao to encapsulate the data access implications? 


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



RE: Struts validator

2008-02-01 Thread Zhang, Larry (L.)
 
Can some Struts guru answer the following questions?
-Original Message-
From: Zhang, Larry (L.) 
Sent: Thursday, January 31, 2008 3:27 PM
To: 'Struts Users Mailing List'
Subject: Struts validator

Hello coworkers,

I have a questions regarding the struts validation..., say I have three
text fields to be validated in struts validation, and three submit
buttons as well. When I submit one buttion, I only need to validate one
field, and when I click on the other submit button, I need to validate
the other field. Currently, all three fields are validated even though I
don't need to. Is there any way to overcome this issue?

Thanks. 

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



RE: Struts validator

2008-02-01 Thread Zhang, Larry (L.)
We are not using Struts 2 tag and thus I can't use s:submit tag. 

-Original Message-
From: David Harland [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 01, 2008 10:01 AM
To: Struts Users Mailing List
Subject: RE: Struts validator

You can do it by having 3 different methods such as

method1() method2() method3() and then have 

validateMethod1() validateMethod2() validateMethod3() 

then in your form 

s:submit key=button.method1 method=method1/ 
s:submit key=button.method2 method=method2/ 
s:submit key=button.method3 method=method3/ 

or you can do by using action aliases and have three validation xml
files.

http://struts.apache.org/2.0.11/docs/validation.html

-Original Message-
From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] 
Sent: 01 February 2008 14:45
To: Struts Users Mailing List
Subject: RE: Struts validator

 
Can some Struts guru answer the following questions?
-Original Message-
From: Zhang, Larry (L.)
Sent: Thursday, January 31, 2008 3:27 PM
To: 'Struts Users Mailing List'
Subject: Struts validator

Hello coworkers,

I have a questions regarding the struts validation..., say I have three
text fields to be validated in struts validation, and three submit
buttons as well. When I submit one buttion, I only need to validate one
field, and when I click on the other submit button, I need to validate
the other field. Currently, all three fields are validated even though I
don't need to. Is there any way to overcome this issue?

Thanks. 

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


- --
ML {UFI}

__
Ufi Limited 
Registered in England No.  3980770 
Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 

learndirect Solutions Ltd 
Registered in England No. 5081669 
Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 

UFI Charitable Trust 
Registered in England No.  3658378 
Registered Charity No.  1081028 
Registered Office:  Dearing House, 1 Young Street, Sheffield, S1 4UP 

This email has been scanned by the MessageLabs Email Security System.

__

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


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



RE: Struts validator

2008-02-01 Thread Zhang, Larry (L.)
Struts valdiator developers, Doesn't struts support this requirment?

-Original Message-
From: Zhang, Larry (L.) 
Sent: Friday, February 01, 2008 10:55 AM
To: 'Struts Users Mailing List'
Subject: RE: Struts validator


No, I am using struts 1.1, I would like to implement the following case:
In valiation.xml:

 form name=/myAction
 !--if submit button 1 clicked, I validate the
following field--
field property=myProperty depends=required
msg name=required key=error.key1 /
/field   

!--if submit button 2 clicked, I validate the following
field--
field property=name depends=myValidator
msg name=myValidator key=error.key2 / 
/field
/form  


I don't want to validate both fields at the same time when just one
submit button is clicked. Your helps are appreciated!

-Original Message-
From: Dave Newton [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 01, 2008 10:45 AM
To: Struts Users Mailing List
Subject: RE: Struts validator

--- Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
 We are not using Struts 2 tag and thus I can't use s:submit tag. 

Are you using Struts 2 at all?

You can still use the generated HTML as a template to create your own
HTML,
although... not sure why you wouldn't just use the tag in this case.

Dave


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


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



RE: Struts validator

2008-02-01 Thread Zhang, Larry (L.)

No, I am using struts 1.1, I would like to implement the following case:
In valiation.xml:

 form name=/myAction
 !--if submit button 1 clicked, I validate the
following field
field property=myProperty depends=required
msg name=required key=error.key1 /
/field   

!--if submit button 2 clicked, I validate the following
field
field property=name depends=myValidator
msg name=myValidator key=error.key2 / 
/field
/form  


I don't want to validate both fields at the same time when just one
submit button is clicked. Your helps are appreciated!

-Original Message-
From: Dave Newton [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 01, 2008 10:45 AM
To: Struts Users Mailing List
Subject: RE: Struts validator

--- Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
 We are not using Struts 2 tag and thus I can't use s:submit tag. 

Are you using Struts 2 at all?

You can still use the generated HTML as a template to create your own
HTML,
although... not sure why you wouldn't just use the tag in this case.

Dave


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


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



Struts validator

2008-01-31 Thread Zhang, Larry (L.)
Hello coworkers,

I have a questions regarding the struts validation..., say I have three
text fields to be validated in struts validation, and three submit
buttons as well. When I submit one buttion, I only need to validate one
field, and when I click on the other submit button, I need to validate
the other field. Currently, all three fields are validated even though I
don't need to. Is there any way to overcome this issue?

Thanks. 

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



RE: Can I use one action for displaying and submission (with struts validation)

2008-01-25 Thread Zhang, Larry (L.)
I am intested in knowing how to turn automatic validation off? How?
Using javascript to set the flag is not accepted by us.

Also all my submission is also get (for some reasons in our project) 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Paul Benedict
Sent: Friday, January 25, 2008 12:15 PM
To: Struts Users Mailing List
Subject: Re: Can I use one action for displaying and submission (with
struts validation)

You can use this pattern:

* Turn automatic validation off.

* If your action was executed as a GET, branch to viewing logic.

* If your action was executed as a POST, branch to validation logic and
submission logic.

Paul

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



Can I use one action for displaying and submission (with struts validation)

2008-01-25 Thread Zhang, Larry (L.)
 
I was noticing an issue if I use one action for both displaying and
submission purposes:

Say MyAction.java is for displaying page and also for submission. If on
the page there is text field needing the struts validator validation,
then if failing validation, I forward to MyAction.java and comes to the
validation again, and fail again and forward to the MyAction again. This
is an infinite loop, any suggestions to overcome this and still use one
action? Or we have to use two actions(one display and one for
submission) the serve the purposes.

Thanks in advance.

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



Exception handling

2008-01-12 Thread Zhang, Larry (L.)
Since Struts offers an exception Handler
(org.apache.struts.action.ExceptionHandler ), then I got a question: 

in my action, should I try and catch the exception (in the execute's
method) that may be throwed in business layer and forward to an
ActionForward? Or don't do any try and cath in the action's execute
method just throws to the Exception handler?

Your suggestions are appreciated!

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



Get the message from DB instead of from the default MessageResources.properties

2007-11-28 Thread Zhang, Larry (L.)

 Do we still need to create

MessageResourcesFactory 

And MessageResources to facilate the requirment. Do we have an easier
way to achieve the requirement? Thanks

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



Naming convention

2007-11-21 Thread Zhang, Larry (L.)
 
I knew my question may not be very related to this list, but let me just
ask anyway:

I have many DB2 stored procedures, for each procedure I correspondingly
have a Java parser to parser the result set. I currently name these
classes the same name as stored procedure. Example, Csm5RRP (this is the
stored procedure name), then my Java class name is Csm5RRPParser.java.

Then 2 days ago, they have to change the names for all the stored
procedure, to makes things meaningful, I have to rename all my java
classes. -- this is really a pain. 

Do you guys have an argument on this? Is this a good naming practice? If
not, what will be the naming convention in this situation? 

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



Passing data from one form to another form using hyper link

2007-11-19 Thread Zhang, Larry (L.)
Say I have page1 (form1) and page2 (form2), on page1 I have a hyper
link. When I click on the hyperlink, it will call another action (let's
say action2) which is associated to form2 in the struts-config.xml. My
question is that how to make form1 data available in action2? Thanks.

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



Tiles-def.xml

2007-11-12 Thread Zhang, Larry (L.)
Can I define a constant in tiles-def.xml so that I can used it in all
places inside this file? 

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



RE: Tiles-def.xml

2007-11-12 Thread Zhang, Larry (L.)
My problem is:

I have 10 (or more ) css files, some pages use 2 of those, some of those
uses 5 of those, some pages use 6 of those, and this combination is
totally random. Then we I create tiles template, I can't put all these
css in the template, instead I thought I can do the following:

My template:

html xmlns=http://www.w3.org/1999/xhtml; xml:lang=en lang=en-us

head
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/
titletiles:getAsString name=title ignore=true//title

style type=text/css media=screen  
tiles:getAsString name=myCss1 ignore=true/
tiles:getAsString name=myCss2 ignore=true/
tiles:getAsString name=myCss3 ignore=true/
tiles:getAsString name=myCss4 ignore=true/
tiles:getAsString name=myCss5 ignore=true/
tiles:getAsString name=myCss6 ignore=true/
tiles:getAsString name=myCss7 ignore=true/
tiles:getAsString name=myCss8 ignore=true/
tiles:getAsString name=myCss9 ignore=true/
tiles:getAsString name=myCss10 ignore=true/   
/style

/head


body

tiles:insert attribute=header/br /
tiles:insert attribute=bodyContent/br /
tiles:insert attribute=footer/br /
/body
/html

Then  I need to define myCss1 and etc in the tiles-def.xml, I don't know
what is the good one to define this, I don't want to define
them like the following :

definition name=default path=/jsp/common/main.jsp
put name=header value=/jsp/common/header.jsp /
   put name=footer value=/jsp/common/footer.jsp /
/definition   

definition name=mySepeficPage extends=default
put name=title value=SMERF gt; Change Request Queue /
   put name=myCss1 value=the path to the Css1
put name=bodyContent value=/jsp/mySpefic.jsp /
/definition
 
Since that will make my tiles-def.xml too massy. 

So the original issue is how to put the dynamic css files in the
template between headhead.  I would think this is a common issue
for tiles community. Do you have any better way to resolve this issue?



-Original Message-
From: Antonio Petrelli [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 12, 2007 10:30 AM
To: Struts Users Mailing List
Subject: Re: Tiles-def.xml

2007/11/12, Zhang, Larry (L.) [EMAIL PROTECTED]:

 Can I define a constant in tiles-def.xml so that I can used it in all
 places inside this file?



No, but probably you can do it in another way.
What do you want to do exactly?

Antonio

P.S.: If you are using Tiles 2, please ask this question to Tiles Users
Mailing List:
http://tiles.apache.org/mail.html
If you are using Struts/Tiles, go on here and ignore this P.S. :-)

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



RE: Tiles-def.xml

2007-11-12 Thread Zhang, Larry (L.)
That approach works except in your following note it should be


tiles:importAttribute name=myList /
c:forEach var=item items=${myList}
c:out value=${item} /
/c:forEach 

Thanks a lot.



-Original Message-
From: Antonio Petrelli [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 12, 2007 11:07 AM
To: Struts Users Mailing List
Subject: Re: Tiles-def.xml

2007/11/12, Zhang, Larry (L.) [EMAIL PROTECTED]:

 tiles:getAsString name=myCss1 ignore=true/
 tiles:getAsString name=myCss2 ignore=true/
 tiles:getAsString name=myCss3 ignore=true/
 tiles:getAsString name=myCss4 ignore=true/
 tiles:getAsString name=myCss5 ignore=true/
 tiles:getAsString name=myCss6 ignore=true/
 tiles:getAsString name=myCss7 ignore=true/
 tiles:getAsString name=myCss8 ignore=true/
 tiles:getAsString name=myCss9 ignore=true/
 tiles:getAsString name=myCss10 ignore=true/


I think that you could use the list attribute:

definition
  putList name=myList
add value=myfirst.css /
add value=mysecond.css /
  /putList
/definition

And in your JSP:

tiles:importAttribute name=myList /
c:forEach var=item items=myList
  c:out var=item /
/c:forEach


HTH
Antonio

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



tiles usage

2007-11-10 Thread Zhang, Larry (L.)
Consider that each page can have different .css and .js files and these files 
will be put between headand /head in the layout, then the question is that 
how to pass the specific .css and .js to the tiles layout? I definitely don't 
want to put all the .css and .js to the layout just for suite to use tile. 
Thanks in advance
 

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

Jstl and struts

2007-10-18 Thread Zhang, Larry (L.)
This might be an old topic, but should we completely rule out using
struts tag and move to jstl tag? If not, does struts have a tag that
will do anything if the filed is equal (1 or 2 or 3 or 4)? Thanks.

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



Where to code getting user principal in struts based project

2007-10-15 Thread Zhang, Larry (L.)
In my Struts based J2EE application, I need to get user's login
information (user principal), and based on the login id, I will create
the user object and then put it into the session. I am wondering where
is the best place to put this code in.

I read some info and it sounds like I should put this code in
CustomRequestProcessor (which extends TilesRequestProcessor)'s
processValidate method, please let me know if this is something correct.
Thanks.

Larry

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



A try catch and return question

2007-10-01 Thread Zhang, Larry \(L.\)
I have a method having the following structure:

public Object myMethod() {
try {
// some code
return theReturnedObject,
}catch{
 // some code
}
finally {
 // some code
}
}
 
Please let me know if the following version of code better than the
above?
public Object myMethod() {
try {
// some code

}catch{
 // some code
}
finally {
 // some code
}

return theReturnedObject,
}

The only difference is that the bottom one put the return down to the
bottom of the method and take the return out of the try. Please let me
know.

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



value attribute in the html:checkbox tag

2007-08-22 Thread Zhang, Larry (L.)
On myForm, I have a collection (an array of Analyst objects),
analystList, when I iterate through it, I want to render a check box for
each row, and I specifically want to put the analyst id to value
attribute of the checkbox tag, do you know how to do it? And also how to
get the value of the check box?


logic:iterate name=myForm property=analystList id=oneAnalyst
html:checkbox name=oneAnalyst property=analystName
value=???  indexed=true/html:checkbox
 /logic:iterate   

Many Thanks.

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



Dao subclass

2007-06-27 Thread Zhang, Larry \(L.\)

 I have a question, is it a good practice to subclass dao? Thanks

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



Outlook like notification window

2007-06-04 Thread Zhang, Larry \(L.\)
I am looking for a J2EE or AJAX solution for Outlook like notification
(small window on the right bottom corner of the computer screen), can
some one point out a tutorial like information?

Thanks.

Larry 

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



RE: Outlook like notification window

2007-06-04 Thread Zhang, Larry \(L.\)
(small window on the right bottom corner of the computer screen) - not
in the browser. 

-Original Message-
From: Musachy Barroso [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 04, 2007 2:07 PM
To: Struts Users Mailing List
Subject: Re: Outlook like notification window

Do you mean a popup window in the browser?

musachy

On 6/4/07, Zhang, Larry (L.) [EMAIL PROTECTED] wrote:

 I am looking for a J2EE or AJAX solution for Outlook like notification
 (small window on the right bottom corner of the computer screen), can
 some one point out a tutorial like information?

 Thanks.

 Larry

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




-- 
Hey you! Would you help me to carry the stone? Pink Floyd

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



RE: Init methods in Struts

2007-05-17 Thread Zhang, Larry \(L.\)
Try this:

in struts-config.xml put this

plug-in className=comYourPlugin
/plug-in 

And then define YourPlugin as:

...

import org.apache.struts.action.PlugIn;
public class YourPlugin implements PlugIn {

 
   public void destroy() {
  // holder for things to do
   }

  
   public void init(ActionServlet servlet, ModuleConfig config) 
   throws ServletException {  
   
  // init your torque
   }
} 

When you start the server, Torque should be initialized. Let me know if
this works.

-Original Message-
From: newtostruts struts [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 17, 2007 2:09 PM
To: Struts Users Mailing List
Subject: Re: Init methods in Struts

Anyone please...

newtostruts struts [EMAIL PROTECTED] wrote:  I want to initialize
torque in Struts2. I've got the code to initialize torque and it works
fine. 
The problem is where do I put that code. 
Is there a place like an init method which is called just once?

Thx all for your help.

Vinod


-
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search.

   
-
Be a better Globetrotter. Get better travel answers from someone who
knows.
Yahoo! Answers - Check it out.

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



RE: Init methods in Struts

2007-05-17 Thread Zhang, Larry \(L.\)
Then I have no clue other than newton.dave's approach  ... 

-Original Message-
From: newtostruts struts [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 17, 2007 2:46 PM
To: Struts Users Mailing List
Subject: RE: Init methods in Struts

Larry thanks for the reply. 
   
  I'm in Struts2 mode and I don't see a PlugIn interface anywhere.
   
  Also, I read this on apache site ' Struts 1 provides a plugin class
that provides listener-like capabilities. The Struts 2 plugins are like
Eclipse or FireFox plugins, and not at all like Struts 1 plugins. ' 
   
  Any other alternatives ?
  
Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
  Try this:

in struts-config.xml put this






And then define YourPlugin as:

...

import org.apache.struts.action.PlugIn;
public class YourPlugin implements PlugIn {


public void destroy() {
// holder for things to do
}


public void init(ActionServlet servlet, ModuleConfig config) 
throws ServletException { 

// init your torque
}
} 

When you start the server, Torque should be initialized. Let me know if
this works.

-Original Message-
From: newtostruts struts [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 17, 2007 2:09 PM
To: Struts Users Mailing List
Subject: Re: Init methods in Struts

Anyone please...

newtostruts struts wrote: I want to initialize
torque in Struts2. I've got the code to initialize torque and it works
fine. 
The problem is where do I put that code. 
Is there a place like an init method which is called just once?

Thx all for your help.

Vinod


-
Luggage? GPS? Comic books? 
Check out fitting gifts for grads at Yahoo! Search.


-
Be a better Globetrotter. Get better travel answers from someone who
knows.
Yahoo! Answers - Check it out.

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



 
-
Food fight? Enjoy some healthy debate
in the Yahoo! Answers Food  Drink QA.

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



The design of bread crumb trail

2007-05-10 Thread Zhang, Larry \(L.\)
Say I have two Jsp pages, Page 1, Page 2.

On page 1 I have some text fields such as Name, SSN for example, and the
user types in Name and SSN and then submit the form and the navigation
goes to page 2. On page 2 I have the bread crumb trail saying Page 1
Page 2. Notice that Page 1 is a clickable link, and when you click on
the link, Page 1 is shown. (Page 2, on the bread crumb trail, is not
clickable since the current page is Page 2)

My question is: (1) in current J2EE/Struts industry standard, does it
make sense to display the data that the user entered on Page 1 for Name
and SSN when coming from the bread crumb trail on Page 2? (2) what
technique I need to use to see the data that the user typed in for Name
and SSN on Page 1, when coming from the bread crumb trail on Page 2? 

My application is a Struts and J2EE based application.

Thanks.


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



RE: The design of bread crumb trail

2007-05-10 Thread Zhang, Larry \(L.\)
Thanks for the answers, but I would like a direct answer to my questions
(1)... (2)... . Any thoughts?

-Original Message-
From: Ray Clough [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 10, 2007 1:41 PM
To: Struts Users Mailing List
Subject: Re: The design of bread crumb trail

Are you using S1 or S2? 

I once implemented a S1 bread-crumbs facility using a custom 
RequestProcessor to put a stack of page url's into the user's session.  
This worked well, and allowed a page to return to any of the last 3 
pages.  I used it to go from the catalog page, where the user made a 
purchase selection, to a page showing details of the order item, and 
then back to the catalog page.  Since the catalog page could be any of a

number of pages, returning to the correct one required some special 
work.  The lack of this feature is why on most e-purchase sites they 
have a link continue shopping, which does NOT take you back to where 
you were. 

I've been wanting to implement a Struts-2 BreadCrumbsInterceptor, or 
maybe a Filter, but have not gotten around to it.  I'd be interested if 
anyone has done this.

- Ray Clough


Zhang, Larry (L.) wrote:
 Say I have two Jsp pages, Page 1, Page 2.

 On page 1 I have some text fields such as Name, SSN for example, and
the
 user types in Name and SSN and then submit the form and the navigation
 goes to page 2. On page 2 I have the bread crumb trail saying Page 1
 Page 2. Notice that Page 1 is a clickable link, and when you click on
 the link, Page 1 is shown. (Page 2, on the bread crumb trail, is not
 clickable since the current page is Page 2)

 My question is: (1) in current J2EE/Struts industry standard, does it
 make sense to display the data that the user entered on Page 1 for
Name
 and SSN when coming from the bread crumb trail on Page 2? (2) what
 technique I need to use to see the data that the user typed in for
Name
 and SSN on Page 1, when coming from the bread crumb trail on Page 2? 

 My application is a Struts and J2EE based application.

 Thanks.


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


   

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


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



RE: Load an .xml file when server start up

2007-04-19 Thread Zhang, Larry \(L.\)
Can you make it more detail? Do you have sample code on this? FYI, I
have already configured in web.xml to load the ActionServlet when server
starts up.  

-Original Message-
From: zhangfan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 19, 2007 6:11 AM
To: user@struts.apache.org
Subject: RE: Load an .xml file when server start up

 On 4/18/07, Zhang, Larry (L.) [EMAIL PROTECTED] wrote:
  I need to load an .xml file when Websphere server starts up. I am 
  using Struts ActionServlet as the only servlet in the app and I do 
  have a CustomProcessor extending TilesRequestProcessor. I am trying
to 
  load the .xml file when the server starts up. I configured to load 
  ActionServlet when server starts up in web.xml. Where should I put
my 
  code to load the .xml file during the server starts up.
 
  Thanks.

Maybe the PlugIn interface can provide what you want.
It's notified just before and after the application life cycle. 
http://struts.apache.org/1.3.8/apidocs/index.html
Also, you should configure to load ActionServlet when server starts up
in web.xml, so that the your plugin will be invoked before that.

Good luck.



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


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



Load an .xml file when server start up

2007-04-18 Thread Zhang, Larry \(L.\)
I need to load an .xml file when Websphere server starts up. I am using
Struts ActionServlet as the only servlet in the app and I do have a
CustomProcessor extending TilesRequestProcessor. I am trying to load the
.xml file when the server starts up. I configured to load ActionServlet
when server starts up in web.xml. Where should I put my code to load the
.xml file during the server starts up.

Thanks.

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



Struts CustomProcessor

2007-03-22 Thread Zhang, Larry \(L.\)
For my app specific security checking, is it a good idea to put the
checking logic in processValidate() method from Struts processor or
using J2EE filter?

Thanks.

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



Class path basic question and FileInputStream

2007-03-20 Thread Zhang, Larry \(L.\)
I have a program.xml file phycially located in a directory in my web
project class path in WSAD,then in my jsp I am trying to read this file,
I got an error saying the file is not found. Why? When creating File
file = new File(program.xml); on earth, which directory does JVM tries
to find out the file? Thanks.

P.S. JSP:

[EMAIL PROTECTED] language=java contentType=text/html; charset=ISO-8859-1
pageEncoding=ISO-8859-1%
[EMAIL PROTECTED] import=java.io.File,java.io.FileInputStream%
Hello world.br /
%
File file = new File(program.xml);
// JVM will fine out the file in the build directory instead of
from the class path
FileInputStream fis=new FileInputStream(file);
byte b[]=new byte[fis.available()];
fis.read(b);
String s = new String(b);
StringBuffer data = new StringBuffer(s);
System.out.println(Data:\n  + data.toString() + \n);
%  

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



Xml utilities

2007-02-22 Thread Zhang, Larry \(L.\)
I am trying to develop some classes used for XML parsing or generating
purposes. But I think it is difficult to abstract to write a common
utility since each XML document is different, and to parse that
document, we should have a different parser. So the question is what
utility class will look like so that it abstract some common
methods/usage so that all the team members can use the utility class. If
you can point me some example, that should be great.

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



RE: Xml utilities

2007-02-22 Thread Zhang, Larry \(L.\)
I know that DOM and SAX but what I am looking for is some sort of
wrapper or single point class so that all team members will use my class
instead of calling DOM or SAX directly.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 22, 2007 4:47 PM
To: Struts Users Mailing List
Subject: Re: Xml utilities

Hi Zhang,

I am not sure if i got your question correct. But, if you want some 
already existing XML parsers then DOM and SAX Parsers are the ones which

are used extensively. Again, i might be missing more efficient ones.

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



RE: Xml utilities

2007-02-22 Thread Zhang, Larry \(L.\)
What your suggesting is close to what I am trying to do. Do you have
some sample code or internet link discussing this? Another interesting
question -- when you talk about the schema --, is there a way to define
generic schema?

-Original Message-
From: Andrew Pliszka [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 22, 2007 4:48 PM
To: Struts Users Mailing List
Subject: Re: Xml utilities

I think what you have to do is create your own generic XML utility class

that is specific to your XML schema, that uses dom4j, or digester or 
XMLBeans as XML engine. You will have to create your a commons schema 
base for all your developers, that they will have to follow.

Andrew Pliszka

Zhang, Larry (L.) wrote:

I know that DOM and SAX but what I am looking for is some sort of
wrapper or single point class so that all team members will use my
class
instead of calling DOM or SAX directly.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 22, 2007 4:47 PM
To: Struts Users Mailing List
Subject: Re: Xml utilities

Hi Zhang,

I am not sure if i got your question correct. But, if you want some 
already existing XML parsers then DOM and SAX Parsers are the ones
which

are used extensively. Again, i might be missing more efficient ones.

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



  




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


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



Struts best practice

2007-02-16 Thread Zhang, Larry \(L.\)

 What logic should be typically added into the CustomRequestProcessor?
Thanks.

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



RE: Design issue

2007-02-05 Thread Zhang, Larry \(L.\)
I didn't see a case where (2) is better.

Ideas from other folks? Thanks. 

-Original Message-
From: Information Guzzler [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 02, 2007 6:32 PM
To: Struts Users Mailing List
Subject: Re: Design issue

Definitely (1) if you are strictly following MVC.

Is there any specific scenario wherein (2) seems good to you? If there
is
then explore ways to force it thro' controller


On 2/2/07, Zhang, Larry (L.) [EMAIL PROTECTED] wrote:


 Think about a typical struts app, and on the jsp there are text field
 and drop downs. There are two approaches:

 (1) the action populates all the text fields and drop downs from the
 Database, and then set the value into the actionform,  then the JSP
will
 get the values from the actionform
 (2) the action populates some fields (text field for example), and
leave
 other fields (drop down for example) to JSP to populate, on which a
jsp
 tag can go to the datasource to get the values.

 I personally prefer (1) since in (2) the jsp tag actually by pass the
 controller to get the data from Datasource.

 What do you think? Thanks.

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



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



RE: Design issue

2007-02-05 Thread Zhang, Larry \(L.\)
Jsp tag is supposed to be reusable, if you put the database logic in the
tag, then not only the tag is not reusable, but also your view tier
contacted with DB directly aross tiers.  

-Original Message-
From: Strachan, Paul [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 02, 2007 10:50 PM
To: Struts Users Mailing List
Subject: RE: Design issue

Hi,
 
I usually access my cached droplist data directly from the jsp - eg have
placed a bean called ReferenceDataCache on application scope with
getter methods. In jsp I can simply call:
 
c:set var=schoolList value=${ReferenceDataCache.schoolsList} /
html-el:select ...
  html-el:optionsCollection name=schoolList label=description
value=schoolCode /
/html-el:select
 
I also try to keep my struts forms only containing properties for the
http posted data. 
 
The controllers responsibility is dealing with http requests (flow
control, forwarding to the correct action etc) so I'm not quite sure
what you mean by saying the jsp tag actually by pass the
controller to get the data from Datasource
 
Additionally, specialized data can be added as request attributes,
either via your action/helper class or some sort of page controller
(tiles has this feature) - the idea behind a page controller (view tier)
is your page knows what data it needs, and your jsps are not tied to
your actions - in an ideal world you could reuse your jsps without
having to change much (or if any) backend java code.
 
Sometimes action classes/methods contain far to much business logic
which including supplying data necessary for the view - even if you
decide to forward to a different page your action is still preparing
data for a page that no longer needs it!
 
Just my 2c
 
Regards,
Paul



From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED]
Sent: Sat 2/3/2007 9:39 AM
To: Struts Users Mailing List
Subject: Design issue




 Think about a typical struts app, and on the jsp there are text field
and drop downs. There are two approaches:

(1) the action populates all the text fields and drop downs from the
Database, and then set the value into the actionform,  then the JSP will
get the values from the actionform
(2) the action populates some fields (text field for example), and leave
other fields (drop down for example) to JSP to populate, on which a jsp
tag can go to the datasource to get the values.

I personally prefer (1) since in (2) the jsp tag actually by pass the
controller to get the data from Datasource.

What do you think? Thanks.

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



**
This message is intended for the addressee named and may contain
privileged information or confidential information or both. If you
are not the intended recipient please delete it and notify the sender.
**

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


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



Design issue

2007-02-02 Thread Zhang, Larry \(L.\)

 Think about a typical struts app, and on the jsp there are text field
and drop downs. There are two approaches:

(1) the action populates all the text fields and drop downs from the
Database, and then set the value into the actionform,  then the JSP will
get the values from the actionform
(2) the action populates some fields (text field for example), and leave
other fields (drop down for example) to JSP to populate, on which a jsp
tag can go to the datasource to get the values.

I personally prefer (1) since in (2) the jsp tag actually by pass the
controller to get the data from Datasource.

What do you think? Thanks.

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



Struts vs JSF

2007-01-29 Thread Zhang, Larry \(L.\)
Can some one say something about the direction of Struts? Can we say it
will be replaced by JSF eventually? Is it easy to migrate struts to JSF?

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



How to get the property value in action

2007-01-18 Thread Zhang, Larry \(L.\)
I have the following action mapping, how to get the property value of
myProperty in action?

Thanks.

action path=/maintainMyProcess name=maintainForm
type=com.MaintainMyProcessAction parameter=method
set-property property=myProperty
value=myPropertyValue/
 /action

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



Synchrozertoken in Struts

2007-01-09 Thread Zhang, Larry \(L.\)
I have difficulty implementing synchronizer token design pattern in one
of me page, on which I have two link (href=...). I understand that it
would be easier if the link is a submit button. So my question is that
does Struts support synchronizer token for links?

Thanks.
 

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



Actionform 's property

2004-12-20 Thread Zhang, Larry \(L.\)
Say I have an action form 

MyForm extends ActionForm {
 List employeeList;
 //set/getter follows...
}

Suppose in my action class's execute method, 
I populated employeeList from database, and do
myForm.setEmployeeList(List someData);

Now in my Jsp, how to get this value and assign this value to a java
script variable?

Such as:

In my jsp:

% List iWantToGetThisList = ??? %

I know one way is that in the action's execute method, I put the
employeeList in the request using request.setAttribute(employeeList,
employeeList); but I don't want to do this way...

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



RE: Actionform 's property

2004-12-20 Thread Zhang, Larry \(L.\)
Thanks. This works.




-Original Message-
From: Daniel Perry [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 20, 2004 11:42 AM
To: Struts Users Mailing List
Subject: RE: Actionform 's property


Well the way you dont wish to use would be the normal way to do it :)

The form will be available in the request or session (depending on where
you put the form) scope from the jsp under the form's name.  So
${formName.employeeList} is the list from a JSTL perspective.  From
scriptlet, either:

=((full.package.name.MyForm)request.getAttribute(formName)).getElmploy
eeLi
st();
or
=((full.package.name.MyForm)session.getAttribute(formName)).getElmploy
eeLi
st();

Daniel.

 -Original Message-
 From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED]
 Sent: 20 December 2004 15:58
 To: Struts Users Mailing List
 Subject: Actionform 's property


 Say I have an action form

 MyForm extends ActionForm {
  List employeeList;
  //set/getter follows...
 }

 Suppose in my action class's execute method,
 I populated employeeList from database, and do 
 myForm.setEmployeeList(List someData);

 Now in my Jsp, how to get this value and assign this value to a java 
 script variable?

 Such as:

 In my jsp:

 % List iWantToGetThisList = ??? %

 I know one way is that in the action's execute method, I put the 
 employeeList in the request using request.setAttribute(employeeList,
 employeeList); but I don't want to do this way...




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


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



RE: Actionform 's property

2004-12-20 Thread Zhang, Larry \(L.\)
Thanks, this works.




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Monday, December 20, 2004 11:36 AM
To: Struts Users Mailing List
Subject: RE: Actionform 's property


He doesn't:  http://struts.apache.org/userGuide/struts-bean.html#define



McDonnell, Colm (MLIM) [EMAIL PROTECTED] 
12/20/2004 11:17 AM
Please respond to
Struts Users Mailing List [EMAIL PROTECTED]


To
Struts Users Mailing List [EMAIL PROTECTED]
cc

Subject
RE: Actionform 's property






Why do you want to do this? 

% List iWantToGetThisList = (List)
pageContext.getAttribute(employeeList); %

-Original Message-
From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED] 
Sent: 20 December 2004 15:58
To: Struts Users Mailing List
Subject: Actionform 's property


Say I have an action form 

MyForm extends ActionForm {
 List employeeList;
 //set/getter follows...
}

Suppose in my action class's execute method, 
I populated employeeList from database, and do
myForm.setEmployeeList(List someData);

Now in my Jsp, how to get this value and assign this value to a java
script variable?

Such as:

In my jsp:

% List iWantToGetThisList = ??? %

I know one way is that in the action's execute method, I put the
employeeList in the request using request.setAttribute(employeeList,
employeeList); but I don't want to do this way...

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

 
If you are not an intended recipient of this e-mail, please notify the 
sender, delete it and do not read, act upon, print, disclose, copy,
retain 
or redistribute it. Click here for important additional terms relating
to 
this e-mail. http://www.ml.com/email_terms/ 

 

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


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



RE: Struts Best Practices

2004-11-04 Thread Zhang, Larry \(L.\)
Then can you give me an example of dynamic view?




-Original Message-
From: Nishant [mailto:[EMAIL PROTECTED] 
Sent: Thursday, November 04, 2004 8:26 AM
To: Struts Users Mailing List
Subject: Re: Struts Best Practices



Once you've been using Struts for a while, you'll begin to notice that you spend a lot 
of time creating ActionForm classes. While these classes are critical to the MVC 
architecture of Struts (as they implement the view portion), they are usually simply a 
collection of bean properties and a validate method (also sometimes a reset method.)

With the Struts 1.1 release, developers have a new set of options to create their view 
objects, based around DynaBeans. DynaBeans are dynamically configured Java Beans, 
which means that they take their properties from some variety of external 
configuration (usually XML) rather than by explicit methods defined in the class.

Thus they give improved performance over ActionForm.It doesnot means that you should 
always use Dynaform .When Static view is required use ActioForm and when Dynamic view 
is use DynaForm.

regards

Nishant Patil
Software Engineer
Cybage Software Pvt. Ltd. (A CMM Level 3 Company)
West Avenue , Kalyani Nagar,
Pune - 411 006
Tel: 91-20-4041700  -355
Email: [EMAIL PROTECTED]
Website: www.cybage.com
There's a difference between knowing the path, and walking the path
- Original Message - 
From: Y, Rajagopal [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Thursday, November 04, 2004 6:48 PM
Subject: RE: Struts Best Practices


Can any one let me know what's the advantage of using DynaForm rather than ActionForm 
or FormBean.



-Original Message-
From: Gabriel França Campolina [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 04, 2004 6:47 PM
To: Struts Users Mailing List
Subject: Re: Struts Best Practices


I sugest some pratice:

Use plugin validador
Extends TilesRequestProcessor
Use DynaForm
Use Tiles
Use ExceptionHandler
Use Designer Partnner

I think that this,

If any folk has more comments, please go shared.

Sory my english, I'm braziliam

Gabriel F Campolina
SCJP




On Thu, 04 Nov 2004 11:05:56 +, Duncan Mills [EMAIL PROTECTED] wrote:
 Ted Husted has a good set of  resources and hints
 (http://www.husted.com/struts/)  though these may be too specific? You 
 should also check out the StrutsCatalog in the Wiki
 (http://wiki.apache.org/struts/StrutsCatalog)

 Regards

 Duncan Mills
 www.groundside.com/blog




 Tushar Agrawal wrote:

 Hi Folks,
 
 I am handling a web project and using struts framework. Can any one 
 tell
me where to find stuff on Struts Best Practices  or Desgin and Coding Standards for 
a struts Application.
 
 I request to please share your experinces on Struts Application 
 Design
Guidelines.
 
 Million Thanks in Advance
 
 Tushar Agrawal
 
 
 
 //
Tushar Agrawal
  Software Engineer
   Seclore Technology Pvt Ltd.
 IIT Powai, Bombay (Mah)
  Cell : +919819804870
website:www.seclore.com 
 /*/
 
 -
 Do you Yahoo!?
  Check out the new Yahoo! Front Page.  www.yahoo.com/a
 
 

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



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

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


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


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



Object size/memory usage

2004-10-25 Thread Zhang, Larry \(L.\)

Let's say I have two object

public calss Object1{
private name;
private id;
private depetId;

}

public calss Object2{
private name;
private id;
private depetId;
private country;
private jobFamily;
private isActive;
  . (there are another 100 attributes)

}

Then I create 

Object1 obj1= new Object1(); and set all attributes (name, id, depetId)
of this object.
Object2 obj2 = new Object2(); and then set the first three
attributes(name, id, depetId).

My question is that is obj1 and obj2 of the same size or usage of
memory?

Thanks.

   

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



RE: My IsValidToken() cannot trap duplicated submission.

2004-08-27 Thread Zhang, Larry \(L.\)
I think the resetToken should be placed as the first place in your action that 
processes your submitted form, instead of when you are done processing the submitted 
form.

-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED]
Sent: Friday, August 27, 2004 10:57 AM
To: Struts Users Mailing List
Subject: Re: My IsValidToken() cannot trap duplicated submission.


When you are done processing the submitted form, invoke resetToken.

Erik



PC Leung wrote:

After clicking submit button and then go back previous page, 
data is still there, click the submit button again. record will be
saved once more time. The IsValidToken cannot trap the duplicated
submission.

Initial page:
http://localhost:8080/erp/AddUserProfile.jsp
if clicking submit button, goes to 
http://localhost:8080/erp/addUserProfile.do?method=create

struts-config.xml like this.
actionpath=/addUserProfileSetup
   type=com.erp.quotation.AddUserProfileAction
   name=addUserProfileForm
  scope=request 
  validate=false
  forward name=success path=/AddUserProfile.jsp redirect=true/
/action 
actionpath=/addUserProfile
   type=com.erp.quotation.AddUserProfileDispatchAction
   name=addUserProfileForm
  scope=request 
  validate=true 
parameter=method
   input=/AddUserProfile.jsp
  forward name=success path=/AddUserProfile.jsp/
  forward name=failure path=/AddUserProfile.jsp/
  forward name=cancel path=/UserMaint.jsp/
/action

Initial page already shows with a token.

Why the following DispatchAction cannot trap duplicated submission?

public final class AddUserProfileDispatchAction extends DispatchAction {
public ActionForward create (ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response) 
  throws Exception {   
 HttpSession session = request.getSession();
 ActionErrors errors = new ActionErrors();
  if (!isTokenValid(request, true)) {
  errors.add(ActionErrors.GLOBAL_ERROR,
 new ActionError(error.transaction.token));
  }

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


  


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


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



RE: My IsValidToken() cannot trap duplicated submission.

2004-08-27 Thread Zhang, Larry \(L.\)
In my application, there will be no validation error in the FINAL submission stage; 
the validation error would be called earlier. If however there are other types of 
error (like database error, we just stop processing, but the second submission will be 
identified. Your question is valid, however, one of the synchronizer token usages is 
to prevent the duplicate submission. If you put the resetToken to the last and you 
have a long logic before resetToken, here is what will happen (1) you did a first 
submission (2) then submit again, at this point, the resetToken is not invoked yet, 
(since there is a long logic before it), the action just thinks this is the same token 
and it just allows it -which did actually prevent the duplicate submission, right?

Thanks.



-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED]
Sent: Friday, August 27, 2004 11:10 AM
To: Struts Users Mailing List
Subject: Re: My IsValidToken() cannot trap duplicated submission.


Larry, what if an error occurs after form validation, but during 
processing of the submit, which requires you to forward back to the 
input page?

Erik


Zhang, Larry (L.) wrote:

I think the resetToken should be placed as the first place in your action that 
processes your submitted form, instead of when you are done processing the submitted 
form.

-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED]
Sent: Friday, August 27, 2004 10:57 AM
To: Struts Users Mailing List
Subject: Re: My IsValidToken() cannot trap duplicated submission.


When you are done processing the submitted form, invoke resetToken.

Erik



PC Leung wrote:

  

After clicking submit button and then go back previous page, 
data is still there, click the submit button again. record will be
saved once more time. The IsValidToken cannot trap the duplicated
submission.

Initial page:
http://localhost:8080/erp/AddUserProfile.jsp
if clicking submit button, goes to 
http://localhost:8080/erp/addUserProfile.do?method=create

struts-config.xml like this.
   actionpath=/addUserProfileSetup
  type=com.erp.quotation.AddUserProfileAction
  name=addUserProfileForm
 scope=request 
 validate=false
 forward name=success path=/AddUserProfile.jsp redirect=true/
   /action 
   actionpath=/addUserProfile
  type=com.erp.quotation.AddUserProfileDispatchAction
  name=addUserProfileForm
 scope=request 
 validate=true 
   parameter=method
  input=/AddUserProfile.jsp
 forward name=success path=/AddUserProfile.jsp/
 forward name=failure path=/AddUserProfile.jsp/
 forward name=cancel path=/UserMaint.jsp/
   /action

Initial page already shows with a token.

Why the following DispatchAction cannot trap duplicated submission?

public final class AddUserProfileDispatchAction extends DispatchAction {
   public ActionForward create (ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response) 
 throws Exception {   
HttpSession session = request.getSession();
ActionErrors errors = new ActionErrors();
 if (!isTokenValid(request, true)) {
 errors.add(ActionErrors.GLOBAL_ERROR,
new ActionError(error.transaction.token));
 }

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


 




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


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


  


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


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



Instance variable is not recommended to be used in Action class

2004-08-26 Thread Zhang, Larry \(L.\)
Can some one tell me why the above is correct? Thanks.

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



RE: Struts security/validation

2004-08-11 Thread Zhang, Larry \(L.\)
Oracle sql insert needs to escape apostrophes so that you can insert apostrophes. So 
in your case you may need a utility method to convert all your text containing 
apostrophes to some thing like ''.

Example: If your user enters I like he's idea, when inserting to data base you need 
to convert it to be l like he''s idea.

Hope this helps.


-Original Message-
From: Wiebe de Jong [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 11, 2004 1:32 PM
To: 'Struts Users Mailing List'
Subject: RE: Struts security/validation


I had a similar problem, which I discovered when one of my users tried to
enter a street address containing an apostrophe. Since I use apostrophes to
delineate my text strings in my SQL statements, this caused a database
error. I fixed it by not allowing apostrophes to be entered into any of the
test fields.

I admit this is overly restrictive, but I don't know how to get the
apostrophe into my database otherwise. How would you do it Craig?

For SQL destined test, I disallow \ and '.
For XML destined text, I disallow , , , \, and .

Wiebe de Jong

-Original Message-
From: Craig McClanahan [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 11, 2004 10:21 AM
To: Struts Users Mailing List
Subject: Re: Struts security/validation

On Wed, 11 Aug 2004 14:45:05 +0100, James Adams [EMAIL PROTECTED] wrote:
 Hello all,
 
 I'm in the process of trying to secure my struts application against
Cross site scripting, SQL injection style attacks.
 
 One of the things I'm doing to prevent this is trying to restrict special
characters (;.(){}...etc) getting beyond the validator.
 

Just thinking out loud for a moment ...

Cross site scripting attacks don't happen when sensitive characters
are inside an *input* field.  The problem comes if you *output* the
data without filtering for them.  That's why the Struts bean:write
tag, for example, filters , , , and ; for you unless you
explicitly tell it not to, so if you are diligent about how you copy
your database data to output pages, you can safely accept these kinds
of character in input.

I notice that Kishore Senji (one of the other respondents in this
thread) is using Google's Gmail, just as I am at the moment.  Since
this is a web application, it's a good thing that Googe isn't
disallowing the magic characters on input into a textarea, or else we
would not be able to participate in this conversation :-).

Is filtering input really the appropriate strategy for dealing with
this problem?  If successful it will certainly help, but the approach
strikes me as overly restrictive for most application needs.

Craig

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


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


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



RE: [OT] Session facade

2004-07-07 Thread Zhang, Larry \(L.\)
Thanks all. I especially like  Firstly, just in case that EJBs will be introduced in 
subsequent phases.

However, before the discussion goes far from what I initially wanted, let me ask you 
this: is your Facade the same as my Session Facade?
I am reading  
http://java.sun.com/blueprints/corej2eepatterns/Patterns/SessionFacade.html, and I 
think Session Facade itself should be a session EJB, right?


-Original Message-
From: klute [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 07, 2004 4:34 PM
To: Struts Users Mailing List
Subject: Re: [OT] Session facade


Agree with Bill here. Also... the Constants file is
(or can be) quite 'C' as well. There is a temptation
to put all of your constants in one place and before
you know you end up putting all of your constants
encountered within your app there. So totally
unrelated stuff gets piled up into one place :-)


  

--- [EMAIL PROTECTED] wrote:
 :)
 
 Perhaps I could have used Exceptions but well at
 least I use a Constant 
 file a little better!
 The more I think about the better it seems to
 get damn I have some 
 code rewriting to do...
 
 Thanks Bill.
 
 
 
 
 
 
 Bill Siggelkow [EMAIL PROTECTED]
 Sent by: news [EMAIL PROTECTED]
 07/07/2004 04:10 PM
 Please respond to Struts Users Mailing List
 
 
 
 
  
 To: [EMAIL PROTECTED]
 cc: 
 
 Subject:Re: [OT] Session facade
  Classification: 
 
 
 Glenn, I was with you until the part about the
 return code ... I think 
 it would be better to translate the DAOException to
 some 
 BusinessServiceException or something similar
 instead of a return code.
 Generally, I try and avoid the method returns a -1
 to indicate that the 
 operation failed kind of thing -- it is so 'C' like
 :)
 
 [EMAIL PROTECTED] wrote:
 
  my 2 cents...
  
  I am using the Facade in my current project.
  
  Firstly, just in case that EJBs will be introduced
 in subsequent phases.
  
  Secondly, the DAO throws exceptions of
 DAOException  a FatalException.
  Say that a Stored Procedure returns an application
 error (invalid 
  parameter in a SP); this is treated as a
 DAOException.
  Say that the DB is not there this is treated as a
 FatalException.
  
  The Facade catches and interprets the DAOException
 with a Return Code.
  Say that the DB is used to authenticate a User Id
 and Password.
  The Facade is where the DAOException to translated
 into a simple Return 
  Code that the Action will check for.
  
  This a way the Action classes are nice a clean!
  - Glenn
  
  
  
  
  
  Ricardo Cortes [EMAIL PROTECTED]
  07/07/2004 03:28 PM
  Please respond to Struts Users Mailing List
  
  
  
  
  
  To: Struts Users Mailing List
 [EMAIL PROTECTED]
  cc: 
  
  Subject:RE: Session facade
   Classification: 
  
  
  I would assert you don't need the Session Facade
 as one of the 
 advantages 
  of the Session Facade is it's ability to abstract
 the low level 
 operations 
  of the Session EJBs from upper layers of your
 architecture.  You could 
  probably have your actions talking to a Business
 Delegate layer or your 
  DAO layer directly.  Of course, this is just one
 viewpoint.
  
  -Original Message-
  From: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, July 07, 2004 2:59 PM
  To: Struts Users Mailing List
  Subject: Session facade
  
  
  
   It seems session facade design pattern is
 becoming ubiquitous. My 
  question is that 
   if we are not going to use EJB(but we do have
 DAO-data access object), 
  does it still make sense to use session facade?
  
  Thanks.
  
  
  
 

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

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

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




__
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

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


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



security roles

2004-06-14 Thread Zhang, Larry \(L.\)
I want to define two security roles, one of which is employee and another is manager. 
Employee is not able to see some resources belonging to manager. Under J2EE standard, 
we can define these in web.xml, it also seems to me that this can be done in struts. 

Can you point out how to perform this task? Detailed instruction is appreciated.

Thanks.


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



RE: security roles

2004-06-14 Thread Zhang, Larry \(L.\)
Thanks Pedro. 

I am not using Tomcat, instead I am using IBM WSAD , so if I define the following 
lines in web.xml, 

security-role
descriptionA normal employee user/description
role-nameEmployee/role-name
/security-role
security-role
descriptiona manager user can do PR/description
role-nameManager/role-name
/security-role

can I access Employee and/or Manager role in struts-config.xml?

(2)also say a manager logon our sites, I can obtain the info for this user such as 
managerFlag, and then where should I put the logic to decide whether the user is a 
manager or an employee, and how to map this user to a security-role defined above?






-Original Message-
From: Pedro Salgado [mailto:[EMAIL PROTECTED]
Sent: Monday, June 14, 2004 3:38 PM
To: Struts Users Mailing List
Subject: Re: security roles



  In struts-config.xml, define the actions this way:


Only manager can execute the action

action ...

  roles=manager
/

Only employee can execute the action

action ...
  roles=employee
/

Manager or employee can execute the action

action ...
roles=manager, employee
/


Everyone can execute the action

action ...
  roles=
/


You can define the roles on your TOMCAT_HOME/conf/tomcat-users.xml (for
Tomcat 4.1.30).

Pedro Salgado


On 04/06/14 20:24, Zhang, Larry (L.) [EMAIL PROTECTED] wrote:

 I want to define two security roles, one of which is employee and another is
 manager. Employee is not able to see some resources belonging to manager.
 Under J2EE standard, we can define these in web.xml, it also seems to me that
 this can be done in struts.
 
 Can you point out how to perform this task? Detailed instruction is
 appreciated.
 
 Thanks.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


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


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



design security issue

2004-06-08 Thread Zhang, Larry \(L.\)
I have an web application on which the manager can view his manage tree and select his 
employee for transactions (such as Perfromance Rating, putting on Leave of absence). 
Definitely it is very vital in this case to keep the security or make sure one data 
for one employee is submitted not for another employee. Another thinking is that if 
the user come to a page via a bookmark or come to the page without visiting the 
previous page, we should catch this event and disallow the further action.  I need to 
come up some design solutions so that this security is handled elegantly. Any ideas? 
If you know some sites discussing this, please let me know.

Thanks.

Larry Zhang

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



RE: Struts 1.1 J2EE level?

2004-06-08 Thread Zhang, Larry \(L.\)
My answer is nothing theoretical but is practical:
We are using Struts 1.1 with J2EE 1.2 ( servlet 2.2 and JSP 1.1), they are running 
just fine.

-Original Message-
From: Yulin Zhao [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 08, 2004 4:35 PM
To: Struts Users Mailing List
Subject: Struts 1.1 J2EE level?




Our app server only supports J2EE1.2. Does struts1.1 have any requirement that
we need use what level of J2ee? (e.g.: do struts framework jars use any New
features from Servlet 2.3 or JSP1.2 or above?)
I searched a few websites and asked a few more experienced friends but didn't
find a sure answer. Struts1.1 seems to work with JSTL1.0 but implementations of
JSTL1.0 (Jakarta or WebSphere) are both based on J2EE1.3 (I don't need JSTL).

Thanks much
Yulin.



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


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



RE: design security issue

2004-06-08 Thread Zhang, Larry \(L.\)
Thank you Frank and Yuanbo, for the points. Our application is set up in SSL and 
password encryption. I guess my question is pretty 
detail oriented. See I want a design solution so that if the person coming to a page 
without visiting
previous page, I want to display the error page. Also since one manage has a lot of 
employees so I want to make sure the data is not somehow messed up.

Thanks.

-Original Message-
From: Frank Zammetti [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 08, 2004 5:41 PM
To: [EMAIL PROTECTED]
Subject: RE: design security issue


Excellent point, thanks for adding it!

Frank


From: Wang, Yuanbo [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Subject: RE: design security issue
Date: Tue, 8 Jun 2004 15:32:16 -0500

One comment. Make sure your ActionServlet intercepts all URL patterns so
any HTTP request need to get session validated first.

Yuanbo

-Original Message-
From: Frank Zammetti [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 08, 2004 3:34 PM
To: [EMAIL PROTECTED]
Subject: RE: design security issue


To really do security properly, you really should externalize it using a

product like Netegrity's SiteMinder.  That would be my first suggestion,
but
there is considerable cost in something like that, so it's not right for

everyone or every situation.

So, you can do some more minor things within your aop that should give
you
decent results:

(1) Don't do anything within any action unless a valid session is found.

This will keep quite a few people out of your app on it's own since they

won't be able to just hack together a URL with a query string.  I
accomplish
this in one app I did by having an ActionHelpers class, and the first
thing
any of my Actions do is call a validateSession() static method.  If no
session is present, forward right then and there to the logon page.  You

must be careful also that there is one and only one place in your code
that
creates a session, your logon Action most likely.

(2) Make sure your running through SSL.  Takes care of packet sniffing,
more
or less.

(3) Encrypt the passwords in your database with a one-way hash
encryption.
Makes administration a little bit of a pain (no way to read the
password),
but it also makes hacking the system a little tougher.

(4) Have good policies with regard to session timeouts and password
structure.  A 5-minute timeout might be too short depeneding on the app,
but
it's good security-wise.  Make sure you have solid rules for what a
password
must look like (i.e., 6-10 characters in length, at least one
non-alphabetic
character and one non-alphanumeric character, must be chaged once a
month,
etc.).

These are all easy to implement, and will lead to a fairly secure
system.
Not perfect, but reasonably secure.  Depending on your environment, it
might
be plenty.

Frank

 From: Zhang, Larry (L.) [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: design security issue
 Date: Tue, 8 Jun 2004 15:14:36 -0400
 
 I have an web application on which the manager can view his manage tree

 and
 select his employee for transactions (such as Perfromance Rating,
putting
 on Leave of absence). Definitely it is very vital in this case to keep
the
 security or make sure one data for one employee is submitted not for
 another employee. Another thinking is that if the user come to a page
via a
 bookmark or come to the page without visiting the previous page, we
should
 catch this event and disallow the further action.  I need to come up
some
 design solutions so that this security is handled elegantly. Any ideas?
If
 you know some sites discussing this, please let me know.
 
 Thanks.
 
 Larry Zhang
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

_
Watch the online reality show Mixed Messages with a friend and enter to
win
a trip to NY
http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/
01/


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


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


_
Watch the online reality show Mixed Messages with a friend and enter to win 
a trip to NY 
http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/01/


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

RE: caching data in application server and EJB usage

2004-06-07 Thread Zhang, Larry \(L.\)
If you cache in the oracle you still need a connection to it to get the data when 
running Java.
Please remember that I want to ask if we can use EJB replacing the pure Java object 
caching...

-Original Message-
From: Jose Ramon Diaz [mailto:[EMAIL PROTECTED]
Sent: Monday, June 07, 2004 10:12 AM
To: 'Struts Users Mailing List'
Subject: RE: caching data in application server and EJB usage


And why don´t you cache it in Oracle?
Isn´t it enough?

 -Mensaje original-
 De: Zhang, Larry (L.) [mailto:[EMAIL PROTECTED]
 Enviado el: lunes, 07 de junio de 2004 15:54
 Para: Struts Users Mailing List
 Asunto: caching data in application server and EJB usage


 I have a Oracle table that contains more than 1 rows and
 this table is almost a read-only table -- meaning that our
 web application uses this table just for read purposes. Since
 accessing the data in this table is frequent, so we decided
 to do some sort of caching so that the performance is meet.
 We cache the data from this table to application server's
 memory. My question is that in this case can we use EJB
 somehow to achieve the same goal? We select this because
 caching the data in the memory is memory expensive and our
 system has some memory constraints.

 Can you also discuss the pros and cons of using EJB and pure
 Java object caching (of data to application server).

 Thanks for your answers.

 Larry Zhang

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



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


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



People Soft Component Interface

2004-06-04 Thread Zhang, Larry \(L.\)
Sorry for this off topic question, but I don't know which group I should post this 
question. I posted this on People Soft company discussion group, but no one answered 
my question.

EJB in Java as a technology has become more and more widely used to perform 
transaction (update, delete, insert) against database. When using Java to perform a 
People Soft 8 transaction, we need to communicate to People Soft 8 tables via 
Component Interface(a People Soft 8 Java term). My question is that does using 
Component Interface prevent we employee EJB? Do you or you know of some one using EJB 
to perform People Soft 8 transaction via Component Interface?

Thanks folks.

Larry Zhang 

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



When to use EJB?

2004-06-02 Thread Zhang, Larry \(L.\)
Our web application uses Web sphere application server. The main transaction is to 
update People Soft database tables. We are using component interface (a People Soft 
term) to update the underline tables in People Soft. Associated to a transaction ( a 
People Soft database update for example), there will be another Oracle table insert. 
(The Oracle and People Soft databases are in different Unix boxes). Sounds like a good 
candidate to use 2 phase commit, and also a good candidate for EJB.

I want to gather some pros and cons as whether or not we should use EJB in this case. 
And also if it is possible to employee 2 phase commit protocol.

I appreciate your insights.

Thanks.

Larry Zhang

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



RE: validator.xml usage

2004-06-01 Thread Zhang, Larry \(L.\)
validation.xml and validator-rules.xml in Struts validation framework are used for 
both client and server side validation.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 4:15 PM
To: [EMAIL PROTECTED]
Subject: validator.xml usage


Is the validator.xml just for client-side validation? Or also for
server-side validation


---
 Thanks...
 Mick Knutson
 
 525 Market Street, SF, CA  94103
 (415) 222-1020
 [EMAIL PROTECTED]
 MAC A0103-223
---



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


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



RE: validator.xml usage

2004-06-01 Thread Zhang, Larry \(L.\)
You can define you own validator if you like:

Say you define this in validation.xml (meaning you want to validate attributeA by 
myRequried() method)

formset
 form name=yourForm
  field property=attributeA depends=myRequried
 arg0 key=yourForm.attributeA/
  /field
 /form
/formset

In your validator-rules.xml you define:

validator name=myRequired
classname=webcontext.com.Validator // change this to your own Validator 
class
   method=validateMyRequried
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionErrors,
   javax.servlet.http.HttpServletRequest
  msg=errors.myRequired
  /validator


Now you should in your Validator.java define/code validateMyRequried() method and pass 
in (java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionErrors,
   javax.servlet.http.HttpServletRequest),

Hope this helps.

Larry Zhang

-Original Message-
From: gads zooks [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 4:32 PM
To: Struts Users Mailing List
Subject: Re: validator.xml usage


that is trueif u want to use server side validation you can specify that in the 
struts-config.html
something like this
 
action path=/Action
name=FormToBeValidated
validate=true  --- set true here
parameter=function
input=somepage.jsp   --- goes to this page if validation fails
/
 
if you want to use javascript toowith the same setup (validation.xml, 
validator-rules.xml) u can add the html:javascript/ tag to your jsp and it will show 
u the errorsthere are also html:messages /  , u can check out the info at 
husted.com/struts site
 
hope this helps
 
amit


Rodrigo Oliveira [EMAIL PROTECTED] wrote:
The validation.xml you put the rules for client and server validation. The
struts validator validate your forms based on same validation rules.

[]´s

Rodrigo Oliveira
[EMAIL PROTECTED]


- Original Message - 
From: 
To: 
Sent: Tuesday, June 01, 2004 5:15 PM
Subject: validator.xml usage


 Is the validator.xml just for client-side validation? Or also for
 server-side validation


 ---
  Thanks...
  Mick Knutson
 
  525 Market Street, SF, CA 94103
  (415) 222-1020
  [EMAIL PROTECTED]
  MAC A0103-223
 ---



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




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


-
Do you Yahoo!?
Friends.  Fun. Try the all-new Yahoo! Messenger

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



Session size

2004-05-27 Thread Zhang, Larry \(L.\)
It is apparent true that if the session size is big, the performance will be 
negatively affected. The question is that how to actively control the size of session.

Let's discuss this question:

I have a page which displays all the subordinates of a manager, for some reasons I 
want to create a List or a Vector containing all the subordinates and put this List or 
Vector to the session. Each element in the List or Vector is a Java object, Employee( 
each Employee object has 200 String attributes, among which 5 are needed to be 
displayed on the screen)

A picture of this situation is:

Vector allSubordinates = new Vector();
allSubordinates.add(Employee1);
allSubordinates.add(Employee2);
...

allSubordinates.add(Employee1000);


session.setAttribute(allSubordinates,allSubordinates);

Do you think this actually makes the session very big?


Then what will be the improvement of the following? Instead of add all the employee 
objects, we create a very small object called DisplayObject, which just contains the 5 
attributes required on the screen.

Vector allSubordinates = new Vector();
allSubordinates.add(DisplayObject1);
allSubordinates.add(DisplayObject2);
...

allSubordinates.add(DisplayObject1000);


session.setAttribute(allSubordinates,allSubordinates);

Your sharing of opinion is appreciated!

Thanks.

Larry



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



RE: Session size

2004-05-27 Thread Zhang, Larry \(L.\)
In my case I have to keep the List in the session level instead of application level 
since different user will have different list of employees.

-Original Message-
From: Riyad Kalla [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 27, 2004 11:53 AM
To: Struts Users Mailing List
Subject: Re: Session size


Mike,
Good suggestions. I was dealing with something like this recently and decided 
that for me, adding caching at the DAO level:

e.g. List userList = UserDAO.getAllUsers();

would offer the biggest performance benefit since it would be:

(a) application wide, instead of per session
(b) returned Lists are 4-byte pointers to the actual list object cached in the 
DAO
(c) The DAO itself handles all manipulation of those types, so it knows when 
to invalid its own cache (on inserts/updates/removes)


What do people think about this strategy? (Before I spend a week implementing 
it :)

Best,
Riyad

On Thursday 27 May 2004 08:49 am, Mike Zatko wrote:
 I personally think its too big. Large amounts of data like that should
 be put in request scope so that it gets flushed out of memory right
 away. If you need the data to be persistent through the user's session
 lifetime, mabye try serializing it to a database. Of course, different
 situations call for different solutions. Also, I would try and replace
 your Vector with a non-synchronized Collection like an ArrayList or
 LinkedList unless you have some sort of mutlithreaded access to this
 collection.

 Riyad Kalla wrote:
 Larry,
 Good question. I am curious what others think about this situation as
  well.
 
 On Thursday 27 May 2004 08:24 am, Zhang, Larry (L.) wrote:
 It is apparent true that if the session size is big, the performance will
 be negatively affected. The question is that how to actively control the
 size of session.
 
 Let's discuss this question:
 
 I have a page which displays all the subordinates of a manager, for some
 reasons I want to create a List or a Vector containing all the
  subordinates and put this List or Vector to the session. Each element in
  the List or Vector is a Java object, Employee( each Employee object has
  200 String attributes, among which 5 are needed to be displayed on the
  screen)
 
 A picture of this situation is:
 
 Vector allSubordinates = new Vector();
 allSubordinates.add(Employee1);
 allSubordinates.add(Employee2);
 ...
 
 allSubordinates.add(Employee1000);
 
 
 session.setAttribute(allSubordinates,allSubordinates);
 
 Do you think this actually makes the session very big?
 
 
 Then what will be the improvement of the following? Instead of add all
  the employee objects, we create a very small object called
  DisplayObject, which just contains the 5 attributes required on the
  screen.
 
 Vector allSubordinates = new Vector();
 allSubordinates.add(DisplayObject1);
 allSubordinates.add(DisplayObject2);
 ...
 
 allSubordinates.add(DisplayObject1000);
 
 
 session.setAttribute(allSubordinates,allSubordinates);
 
 Your sharing of opinion is appreciated!
 
 Thanks.
 
 Larry
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

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


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



RE: Session size

2004-05-27 Thread Zhang, Larry \(L.\)
It sounds like very promising to me. The only consideration is that caching those 
objects may cause another issue of usage of the memory. And also when the tree is 
changed (by deleting/transferred one employee from the tree) we need to somehow 
validate/rebuild the cached list of objects.

Is this approach sometimes called object pool?

Thanks.

-Original Message-
From: Riyad Kalla [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 27, 2004 12:25 PM
To: Struts Users Mailing List
Subject: Re: Session size


Hmm, I should clarify what I meant:

The DAO will be at the application scope, so if you cache say the last 50 
queries, the cache is held at application scope. In your case, this will 
still help. 

Lets say you have 20 users all working on the site, they all hit their Show 
employement Tree page, and you hit the 
UserDAO.getEmploymentTreeForUserID(int userID) method for all 20 people with 
different ID's. That will perform 20 separate queries, cache the result, and 
return it.

Now when all those users hit the refresh button on their web page, it hits 
your DAO again, the same method, with all 20 separate ID's again. But this 
time, all 20 of them are successful cache hits and are returned immediately.

Now say users 1-5 log out and come back 2 hours later and check your 
employement tree page, IF their list had been stored in their sessions, that 
would require you to hit the DB again to reload the lists, but because your 
caching the results in your DAO itself, all of those 5 users that came back 
and check their employement tree, are getting all their results from the 
DAO's cache again since it was stored at the application level (the cache is 
still valid).


The other sexy thing is that if someone calls UserDAO.removeUserByID(4) or 
something liek that, your DAO knows to either (a) aggressively invalid all 
the cache and have all caches rebuilt, OR (b) you could take some time to 
intelligently remove that user from all cached values if it was import to you 
to keep your caches full.


It just gives you more options since all your cache building/invalidating 
occurs in the same DAO class, instead of needing to worry about synchronizing 
multiple resources and classes with eachother.

Did that make sense?

Best,
Riyad

On Thursday 27 May 2004 09:13 am, Zhang, Larry (L.) wrote:
 In my case I have to keep the List in the session level instead of
 application level since different user will have different list of
 employees.

 -Original Message-
 From: Riyad Kalla [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 27, 2004 11:53 AM
 To: Struts Users Mailing List
 Subject: Re: Session size


 Mike,
 Good suggestions. I was dealing with something like this recently and
 decided that for me, adding caching at the DAO level:

 e.g. List userList = UserDAO.getAllUsers();

 would offer the biggest performance benefit since it would be:

 (a) application wide, instead of per session
 (b) returned Lists are 4-byte pointers to the actual list object cached in
 the DAO
 (c) The DAO itself handles all manipulation of those types, so it knows
 when to invalid its own cache (on inserts/updates/removes)


 What do people think about this strategy? (Before I spend a week
 implementing it :)

 Best,
 Riyad

 On Thursday 27 May 2004 08:49 am, Mike Zatko wrote:
  I personally think its too big. Large amounts of data like that should
  be put in request scope so that it gets flushed out of memory right
  away. If you need the data to be persistent through the user's session
  lifetime, mabye try serializing it to a database. Of course, different
  situations call for different solutions. Also, I would try and replace
  your Vector with a non-synchronized Collection like an ArrayList or
  LinkedList unless you have some sort of mutlithreaded access to this
  collection.
 
  Riyad Kalla wrote:
  Larry,
  Good question. I am curious what others think about this situation as
   well.
  
  On Thursday 27 May 2004 08:24 am, Zhang, Larry (L.) wrote:
  It is apparent true that if the session size is big, the performance
   will be negatively affected. The question is that how to actively
   control the size of session.
  
  Let's discuss this question:
  
  I have a page which displays all the subordinates of a manager, for
   some reasons I want to create a List or a Vector containing all the
   subordinates and put this List or Vector to the session. Each element
   in the List or Vector is a Java object, Employee( each Employee object
   has 200 String attributes, among which 5 are needed to be displayed on
   the screen)
  
  A picture of this situation is:
  
Vector allSubordinates = new Vector();
allSubordinates.add(Employee1);
allSubordinates.add(Employee2);
...
  
allSubordinates.add(Employee1000);
  
  
  session.setAttribute

struts error message

2004-05-25 Thread Zhang, Larry \(L.\)

Struts has an internal tag html:errors/ to show the action errors on the current jsp 
page, which is OK. However, our business requirement is that in case there is an 
error, we display the error on an error jsp, then it is not advisable or easily to use 
html:errors/ since this tag is normally placed on the current jsp page. My questions 
are 

(1) is there any way to do in struts to display the error on an error jsp?

(2)What is your opinion on pros and cons of these two approaches: Display the error on 
the current page and display the error on a separate error page?

Please answer questions in order if possible.

Thanks.

Larry

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



RE: How to access a variable message resource bundle from JSP

2004-05-14 Thread Zhang, Larry \(L.\)
Suppose you have

% String countryCode = en; %

I think bean:message key=yourPropertyKey bundle=%=countryCode% will do your 
work.

Another way is that you save your Locale object to session in jsp something like

session.setAttribute(Globals.LOCALE_KEY, yourLocaleObject); 

then Struts can just find out the correct resource for different locale
when you use the following in the jsp
bean:message key=yourPropertyKey

Hope this helps.

Larry Zhang


-Original Message-
From: None None [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 11:40 AM
To: [EMAIL PROTECTED]
Subject: How to access a variable message resource bundle from JSP


Hi again everyone... yesterday, with assistance from some of you folks, I 
was able to get multiple message resource bundles working to return a 
Locale-specific error message from one of my Action classes.  Very cool.

Now I'm trying to do the same thing in a JSP.

Here's my question... in my JSP's, when using bean:message, I know that I 
can specify bundle=en or bundle=de and that works, since I have a 
properties file set up for English and German.  But how can I set the bundle 
attribute to a variable value?

In other words, at present I have String in session called countryCode, and 
it's literally the value EN, DE, or whatever else.  So, is there a way I can 
plug that string into the bean:message tag's bundle attribute?

Or, is there another method of specifying which of a number of message 
resource bundle to look in for a specific key that can be varied 
programmatically?  Or further still, is there specifically a special method 
to get locale-specific string in a JSP tag, as I am now able to do in my 
Action classes?

Thanks all!

_
MSN Toolbar provides one-click access to Hotmail from any Web page - FREE 
download! http://toolbar.msn.click-url.com/go/onm00200413ave/direct/01/


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


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



RE: Sharing what I've learned: locale switching

2004-05-14 Thread Zhang, Larry \(L.\)
Additionally, if you want other key(other than org.apache.struts.action.LOCALE 
=Globals.LOCALE_KEY) to store your locale,

you can do this:

session.setAttribute(myNewMeaningfulKey,myLocaleObject), then in your JSP you would 
use this:
bean:message key=myPropertyKey locale=myNewMeaningfulKey /. This is the way the 
locale attribute in message tag is used in struts. 

Thanks.

Larry Zhang

-Original Message-
From: Wang, Yuanbo [mailto:[EMAIL PROTECTED]
Sent: Friday, May 14, 2004 2:40 PM
To: Struts Users Mailing List
Subject: RE: Sharing what I've learned: locale switching


Thanks for sharing the information. Basically struts using the following
method to decide which Locale is in the session, then load the
corresponding resource bundle:

protected Locale getLocale(HttpServletRequest request)
{
HttpSession session = request.getSession();
Locale locale =
(Locale)session.getAttribute(org.apache.struts.action.LOCALE);
if(locale == null)
locale = defaultLocale;
return locale;
}

So to switch the Locale dynamically, update the Locale object saved in
the session. 

Thanks,
Yuanbo


-Original Message-
From: None None [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 14, 2004 2:16 PM
To: [EMAIL PROTECTED]
Subject: Sharing what I've learned: locale switching


Because this might be helpful to others, and because I probably would
have 
spent another couple of hours figuring it out on my own without the help
of 
some people on this lsit, I wanted to give back as much as I could.  So,

here's a consolidated bit of info I've learned about switching language
in 
your Struts apps...

What I have is a file manager application, more or less just for me to
learn 
Struts.  I wanted to have the ability to switch languages on-the-fly.
To do 
this, I've done the following:

(1) I created two files and placed them in WEB-INF/classes.  They are 
ofmResources_en.properties and ofmResources_de.properties (en for
English, 
de for German).  These files contain various text strings in both
language.  
For instance, there is a lable on the screen for file uploads which is 
defined as follows:

labels.uploadFile=Upload a file:

and for the German version:

labels.uploadFile=hochladen Sie eine Datei:

(2) I added the following entry to web.xml, as an init parameter of the 
ActionServlet:

init-param
param-nameapplication/param-name
param-valueofmResources/param-value
/init-param

As near as I can tell, NO entries are required in struts-config.xml.
You 
also do NOT need to do anything for each version of the resource file.
As 
long as they are named x_ll.properties, where x is the value of
the 
application parameter above, and ll is a valid country code, that's all 
there is to it.

(3) Next, I added some flag graphics to my web pages, one an American
flag, 
one a German flag.  Here is the HTML for them:

form name=changeLocaleForm method=post
action=changeLocale.ofm 
style=display:inline;
input type=hidden name=languageCode
table width=100% border=0 cellpadding=0 
cellspacing=0trtd align=right
input type=image src=img/flag_usa.gif hspace=6
border=0 
onClick=changeLocaleForm.languageCode.value='en';
input type=image src=img/flag_germany.gif hspace=6 
border=0 onClick=changeLocaleForm.languageCode.value='de';
/td/tr?table
/form

Pretty trivial stuff there.

(4) Next, I created an ActionForm called ChangeLocaleActionForm as
follows:

package com.mycompany.ofm.actionforms;
import org.apache.struts.action.*;
public class ChangeLocaleActionForm extends ActionForm {
private String languageCode = null;
public ChangeLocaleActionForm() {
languageCode = null;
}
public void setLanguageCode(String inLanguageCode) {
languageCode = inLanguageCode;
}
public String getLsnguageCode() {
return languageCode;
}
}

(5) Next, I created an accompanying Action:

package com.mycompany.ofm.actions;
import java.util.*;
import javax.servlet.http.*;
import com.omnytex.ofm.actionforms.*;
import org.apache.struts.*;
import org.apache.struts.action.*;
public class ChangeLocaleAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm
form, 
HttpServletRequest request, HttpServletResponse response) throws
Exception {
ChangeLocaleActionForm claf = (ChangeLocaleActionForm)form;
String languageCode = claf.getLsnguageCode();
request.getSession().setAttribute(Globals.LOCALE_KEY,
new 
Locale(languageCode));
return mapping.findForward(showPathContents);
}
}

As it turns out as someone here informed me, there is automagically a 
Locale in session, created based on what is sent by the browser.  So, by

default on my system the value en_US is stored in session under the name


Struts internationalization using bean:mesage.../

2004-05-11 Thread Zhang, Larry \(L.\)
This sounds easy, but I couldn't figure out how?

Suppose I have two resource files for two locales:

OnlineResource.properties (for default locale)
OnlineResource_it.properties (for locale Italian)

In my jsp, I can use bean:message key=myKey/ to retrieve the default locale value 
for myKey, then how to retrieve the property for Italian locale.
The struts doc says we can use bean:mesage key=myKey locale=???, the thing is  
what should I pass to locale parameter?

Thanks.

Larry

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



RE: struts.jar and struts source code

2004-05-06 Thread Zhang, Larry \(L.\)
Niall,

I am not sure if src/share contains all the .java files corresponding to classes in 
struts.jar. What happens is that I deleted struts.jar and put all the source files 
under src/share and then compile all the files in WSAD trying to generate all the 
classes in struts.jar, and I found one file ActionServlet.java doesn't compile since 
this class import org.xml.sax.InputSource, but there is no InputSource in the class 
path. And I also didn't find org.xml.sax.InputSource in struts.jar.

So did anyone has chance to include the struts source file to your project instead of 
just include a strus.jar?

Thanks.

Larry




-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 05, 2004 6:51 PM
To: Struts Users Mailing List
Subject: Re: struts.jar and struts source code


The source download includes alot more than just whats in struts.jar
(documentation, for automated testing stuff, examples etc etc) but all the
stuff in struts.jar is in the src/share directory.

Niall

- Original Message - 
From: Zhang, Larry (L.) [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Wednesday, May 05, 2004 11:38 PM
Subject: struts.jar and struts source code


When using Struts, it is easy to download struts.jar and put it in your
class path and then you are done. What if you want to use source code
instead of binary download. How can we identify those classes included in
struts.jar from the source download? This seems not to be easy since source
download bundle seems to be very messy.

Thanks.

Larry Zhang
Ford Motor Company

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





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


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



struts.jar and struts source code

2004-05-05 Thread Zhang, Larry \(L.\)
When using Struts, it is easy to download struts.jar and put it in your class path and 
then you are done. What if you want to use source code instead of binary download. How 
can we identify those classes included in struts.jar from the source download? This 
seems not to be easy since source download bundle seems to be very messy.

Thanks.

Larry Zhang
Ford Motor Company

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