s:select and pre-selection

2008-02-29 Thread Daniel Baldes

Hi,

I have a select box:

s:select name=user.property
  list=availableObjects listKey=id listValue=name /

availableObjects is a list of objects having an id and a name 
property, where id is of type long. user.property is 'converted' to 
its id (as String)  by a type converter.


Now, setting user.property works well with this, but the current value 
is not pre-selected when I load the form. When I show user.property in a 
textfield, the correct ID is displayed (the id of the option which 
should be pre-selected).


I found a hint in the s:select documentation, which says that for 
OGNL-generated maps, the type of the key-attribute must be the same as 
the type of the listKey property in order to match. So I implemented 
getIdAsString() and used listKey=idAsString, but it doesn't work either.


What am I doing wrong here?

(I am using struts 2.0.11)

Any help or hint will be appreciated.

Thanks in advance,

Daniel

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



How to add page links dynamically

2008-02-29 Thread Sanjeewa Saman
Hi all,

 

I want to add my page links in the top of the each page, that mean I need to
add the parent page details in sub pages on top like, 

Home  titlepage2 subtitle pageetc.. please c the image bellow

 

Can somebody suggest me a way to do this.  When I call struts2 actions I get
this pages. So is their way to do that using struts.

 

Sanjeewa. 

 

 





RE: about current action name acsess

2008-02-29 Thread hns

Nice guidance!
i want to ask just one thing how do i get  

if(postLoginURL != null  !postLoginURL.isEmpty())
  return redirect; 

it means i have to set 
if(ActionContext.getContext().get(postLoginURL) != null 
ActionContext.getContext().get(postLoginURL).isEmpty())

or another thing
 i am not experienced programmer in struts please help me!
-- 
View this message in context: 
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15754224.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: about current action name acsess

2008-02-29 Thread Kedar Choudhary
postLoginURL is coming from form post of login form(login.jsp).

LoginAction.java
private String postLoginURL;
//getter/setter

-Original Message-
From: hns [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 29, 2008 2:09 PM
To: user@struts.apache.org
Subject: RE: about current action name acsess


Nice guidance!
i want to ask just one thing how do i get  

if(postLoginURL != null  !postLoginURL.isEmpty())
  return redirect; 

it means i have to set 
if(ActionContext.getContext().get(postLoginURL) != null 
ActionContext.getContext().get(postLoginURL).isEmpty())

or another thing
 i am not experienced programmer in struts please help me!
-- 
View this message in context:
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15754224.h
tml
Sent from the Struts - User mailing list archive at Nabble.com.


-
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: about current action name acsess

2008-02-29 Thread hns

Thanks 
i have put setter and getter for postLoginURL
but using eclipse debugger i have found that postLoginURL is remains empty
i dont know why
so my result becomes success  instead of redirect 
what is an issue?
please help me?
-- 
View this message in context: 
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15755153.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: about current action name acsess

2008-02-29 Thread Kedar Choudhary
Have you put
s:hidden name=postLoginURL value=%{#postLoginURL}/s:hidden
in login form?
Check the source of rendered login page to see if this hidden input is
properly set to the URL we want to redirect.

Regards,
Kedar

-Original Message-
From: hns [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 29, 2008 3:18 PM
To: user@struts.apache.org
Subject: RE: about current action name acsess


Thanks 
i have put setter and getter for postLoginURL
but using eclipse debugger i have found that postLoginURL is remains empty
i dont know why
so my result becomes success  instead of redirect 
what is an issue?
please help me?
-- 
View this message in context:
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15755153.h
tml
Sent from the Struts - User mailing list archive at Nabble.com.


-
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: about current action name acsess

2008-02-29 Thread hns

Thanks 

yes i have put hidden field already as per you told 
but it can not show any param of requestURL in url
i think i can not get any value of %{#postLoginURL}
what actually happens i dont know
how can i check value of postLoginURL is available upto login.jsp
or not
can i use 
%=ActionContext.getContext().getParameters()) %
but it shows null at login.jsp

Regards 
Hardik shah
-- 
View this message in context: 
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15755941.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: good tutorial recommendation

2008-02-29 Thread hns

if u are using struts 2.0.11 then
struts-blank.war is primer for application
another helpful sites are also available in struts docs
named title articles 
this is wondurful links for struts help
after basics u can use mailreader.war for profession development   
-- 
View this message in context: 
http://www.nabble.com/good-tutorial-recommendation-tp15756189p15756433.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: expression validator

2008-02-29 Thread Sanjeewa Saman
Hi, 
You can override the default functionality and use , create the
validator.xml such that is can compare strings.

Refer the following site ,
http://struts2issues.blogspot.com/ 

this will give a complete idea of doing it.

Thanks .

-Original Message-
From: mojoRising [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 29, 2008 4:16 AM
To: user@struts.apache.org
Subject: Re: expression validator


Thanks, I confirmed my syntax, and now it does not do any client side
validation. Do I have this validator in the right place? Here is the
relevant code from my xml file:


!DOCTYPE validators PUBLIC
-//OpenSymphony Group//XWork Validator 1.0.2//EN
http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd;

validators
field name=password
field-validator type=requiredstring
message key=requiredstring/
/field-validator
/field
field name=password2
field-validator type=requiredstring
message key=requiredstring/
/field-validator  
/field

validator type=expression 
  password2.equals(password) 
  messagePassword not the same as
Confirmed/message 
/validator

/validators




From the validator documentation.

  validator type=expression
  email.equals(email2)
  messageEmail not the same as email2/message
  /validator

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications


-- 
View this message in context:
http://www.nabble.com/expression-validator-tp15746472p15747878.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
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]



good tutorial recommendation

2008-02-29 Thread Rilawich Ango
Hi all,
  Anyone can recommend a good tutorial to develop web application
using struts and eclipse as a GUI?
thanks, ango

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



RE: about current action name acsess

2008-02-29 Thread hns

please help 
i am waiting for your reply
-- 
View this message in context: 
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15756791.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: good tutorial recommendation

2008-02-29 Thread Deepak Kumar
Hello,

Please check http://www.roseindia.net/struts and
http://www.roseindia.net/struts/struts2

Thanks


-Original Message-
From: Rilawich Ango [mailto:[EMAIL PROTECTED]
Sent: Friday, February 29, 2008 4:23 PM
To: user@struts.apache.org
Subject: good tutorial recommendation


Hi all,
  Anyone can recommend a good tutorial to develop web application
using struts and eclipse as a GUI?
thanks, ango

-
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: good tutorial recommendation

2008-02-29 Thread Lukasz Lenart
Hi,

You can use also maven2 (2.0.8)

mvn archetype:create

and you will have some option to chose (8, 19-23)


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



persistence and doubts on usage of hibernate in struts 2

2008-02-29 Thread Vinicius Cubas Brand
Hello. I am having a problem with the usage of hibernate and its persistence 
mechanism.


I have an Action with a method for creation of an entity type and other 
method for updating. This action implements a Preparable and in its method 
prepare() I verify if the entity is being created or updated, depending if 
an ID came from the jsp form.



public void prepare() throws Exception {
if (getId() == null) {
operador = new Operador();
} else {
operador = getSegurancaService().carregarOperador(id);
}
}

(This Operador is a model with a corresponding table on the database.)

Before saving, I have a condition to verify. I need to verify if there is 
another row in the table Operador in the database with the same value in the 
field Operador.email, for instance. In my previous systems working with 
another languages, I did the following in this case:


- fetch object from database
- update its properties with the form values
- made the necessary validations, and IF the validations pass, save the 
object (for instance calling a method Object.save). I am doing manual 
validations in the action.


However, for hibernate this does not work, because it considers the updated 
object as part of the database. So when I  try to fetch in the database to 
see if there is already a row with Operador.email field with the value 
entered in the form, the Hibernate automatically saves the current operador 
before fetching and will ever find a row (the current) with the desired 
value for e-mail field.



Is there some way to disable this auto-saving behaviour in Hibernate?

I thought about ever creating a new object to receive the form data, after 
that make the validations I need to, and after the validations pass, get the 
object I want to update from the database and do a kind of merge between the 
new object with the form data and the object from the database;


What do you do in these situations? What do you recommend? thanks.




Vinicius Cubas Brand
DATAPROM®
Software para Clientes
www.dataprom.com 



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



Re: persistence and doubts on usage of hibernate in struts 2

2008-02-29 Thread Toni Lyytikäinen
Hard to say where the problem lies without having a look at the DAO code.
Are you using OpenSessionInViewFilter or similar mechanism for lazy loading
in the view? If yes, try setting the param singleSession to false like this:

filter-nameOSIVFilter/filter-name
filter-class
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
/filter-class
init-param
param-namesingleSession/param-name
param-valuefalse/param-value
/init-param

Also, you can define the field to be unique in the Hibernate mapping. That
way the object can only be persisted to database if the email field is
unique. Otherwise it will throw a ConstraintViolationException that you can
catch. But the recommended approach is to first try to fix the problems in
the DAO layer.


On Fri, Feb 29, 2008 at 2:23 PM, Vinicius Cubas Brand 
[EMAIL PROTECTED] wrote:

 Hello. I am having a problem with the usage of hibernate and its
 persistence
 mechanism.

 I have an Action with a method for creation of an entity type and other
 method for updating. This action implements a Preparable and in its method
 prepare() I verify if the entity is being created or updated, depending if
 an ID came from the jsp form.


 public void prepare() throws Exception {
 if (getId() == null) {
 operador = new Operador();
 } else {
 operador = getSegurancaService().carregarOperador(id);
 }
 }

 (This Operador is a model with a corresponding table on the database.)

 Before saving, I have a condition to verify. I need to verify if there is
 another row in the table Operador in the database with the same value in
 the
 field Operador.email, for instance. In my previous systems working with
 another languages, I did the following in this case:

 - fetch object from database
 - update its properties with the form values
 - made the necessary validations, and IF the validations pass, save the
 object (for instance calling a method Object.save). I am doing manual
 validations in the action.

 However, for hibernate this does not work, because it considers the
 updated
 object as part of the database. So when I  try to fetch in the database to
 see if there is already a row with Operador.email field with the value
 entered in the form, the Hibernate automatically saves the current
 operador
 before fetching and will ever find a row (the current) with the desired
 value for e-mail field.


 Is there some way to disable this auto-saving behaviour in Hibernate?

 I thought about ever creating a new object to receive the form data, after
 that make the validations I need to, and after the validations pass, get
 the
 object I want to update from the database and do a kind of merge between
 the
 new object with the form data and the object from the database;

 What do you do in these situations? What do you recommend? thanks.




 Vinicius Cubas Brand
 DATAPROM(R)
 Software para Clientes
 www.dataprom.com


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




Re: How to add page links dynamically

2008-02-29 Thread Richard Sayre
I think what you are looking for is caled bread crumbs.

There is a plug in to help with this

http://cwiki.apache.org/S2PLUGINS/breadcrumbs-plugin.html



On Fri, Feb 29, 2008 at 5:04 AM, Sanjeewa Saman [EMAIL PROTECTED] wrote:




 Hi all,



 I want to add my page links in the top of the each page, that mean I need to
 add the parent page details in sub pages on top like,

 Home  titlepage2 subtitle pageetc.. please c the image bellow



 Can somebody suggest me a way to do this.  When I call struts2 actions I get
 this pages. So is their way to do that using struts.



 Sanjeewa.







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



RE: persistence and doubts on usage of hibernate in struts 2

2008-02-29 Thread Kedar Choudhary
I think you will get better answer to your question in hibernate mailing
list, as the issue is related to hibernate rather than struts.

To disable 'auto-saving' behavior, you can evict the object from hibernate
session. So in your prepare method, call session.evict(operator).
Then, to save the modifications, you can call saveOrUpdate() or merge.

Regards,
Kedar

-Original Message-
From: Toni Lyytikäinen [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 29, 2008 6:19 PM
To: Struts Users Mailing List
Subject: Re: persistence and doubts on usage of hibernate in struts 2

Hard to say where the problem lies without having a look at the DAO code.
Are you using OpenSessionInViewFilter or similar mechanism for lazy loading
in the view? If yes, try setting the param singleSession to false like this:

filter-nameOSIVFilter/filter-name
filter-class
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
/filter-class
init-param
param-namesingleSession/param-name
param-valuefalse/param-value
/init-param

Also, you can define the field to be unique in the Hibernate mapping. That
way the object can only be persisted to database if the email field is
unique. Otherwise it will throw a ConstraintViolationException that you can
catch. But the recommended approach is to first try to fix the problems in
the DAO layer.


On Fri, Feb 29, 2008 at 2:23 PM, Vinicius Cubas Brand 
[EMAIL PROTECTED] wrote:

 Hello. I am having a problem with the usage of hibernate and its
 persistence
 mechanism.

 I have an Action with a method for creation of an entity type and other
 method for updating. This action implements a Preparable and in its method
 prepare() I verify if the entity is being created or updated, depending if
 an ID came from the jsp form.


 public void prepare() throws Exception {
 if (getId() == null) {
 operador = new Operador();
 } else {
 operador = getSegurancaService().carregarOperador(id);
 }
 }

 (This Operador is a model with a corresponding table on the database.)

 Before saving, I have a condition to verify. I need to verify if there is
 another row in the table Operador in the database with the same value in
 the
 field Operador.email, for instance. In my previous systems working with
 another languages, I did the following in this case:

 - fetch object from database
 - update its properties with the form values
 - made the necessary validations, and IF the validations pass, save the
 object (for instance calling a method Object.save). I am doing manual
 validations in the action.

 However, for hibernate this does not work, because it considers the
 updated
 object as part of the database. So when I  try to fetch in the database to
 see if there is already a row with Operador.email field with the value
 entered in the form, the Hibernate automatically saves the current
 operador
 before fetching and will ever find a row (the current) with the desired
 value for e-mail field.


 Is there some way to disable this auto-saving behaviour in Hibernate?

 I thought about ever creating a new object to receive the form data, after
 that make the validations I need to, and after the validations pass, get
 the
 object I want to update from the database and do a kind of merge between
 the
 new object with the form data and the object from the database;

 What do you do in these situations? What do you recommend? thanks.




 Vinicius Cubas Brand
 DATAPROM(R)
 Software para Clientes
 www.dataprom.com


 -
 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]



Struts2 TestNG issue

2008-02-29 Thread Diwant Vaidya

Hi all,

I am running a test case (code at: http://paste-it.net/6849)

The MockConfiguration object that gets used is returning an
UnsupportedMethodException.  Is the class deprecated?  What class should I
use?  Can someone point me to a working TestNG + Struts2 Action example that
tests the full interceptor stack?  I would prefer without the spring-struts
integration, but I will still consider it.

Thanks,
Diwant
-- 
View this message in context: 
http://www.nabble.com/Struts2-TestNG-issue-tp15758557p15758557.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: s:select and pre-selection

2008-02-29 Thread Richard Sayre
I have a select that populates with a int,string id/value combo.  To
get the s:select to select the proper option I had to crate another
value in my action (int myId).  This would be set to the id of the
option to select.  Then I had to set the name attribute of my select
to myId (name=myId).

On Fri, Feb 29, 2008 at 5:04 AM, Daniel Baldes [EMAIL PROTECTED] wrote:
 Hi,

  I have a select box:

  s:select name=user.property
list=availableObjects listKey=id listValue=name /

  availableObjects is a list of objects having an id and a name
  property, where id is of type long. user.property is 'converted' to
  its id (as String)  by a type converter.

  Now, setting user.property works well with this, but the current value
  is not pre-selected when I load the form. When I show user.property in a
  textfield, the correct ID is displayed (the id of the option which
  should be pre-selected).

  I found a hint in the s:select documentation, which says that for
  OGNL-generated maps, the type of the key-attribute must be the same as
  the type of the listKey property in order to match. So I implemented
  getIdAsString() and used listKey=idAsString, but it doesn't work either.

  What am I doing wrong here?

  (I am using struts 2.0.11)

  Any help or hint will be appreciated.

  Thanks in advance,

  Daniel

  -
  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: good tutorial recommendation

2008-02-29 Thread stanlick
There is a really good Struts 2 book
http://www.manning.com/dbrown/available at Manning.

Scott

On Fri, Feb 29, 2008 at 4:53 AM, Rilawich Ango [EMAIL PROTECTED]
wrote:

 Hi all,
  Anyone can recommend a good tutorial to develop web application
 using struts and eclipse as a GUI?
 thanks, ango

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




-- 
Scott
[EMAIL PROTECTED]


RE: expression validator

2008-02-29 Thread Deepak Kumar
Hi,

Here is very good example with running source code.
http://www.roseindia.net/struts/struts2/struts-2-client-side-validation-exam
ple.shtml

Thanks


-Original Message-
From: Sanjeewa Saman [mailto:[EMAIL PROTECTED]
Sent: Friday, February 29, 2008 4:36 PM
To: 'Struts Users Mailing List'
Subject: RE: expression validator


Hi,
You can override the default functionality and use , create the
validator.xml such that is can compare strings.

Refer the following site ,
http://struts2issues.blogspot.com/

this will give a complete idea of doing it.

Thanks .

-Original Message-
From: mojoRising [mailto:[EMAIL PROTECTED]
Sent: Friday, February 29, 2008 4:16 AM
To: user@struts.apache.org
Subject: Re: expression validator


Thanks, I confirmed my syntax, and now it does not do any client side
validation. Do I have this validator in the right place? Here is the
relevant code from my xml file:


!DOCTYPE validators PUBLIC
-//OpenSymphony Group//XWork Validator 1.0.2//EN
http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd;

validators
field name=password
field-validator type=requiredstring
message key=requiredstring/
/field-validator
/field
field name=password2
field-validator type=requiredstring
message key=requiredstring/
/field-validator
/field

validator type=expression
  password2.equals(password)
  messagePassword not the same as
Confirmed/message
/validator

/validators




From the validator documentation.

  validator type=expression
  email.equals(email2)
  messageEmail not the same as email2/message
  /validator

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications


--
View this message in context:
http://www.nabble.com/expression-validator-tp15746472p15747878.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
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: about current action name acsess

2008-02-29 Thread Jeromy Evans

hns wrote:
please help 
i am waiting for your reply
  
Kedar's example looks really good.  Double-check that you've done 
everything he's asked
Put a breakpoint inside your interceptor to see if postLoginURL is being 
built correctly.

Assist your debugging by forcing it to return redirect every time.

I would have thought the hidden field should have been this though:

s:hidden name=postLoginURL value=%{postLoginURL}/s:hidden

(I have removed the # as # implies a root object rather than a property of the 
action)


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



Re: s:select and pre-selection

2008-02-29 Thread Daniel Baldes

Daniel Baldes wrote:

Hi,

I have a select box:

s:select name=user.property
  list=availableObjects listKey=id listValue=name /


Ok, I found it myself:

s:select name=user.property value=%{user.property.id}
  list=availableObjects listKey=id listValue=name /

this works. It seems the code which does the pre-selection does not use 
the type-converted value of user.property but the original value.


Cheers,
Daniel

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



sitemesh problem

2008-02-29 Thread hns

hi
i have one default namespace / and another /webmail
css applied to decorator is worked in / but it can not work at /webmail
what is problem?
-- 
View this message in context: 
http://www.nabble.com/sitemesh-problem-tp15759026p15759026.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: good tutorial recommendation

2008-02-29 Thread Dave Newton
--- [EMAIL PROTECTED] wrote:
 There is a really good Struts 2 book
 http://www.manning.com/dbrown/available at Manning.

A disclaimer is probably in order.

Dave


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



RE: expression validator

2008-02-29 Thread Dave Newton
--- Deepak Kumar [EMAIL PROTECTED] wrote:
 Here is very good example with running source code.

http://www.roseindia.net/struts/struts2/struts-2-client-side-validation-example.shtml

Hmm, that doesn't seem to do client-side expression validation either, unless
I missed it. Perhaps you can point it out.

Dave


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



Re: good tutorial recommendation

2008-02-29 Thread stanlick
disclaimer :
Don Brown, Chad Davis and I have an affiliation with this manuscript.

How's that David?

On Fri, Feb 29, 2008 at 8:16 AM, Dave Newton [EMAIL PROTECTED] wrote:

 --- [EMAIL PROTECTED] wrote:
  There is a really good Struts 2 book
  http://www.manning.com/dbrown/available at Manning.

 A disclaimer is probably in order.

 Dave


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




-- 
Scott
[EMAIL PROTECTED]


Invoking action method from javascript

2008-02-29 Thread Paranoid_Fabio

Hello. I've an action that populates a table with some info. In each row,
there's a button to delete the entry and the associated object from the DB.
In my action class I've a list (something like a queue) of the ID that will
be removed after the user clicks on the apply button.
So, all I want to do, is to add each element ID the user selects to the
remove-queue. When the user clicks on the remove icon, a javascript
function is called:

the jsp snippet:

td ') 
 ../pages/Images/edit_remove.png /img
/td

the script inside the JSP.

script type=text/javascript
 function addToRemoveList(id){

 }
/script

The script is correctly invoked and the paramater ID is correctly passed.
Now i would like to call a method of my action class and to refresh the
page. Something like:

script type=text/javascript
 function addToRemoveList(id){

myCurrentAction.addItemToRemove(id)


 }
/script

is it possible? thank you very much


-- 
View this message in context: 
http://www.nabble.com/Invoking-action-method-from-javascript-tp15759459p15759459.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: expression validator

2008-02-29 Thread Dave Newton
--- mojoRising [EMAIL PROTECTED] wrote:
 Thanks. But I still don't understand...According to the link you mentioned
 it is not possible to do what I was trying to. So, what is the point of
this
 validator if it doesn't do client side validation? 

Because there are other places to do validation, like the server.

 And, are you saying that it is not possible to do a simple
 'equals' test in client side validation? 
 
  validator type=expressionpassword.equals(password2)
 messagePasswords do not match/message 
/validator 

The expressions used by the expression validator [1] are OGNL-based
expressions, not JavaScript. It would be *possible*, but JavaScript !=OGNL,
and it's my assumption that nobody wanted to write a JavaScript library that
implements everything available in OGNL.

That said, I suppose one could take a DWR-like Java = JavaScript mapping
layer then write OGNL in JavaScript and hook the two up. I don't know what
the current status of the XWork validation framework re-thinking is, but I'm
sure if something like that was contributed we'd look at it.

Dave

[1] http://struts.apache.org/2.x/docs/expression-validator.html



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



RE: Struts serving both HTML requests and web service?

2008-02-29 Thread Allen, Daniel
Ok, thanks. As long as I know I'm not going in a completely ridiculous
direction, I'll make it work.

~Dan 

-Original Message-
From: Randy Burgess [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 28, 2008 6:18 PM
To: Struts Users Mailing List
Subject: Re: Struts serving both HTML requests and web service?

If you have shared functionality then it sounds like a good candidate
for
web services. I wouldn't do the shared JAR deal.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



 From: Allen, Daniel [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Date: Thu, 28 Feb 2008 16:59:03 -0500
 To: Struts Users Mailing List user@struts.apache.org
 Subject: RE: Struts serving both HTML requests and web service?
 
 Well, the same application is now expected to talk to the public at
 large via a web site and also provide updates about their interactions
 to an internal web site. So, I do need to expose some sort of web
 service. It will actually be different business logic, but it will
refer
 to a lot of the same classes, the same database access, etc. Are you
 saying that you think it would make more sense to just refactor that
 into a separate shared JAR and then have three projects, Struts,
Shared,
 and WebService (possibly running CXF on the last)?
 
 Thanks for the advice,
 ~Dan
 
 -Original Message-
 From: Randy Burgess [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 28, 2008 4:49 PM
 To: Struts Users Mailing List
 Subject: Re: Struts serving both HTML requests and web service?
 
 That thread was about exposing business logic used in a S2 app as web
 services for use in other applications. If you are interested in web
 services then the CXF site is a good place to start. Personally I
 wouldn't
 go to the trouble of creating web services just to use them in an S2
web
 app. 
 
 There is an STP Eclipse plugin that will work with CXF but AFAIK there
 is no
 direct integration between CXF and Struts 1/2.
 
 http://incubator.apache.org/cxf/
 
 Regards,
 Randy Burgess
 Sr. Web Applications Developer
 Nuvox Communications
 
 
 
 From: Allen, Daniel [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Date: Thu, 28 Feb 2008 14:20:54 -0500
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Struts serving both HTML requests and web service?
 
 I saw a thread go by while back about Struts and web services, and
 someone suggested Spring and CXF. I've got Spring integrated into my
 Struts (2.0.11) application, but I'm not familiar with CXF at all,
nor
 have I actually ever put together a web service before.
 
 Does anyone know of a good guide to integrating those, or an example?
 Is
 there a CXF struts plugin? I mostly need the really basic stuff, like
 the result type for a struts action that would be accessed as a web
 service. (Or should I just have a separate servlet running on the
same
 server?)
 
 I know this is a very general question, but anything will help.
 Thanks,
 ~Dan
 
 -- 
 This message may contain confidential, proprietary, or legally
 privileged
 information. No confidentiality or privilege is waived by any
 transmission to
 an unintended recipient. If you are not an intended recipient, please
 notify
 the sender and delete this message immediately. Any views expressed
in
 this
 message are those of the sender, not those of any entity within the
 KBC
 Financial Products group of companies (together referred to as KBC
 FP).
 
 This message does not create any obligation, contractual or
otherwise,
 on the
 part of KBC FP. It is not an offer (or solicitation of an offer) of,
 or a
 recommendation to buy or sell, any financial product. Any prices or
 other
 values included in this message are indicative only, and do not
 necessarily
 represent current market prices, prices at which KBC FP would enter
 into a
 transaction, or prices at which similar transactions may be carried
on
 KBC
 FP's own books. The information contained in this message is provided
 as is,
 without representations or warranties, express or implied, of any
 kind. Past
 performance is not indicative of future returns.
 
 
 
 
 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]
 
 
 -- 
 This message may contain confidential, proprietary, or legally
privileged
 information. No confidentiality or privilege is waived by any

Re: Invoking action method from javascript

2008-02-29 Thread Dave Newton
--- Paranoid_Fabio [EMAIL PROTECTED] wrote:
 I don't want to invoke a removeAction for every click...but I think it's
 the only way..isn't it?

You could keep a JavaScript variable containing a comma- (or whatever-)
separated list of IDs to remove and submit that value on submission, parse
the value in the action, and delete the appropriate DB entries.

Dave


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



Re: Invoking action method from javascript

2008-02-29 Thread Paranoid_Fabio

Ok. Thank you. I will try this way.


Paranoid_Fabio wrote:
 
 Hello. I've an action that populates a table with some info. In each row,
 there's a button to delete the entry and the associated object from the
 DB.
 In my action class I've a list (something like a queue) of the ID that
 will be removed after the user clicks on the apply button.
 So, all I want to do, is to add each element ID the user selects to the
 remove-queue. When the user clicks on the remove icon, a javascript
 function is called:
 
 the jsp snippet:
 
 td ') 
../pages/Images/edit_remove.png /img
  /td
 
 the script inside the JSP.
 
 script type=text/javascript
function addToRemoveList(id){
   
}
 /script
 
 The script is correctly invoked and the paramater ID is correctly passed.
 Now i would like to call a method of my action class and to refresh the
 page. Something like:
 
 script type=text/javascript
function addToRemoveList(id){
 
   myCurrentAction.addItemToRemove(id)
 
 
}
 /script
 
 is it possible? thank you very much
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Invoking-action-method-from-javascript-tp15759459p15761284.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: expression validator

2008-02-29 Thread Martin Gainty
declare the field validator such as the field-name declared in validators in
FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xm
l
validators
  field name=requiredStringValidatorField
field-validator type=requiredstring
  param name=trimtrue/param
message key=i18n.nothing.here![CDATA[ required and must be
string ]]/message
/field-validator
  /field

in the jsp setup a textfield which uses the preconfigured
requiredStringValidatorField as described in this example from
/validation/clientSideValidationExample.jsp
   s:textfield label=Required String Validator Field
name=requiredStringValidatorField /

place the returned field error string into s:fielderror with param specified
as the name of the validator item described here
h3Field Error due to 'Required String Validator Field' Will Appear
Here/h3
s:fielderror
s:param value=%{'requiredStringValidatorField'} /
/s:fielderror
hr/

Make sense?
M--


From: Dave Newton [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Friday, February 29, 2008 9:16 AM
Subject: RE: expression validator


 --- Deepak Kumar [EMAIL PROTECTED] wrote:
  Here is very good example with running source code.
 

http://www.roseindia.net/struts/struts2/struts-2-client-side-validation-exam
ple.shtml

 Hmm, that doesn't seem to do client-side expression validation either,
unless
 I missed it. Perhaps you can point it out.

 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: good tutorial recommendation

2008-02-29 Thread Dave Newton
--- [EMAIL PROTECTED] wrote:
 disclaimer :
 Don Brown, Chad Davis and I have an affiliation with this manuscript.
 
 How's that David?

That's awesome, Stanley.

Dave


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



Re: Invoking action method from javascript

2008-02-29 Thread Richard Sayre
you can say, document.location.href = 's:url
action=myRemoveAction?myId=' + myId;

This will cause the whole page to refresh, so you should probably have
a prepare method if you have any data that needs to be populated on
that page (ie your table).

I personally would use Ajax to make the call, having a full page
refresh on each click could be annoying to the user.

Rich



On Fri, Feb 29, 2008 at 11:01 AM, Paranoid_Fabio
[EMAIL PROTECTED] wrote:

  Hello. I've an action that populates a table with some info. In each row,
  there's a button to delete the entry and the associated object from the DB.
  In my action class I've a list (something like a queue) of the ID that will
  be removed after the user clicks on the apply button.
  So, all I want to do, is to add each element ID the user selects to the
  remove-queue. When the user clicks on the remove icon, a javascript
  function is called:

  the jsp snippet:

  td ') 
  ../pages/Images/edit_remove.png /img
  /td

  the script inside the JSP.

  script type=text/javascript
  function addToRemoveList(id){

  }
  /script

  The script is correctly invoked and the paramater ID is correctly passed.
  Now i would like to call a method of my action class and to refresh the
  page. Something like:

  script type=text/javascript
  function addToRemoveList(id){

 myCurrentAction.addItemToRemove(id)


  }
  /script

  is it possible? thank you very much


  --
  View this message in context: 
 http://www.nabble.com/Invoking-action-method-from-javascript-tp15759459p15759459.html
  Sent from the Struts - User mailing list archive at Nabble.com.


  -
  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: expression validator

2008-02-29 Thread mojoRising

Thanks. But I still don't understand...According to the link you mentioned it
is not possible to do what I was trying to. So, what is the point of this
validator if it doesn't do client side validation? And, are you saying that
it is not possible to do a simple 'equals' test in client side validation? 

 validator type=expressionpassword.equals(password2)
messagePasswords do not match/message 
   /validator 





That validator doesn't do client side validation.

Only the following validators are supported:

* required validator
* requiredstring validator
* stringlength validator
* regex validator
* email validator
* url validator
* int validator
* double validator

http://struts.apache.org/2.0.11/docs/pure-javascript-client-side-validation.
html

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
-- 
View this message in context: 
http://www.nabble.com/expression-validator-tp15746472p15760197.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: expression validator

2008-02-29 Thread Dave Newton
--- Martin Gainty [EMAIL PROTECTED] wrote:
 [...]

AFAICT this doesn't do client-side expression validation either. See, there
is no client-side expression validation. My comment was directed at the Roes
Indai person who implied that their tutorial would help the person with the
original question, because it doesn't address the question at all.

 declare the field validator such as the field-name declared in validators
 in

FieldValidatorsExampleAction-submitClientSideValidationExample-validation.xm
 l
 validators
   field name=requiredStringValidatorField
 field-validator type=requiredstring
   param name=trimtrue/param
 message key=i18n.nothing.here![CDATA[ required and must be
 string ]]/message
 /field-validator
   /field
 
 in the jsp setup a textfield which uses the preconfigured
 requiredStringValidatorField as described in this example from
 /validation/clientSideValidationExample.jsp
s:textfield label=Required String Validator Field
 name=requiredStringValidatorField /
 
 place the returned field error string into s:fielderror with param
 specified
 as the name of the validator item described here
 h3Field Error due to 'Required String Validator Field' Will
 Appear
 Here/h3
 s:fielderror
 s:param value=%{'requiredStringValidatorField'} /
 /s:fielderror
 hr/
 
 Make sense?

Dave



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



Re: Invoking action method from javascript

2008-02-29 Thread Paranoid_Fabio

Thank you. In fact I don't have a removeAction, but only a removeMethod() in
the same action that display and populate the list. Because I don't want to
remove the element from the DB on click, I only want to add the clicked ID
to a remove queue. Then all the remove queue will be processed by a
removeAction when the user confirms the changes. So image a table with rows
and a delete icon for each row. When the user clicks the delete icon of
a row, the ID of the row must be pushed into the queue (a property of my
action) and the row should change color.
I don't want to invoke a removeAction for every click...but I think it's the
only way..isn't it?

I also thought about a solution like: 

keep the queue in the session and user a removeAction for each click that
simply add the ID to the queue in the session, and invoke again the
ListAction that populates and list the table...and so on.
In this case I could use s:div with target to refresh only the table.




Paranoid_Fabio wrote:
 
 Hello. I've an action that populates a table with some info. In each row,
 there's a button to delete the entry and the associated object from the
 DB.
 In my action class I've a list (something like a queue) of the ID that
 will be removed after the user clicks on the apply button.
 So, all I want to do, is to add each element ID the user selects to the
 remove-queue. When the user clicks on the remove icon, a javascript
 function is called:
 
 the jsp snippet:
 
 td ') 
../pages/Images/edit_remove.png /img
  /td
 
 the script inside the JSP.
 
 script type=text/javascript
function addToRemoveList(id){
   
}
 /script
 
 The script is correctly invoked and the paramater ID is correctly passed.
 Now i would like to call a method of my action class and to refresh the
 page. Something like:
 
 script type=text/javascript
function addToRemoveList(id){
 
   myCurrentAction.addItemToRemove(id)
 
 
}
 /script
 
 is it possible? thank you very much
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Invoking-action-method-from-javascript-tp15759459p15760910.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: expression validator

2008-02-29 Thread Randy Burgess
One of the things I love about Struts is that you get validation without
writing any real validation code. Admittedly it would be nice if you got
client side validation for expressions. As you know you can create a custom
validator and for the client side stuff you would have to edit
form-close-validate.ftl in the xhtml template. String matching javascript is
trivial to write.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



 From: mojoRising [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Date: Fri, 29 Feb 2008 06:55:51 -0800 (PST)
 To: user@struts.apache.org
 Subject: Re: expression validator
 
 
 Thanks. But I still don't understand...According to the link you mentioned it
 is not possible to do what I was trying to. So, what is the point of this
 validator if it doesn't do client side validation? And, are you saying that
 it is not possible to do a simple 'equals' test in client side validation?
 
  validator type=expressionpassword.equals(password2)
 messagePasswords do not match/message
/validator 
 
 
 
 
 
 That validator doesn't do client side validation.
 
 Only the following validators are supported:
 
 * required validator
 * requiredstring validator
 * stringlength validator
 * regex validator
 * email validator
 * url validator
 * int validator
 * double validator
 
 http://struts.apache.org/2.0.11/docs/pure-javascript-client-side-validation.
 html
 
 Regards,
 Randy Burgess
 Sr. Web Applications Developer
 Nuvox Communications
 -- 
 View this message in context:
 http://www.nabble.com/expression-validator-tp15746472p15760197.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 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]



Re: expression validator

2008-02-29 Thread Nuwan Chandrasoma

Hi,

yes. this is what i did for one of the project i am bit involved.

1. wrote a custom validator

public class PasswordConfirmValidator extends FieldValidatorSupport {

private static Log log = 
LogFactory.getLog(PasswordConfirmValidator.class);


   private String fieldName2;

   public String getFieldName2() {
   return fieldName2;
   }

   public void setFieldName2(String fieldName2) {
   this.fieldName2 = fieldName2;
   }



   public void validate(Object o) throws ValidationException {

   String fieldName = getFieldName();
   String val = (String) getFieldValue(fieldName, o);


   String val2 = (String)getFieldValue(fieldName2,o);


   if (!val.equals(val2)) {
  addFieldError(fieldName, o);
   }

   }
}




2. configured the the customer validator in validators.xml

validator name=passwordconfirm 
class=com.xxx.util.validation.PasswordConfirmValidator/



3. add a custom javascript in the form-close-validate.ftl

   #elseif validator.validatorType = passwordconfirm
   if (field.value != null) {
   var value =  field.value;
   var field2 = form.elements['${validator.fieldName2}'];
   var value2 = field2.value;

   if (value!=value2) {
   addError(field, error);
   errors = true;
   }
   }
4. add a annotation for the field i need to validate.

@CustomValidator(type=passwordconfirm,message = Confirm password 
should be same as password.,parameters = { @ValidationParameter( name = 
fieldName2, value = password ) })


Thanks,

Nuwan


Randy Burgess wrote:

One of the things I love about Struts is that you get validation without
writing any real validation code. Admittedly it would be nice if you got
client side validation for expressions. As you know you can create a custom
validator and for the client side stuff you would have to edit
form-close-validate.ftl in the xhtml template. String matching javascript is
trivial to write.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



  

From: mojoRising [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List user@struts.apache.org
Date: Fri, 29 Feb 2008 06:55:51 -0800 (PST)
To: user@struts.apache.org
Subject: Re: expression validator


Thanks. But I still don't understand...According to the link you mentioned it
is not possible to do what I was trying to. So, what is the point of this
validator if it doesn't do client side validation? And, are you saying that
it is not possible to do a simple 'equals' test in client side validation?

 validator type=expressionpassword.equals(password2)
messagePasswords do not match/message
   /validator 






That validator doesn't do client side validation.

Only the following validators are supported:

* required validator
* requiredstring validator
* stringlength validator
* regex validator
* email validator
* url validator
* int validator
* double validator

http://struts.apache.org/2.0.11/docs/pure-javascript-client-side-validation.
html

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
--
View this message in context:
http://www.nabble.com/expression-validator-tp15746472p15760197.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
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]



Re: Actions without extending ActionSupport?

2008-02-29 Thread nobody


Dave Newton wrote:
 in some ways I like being coupled to static methods even less because it's
 not injectable.

Not true. FacesContext is injectable with if you use Seam, Spring IoC, or
Guice. Perhaps the native IoC container in JSF will provide this
injectability natively in JSF 2.0.


Jeromy Evans - Blue Sky Minds wrote:
 Agreed. Using a static method call is NOT a form of decoupling from the
 framework. In fact, it's less desirable than an interface because its
 harder to 
 test and override.

They are degrees of coupling. JSF's sue of a static method call results in
much less framework coupling than, say, inheriting a base class as Struts2
would have you do. This is because the static method call can be mocked
quite easily whereas Struts2 base classes (and whatever they depend on) not
nearly as easily. 

I agree that the ultimate decoupling is simple interfaces, and this is
precisely what JSF and Spring-MVC use. Both also use static method calls to
obtain framework services. Struts2 does not. Instead, Struts2 forces you to
either use its base classes or, if you choose to use its interfaces, rewrite
a lot of plumbing that you shouldn't have to rewrite.

As has been pointed out in other threads, suffers from the Fragile Base
Class anti-pattern (http://en.wikipedia.org/wiki/Fragile_base_class). I
don't think anyone would claim JSF and Spring-MVC suffer from this problem,
and although they do have problems of their own, they're not necessarily
fundamental design issues like with Struts2.

-- 
View this message in context: 
http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15762345.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



[OT] Re: Actions without extending ActionSupport?

2008-02-29 Thread Dave Newton
Ah, I get it now. How many email addresses do you have, anyway?

I'm definitely too easy to troll.

--- nobody [EMAIL PROTECTED] wrote:

 
 
 Dave Newton wrote:
  in some ways I like being coupled to static methods even less because
 it's
  not injectable.
 
 Not true. FacesContext is injectable with if you use Seam, Spring IoC, or
 Guice. Perhaps the native IoC container in JSF will provide this
 injectability natively in JSF 2.0.
 
 
 Jeromy Evans - Blue Sky Minds wrote:
  Agreed. Using a static method call is NOT a form of decoupling from the
  framework. In fact, it's less desirable than an interface because its
  harder to 
  test and override.
 
 They are degrees of coupling. JSF's sue of a static method call results in
 much less framework coupling than, say, inheriting a base class as Struts2
 would have you do. This is because the static method call can be mocked
 quite easily whereas Struts2 base classes (and whatever they depend on) not
 nearly as easily. 
 
 I agree that the ultimate decoupling is simple interfaces, and this is
 precisely what JSF and Spring-MVC use. Both also use static method calls to
 obtain framework services. Struts2 does not. Instead, Struts2 forces you to
 either use its base classes or, if you choose to use its interfaces,
 rewrite
 a lot of plumbing that you shouldn't have to rewrite.
 
 As has been pointed out in other threads, suffers from the Fragile Base
 Class anti-pattern (http://en.wikipedia.org/wiki/Fragile_base_class). I
 don't think anyone would claim JSF and Spring-MVC suffer from this problem,
 and although they do have problems of their own, they're not necessarily
 fundamental design issues like with Struts2.
 
 -- 
 View this message in context:

http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15762345.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 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: action security

2008-02-29 Thread Brian Relph
I was able to use the ParameterNameAware interface after all ... I needed to
rebuild my project, it wasn't updating in my workspace for some reason.

I have also created a new AnnontationParameterInterceptor, along with a
class-level annontation and a field-level annontation.  As of now, the
annotations just store a boolean value of whether to allow the field to be
set, and for the class, what the default policy is for object's fields.

Would anyone be interested in this code?  Would some of this go in the xwork
distribution?  I would like to add regular expression support to the
class-level annontation, but other than that, I prefer the annotations over
the interface/method.

On Thu, Feb 28, 2008 at 3:28 PM, Dave Newton [EMAIL PROTECTED] wrote:

 --- Laurie Harper [EMAIL PROTECTED] wrote:
  That would require a getMailSender() on the action, wouldn't it? I'd
  strongly suggest not having getters for 'sensitive' internals like that

 It's pretty typical to have a service injected like that, though. The
 issue
 here is that a sensitive configuration parameter is being trivially
 exposed
 via a Spring-settable property.

   --- Brian Relph [EMAIL PROTECTED] wrote:
   So i guess this is a legitimate security concern.  Is there a
   cleaner way to do this?  Is there annotations support for it?
   Not that I'm aware of.

 Have you solved your ParameterNameAware problem?

 I can't reproduce it; if I have a Spring-injected class (my test uses
 'testService') with a property and my 'acceptableParameterName' method
 returns 'false' for parameters starting with the name of the service's
 parameter it's not being set.

 In other words, if the parameter name 'startsWith(testService)' I return
 false, the parameter in the service isn't being set on a request
 containing
 something like 'testService.senderName'.

 Dave


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




-- 
Brian


Re: Actions without extending ActionSupport?

2008-02-29 Thread stanlick
Hey nobody dude --

If S2 is not for you, why do you spend so much time here?

On Fri, Feb 29, 2008 at 10:37 AM, nobody [EMAIL PROTECTED] wrote:



 Dave Newton wrote:
  in some ways I like being coupled to static methods even less because
 it's
  not injectable.

 Not true. FacesContext is injectable with if you use Seam, Spring IoC, or
 Guice. Perhaps the native IoC container in JSF will provide this
 injectability natively in JSF 2.0.


 Jeromy Evans - Blue Sky Minds wrote:
  Agreed. Using a static method call is NOT a form of decoupling from the
  framework. In fact, it's less desirable than an interface because its
  harder to
  test and override.

 They are degrees of coupling. JSF's sue of a static method call results in
 much less framework coupling than, say, inheriting a base class as Struts2
 would have you do. This is because the static method call can be mocked
 quite easily whereas Struts2 base classes (and whatever they depend on)
 not
 nearly as easily.

 I agree that the ultimate decoupling is simple interfaces, and this is
 precisely what JSF and Spring-MVC use. Both also use static method calls
 to
 obtain framework services. Struts2 does not. Instead, Struts2 forces you
 to
 either use its base classes or, if you choose to use its interfaces,
 rewrite
 a lot of plumbing that you shouldn't have to rewrite.

 As has been pointed out in other threads, suffers from the Fragile Base
 Class anti-pattern (http://en.wikipedia.org/wiki/Fragile_base_class). I
 don't think anyone would claim JSF and Spring-MVC suffer from this
 problem,
 and although they do have problems of their own, they're not necessarily
 fundamental design issues like with Struts2.

 --
 View this message in context:
 http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15762345.html
 Sent from the Struts - User mailing list archive at Nabble.com.


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




-- 
Scott
[EMAIL PROTECTED]


Re: [OT] Re: Actions without extending ActionSupport?

2008-02-29 Thread nobody


newton.dave wrote:
 
 Ah, I get it now. How many email addresses do you have, anyway?
 
 I'm definitely too easy to troll.
 

I am very sorry I was rude and used a BugMeNot user on Nabble to continue to
spam the struts-user mailing list. It shows a lack of class and I will stop
using this and other anonymous users and will be a man from now on.

Oh, snap.
-- 
View this message in context: 
http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15762889.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [OT] Re: Actions without extending ActionSupport?

2008-02-29 Thread stanlick
Hey Dave --

How many more times do you want to answer the POJO/ActionSupport
question?  I have recently finished writing a nifty little S2/Db4o web
application that allows for quiz taking on your favorite subjects.  It
randomizes questions, maintains global statistics [so you can quickly see
how you rank against everyone else] and will soon have support for tutoring
the user on questions missed.  I have seen many quiz apps that will
calculate correct/missed totals and then kick you out the door, but this one
is different.  Would you be willing to help me seed it with your top ten
puzzlers from this list?  I will have it hosted with several sample
questions this afternoon but I would ultimately like to load it up for
developers who want to learn the Struts 2 framework and have fun doing it!

Scott

On Fri, Feb 29, 2008 at 10:47 AM, Dave Newton [EMAIL PROTECTED] wrote:

 Ah, I get it now. How many email addresses do you have, anyway?

 I'm definitely too easy to troll.

 --- nobody [EMAIL PROTECTED] wrote:

 
 
  Dave Newton wrote:
   in some ways I like being coupled to static methods even less because
  it's
   not injectable.
 
  Not true. FacesContext is injectable with if you use Seam, Spring IoC,
 or
  Guice. Perhaps the native IoC container in JSF will provide this
  injectability natively in JSF 2.0.
 
 
  Jeromy Evans - Blue Sky Minds wrote:
   Agreed. Using a static method call is NOT a form of decoupling from
 the
   framework. In fact, it's less desirable than an interface because its
   harder to
   test and override.
 
  They are degrees of coupling. JSF's sue of a static method call results
 in
  much less framework coupling than, say, inheriting a base class as
 Struts2
  would have you do. This is because the static method call can be mocked
  quite easily whereas Struts2 base classes (and whatever they depend on)
 not
  nearly as easily.
 
  I agree that the ultimate decoupling is simple interfaces, and this is
  precisely what JSF and Spring-MVC use. Both also use static method calls
 to
  obtain framework services. Struts2 does not. Instead, Struts2 forces you
 to
  either use its base classes or, if you choose to use its interfaces,
  rewrite
  a lot of plumbing that you shouldn't have to rewrite.
 
  As has been pointed out in other threads, suffers from the Fragile Base
  Class anti-pattern (http://en.wikipedia.org/wiki/Fragile_base_class). I
  don't think anyone would claim JSF and Spring-MVC suffer from this
 problem,
  and although they do have problems of their own, they're not necessarily
  fundamental design issues like with Struts2.
 
  --
  View this message in context:
 

 http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15762345.html
  Sent from the Struts - User mailing list archive at Nabble.com.
 
 
  -
  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]




-- 
Scott
[EMAIL PROTECTED]


Re: action security

2008-02-29 Thread Dave Newton
--- Brian Relph [EMAIL PROTECTED] wrote:
 I have also created a new AnnontationParameterInterceptor, along with a
 class-level annontation and a field-level annontation.  As of now, the
 annotations just store a boolean value of whether to allow the field to be
 set, and for the class, what the default policy is for object's fields.
 
 Would anyone be interested in this code?  Would some of this go in the
 xwork distribution?  I would like to add regular expression support to the
 class-level annontation, but other than that, I prefer the annotations over
 the interface/method.

Your best bet would be to file a request-for-enhancement JIRA against XWork
and include the patch; I think any additional annotation support would be
welcomed and it would just be a matter of testing the patch etc. and
committing.

Dave


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



Re: [OT] Re: Actions without extending ActionSupport?

2008-02-29 Thread Dave Newton
--- [EMAIL PROTECTED] wrote:
 How many more times do you want to answer 
 the POJO/ActionSupport question?

A million; how could I possibly get tired of such fun?

 Would you be willing to help me seed it with your top ten
 puzzlers from this list?

Sounds pretty cool--I'd put out a general call for FAQ-oriented stuff (heck,
some of the FAQ entries from the wiki probably qualify, like how do I access
the request in my action? and the like). 

Off the top of my head I'd include (most of which you probably already have):

- Access to the HTTP stuff.
- Can it really be a POJO?
- Why does my form keep emitting table elements?
- I added an lt;interceptor-ref.../gt; to my action's XML config and now
nothing works.
- Single-quoted, single-char in OGNL is a char, not string.
- Something about the lt;s:url.../gt; params incluson/exclusion.

That's all I can think of at the moment without doing some list analysis or
checking the wiki.

Dave


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



Re: [OT] Re: Actions without extending ActionSupport?

2008-02-29 Thread stanlick
Thanks bro.  I'll hit it after I make a QDoba run.

On Fri, Feb 29, 2008 at 11:57 AM, Dave Newton [EMAIL PROTECTED] wrote:

 --- [EMAIL PROTECTED] wrote:
  How many more times do you want to answer
  the POJO/ActionSupport question?

 A million; how could I possibly get tired of such fun?

  Would you be willing to help me seed it with your top ten
  puzzlers from this list?

 Sounds pretty cool--I'd put out a general call for FAQ-oriented stuff
 (heck,
 some of the FAQ entries from the wiki probably qualify, like how do I
 access
 the request in my action? and the like).

 Off the top of my head I'd include (most of which you probably already
 have):

 - Access to the HTTP stuff.
 - Can it really be a POJO?
 - Why does my form keep emitting table elements?
 - I added an interceptor-ref.../ to my action's XML config and now
 nothing works.
 - Single-quoted, single-char in OGNL is a char, not string.
 - Something about the s:url.../ params incluson/exclusion.

 That's all I can think of at the moment without doing some list analysis
 or
 checking the wiki.

 Dave


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




-- 
Scott
[EMAIL PROTECTED]


Re: [OT] Re: Actions without extending ActionSupport?

2008-02-29 Thread Clown Boots


newton.dave wrote:
 Ah, I get it now. How many email addresses do you have, anyway?

My arguments stand whether or not I use the same email address. I don't like
registrations so I try to use bugmenot.com for things like that. The name
attached to my post has nothing to do with the legitimacy of my statements,
and I hope we can continue this dialog. I am not trying to waste your time
or troll you. I am trying to engage meaning debate with the purpose of
(hopefully) improving Struts2.


stanlick wrote:
 I have recently finished writing a nifty little S2/Db4o web application
 that allows for quiz taking on your favorite subjects

Are you hijacking this thread with your topic? I don't see the relevance.
-- 
View this message in context: 
http://www.nabble.com/Actions-without-extending-ActionSupport--tp15591064p15764476.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Struts1 forms with empty Strings

2008-02-29 Thread Andy
Hi,
I was wondering if there is a way to configure Struts1 so Form beans return 
null values instead of empty String values when a user does not enter data in a 
text field, for example.  The problem is that Hibernate then saves empty 
Strings to the database instead of nulls.  I would like to configure something 
globally if possible.  
Thanks.. Andy

 
_
Helping your favorite cause is as easy as instant messaging. You IM, we give.
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join

Re: Struts1 forms with empty Strings

2008-02-29 Thread Dave Newton
--- Andy [EMAIL PROTECTED] wrote:
 I was wondering if there is a way to configure Struts1 so Form beans return
 null values instead of empty String values when a user does not enter data
 in a text field, for example.  The problem is that Hibernate then saves
 empty Strings to the database instead of nulls.  I would like to configure
 something globally if possible.  

I don't know if this is possible without writing some code, like a request
processor; hopefully somebody else knows more. The issue is that a text field
on a form returns an empty string, not null: that's an HTTP thing, not Struts
specifically.

You could also configure Hibernate data types that convert an empty string in
to null and handle the problem on the Hibernate side; if you're using the
Hibernate code anywhere else it might be more useful to do it that way, but
it's borderline magic and might be confusing down the road.

Dave


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



RE: Looping in Struts2

2008-02-29 Thread Jaarthy

Already tried out,but could not find a solution.that's why posted here...
Any help would be appreciated.

Aarthy

newton.dave wrote:
 
 --- Jaarthy [EMAIL PROTECTED] wrote:
 Can we pass dynamic values to the begin and end in c:forEach tag?
 
 Sure. Might have been quicker to just try it.
 
 Dave
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Looping-in-Struts2-tp15641866p15765119.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Dead code parser/finder for Struts

2008-02-29 Thread Adam Gordon
Does anyone know if there's a server side library that can parse JSP 
pages (or the generated Java file) and look for dead Struts code?


We subbed out a project and recently took back control of the code due 
to various issues one of which was very poor code quality.  Looking 
through their JSP pages, we see bean:define tags everywhere for certain 
properties on the ActionForm bean in question.  It is my understanding 
that this tag is used to define objects that can then be used lower in 
the JSP page via EL.  There may be other features with this tag, but I 
believe this is the only use in their code.


The problem is that we believe that they are abusing these tags and half 
of the ones that litter the code aren't even actually used and wanted 
some way to verify this without removing them and then running the 
webapp to see what breaks.


Thanks,

--adam

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



RE: Looping in Struts2

2008-02-29 Thread Dave Newton
--- Jaarthy [EMAIL PROTECTED] wrote:
 Already tried out,but could not find a solution.that's why posted here...
 Any help would be appreciated.

Okay, well. Not too much to go on.

What specific problem are you having? What have you tried? Post a snippet.
Post some code. The S2 request wrapper allows the use of value stack
parameters inside standard JSP EL. It's easier to help when some sort of
information is provided [1].

Dave

[1] http://catb.org/~esr/faqs/smart-questions.html

 newton.dave wrote:
  
  --- Jaarthy [EMAIL PROTECTED] wrote:
  Can we pass dynamic values to the begin and end in c:forEach tag?
  
  Sure. Might have been quicker to just try it.
  
  Dave
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
 
 -- 
 View this message in context:
 http://www.nabble.com/Looping-in-Struts2-tp15641866p15765119.html
 Sent from the Struts - User mailing list archive at Nabble.com.
 
 
 -
 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]



[OT] Re: Dead code parser/finder for Struts

2008-02-29 Thread Dave Newton
--- Adam Gordon [EMAIL PROTECTED] wrote:
 Does anyone know if there's a server side library that can parse JSP 
 pages (or the generated Java file) and look for dead Struts code?

Any of the typical code walkers should be able to deal with the generated
JSP, but it probably wouldn't be capable of identifying situations where
something was put into scope and referenced by name later.

I don't know of any JSP-source walkers with this capability. That said, it
shouldn't be *that* hard (depending on how well-formed the JSP/HTML is,
perhaps?) to write an ad-hoc tool that tracks whatever types of tag usages
you're concerned about and later references (or lack thereof) to the same.

HTHBIPD,
Dave


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



Re: [OT] Re: Dead code parser/finder for Struts

2008-02-29 Thread Adam Gordon

Dave-

Dude, it's bad.  They had a team of developers each with varying degrees 
of experience which ranged from no knowledge of Struts/EL (those 
developers used.scriptlets.*shudder*) while others used 
Struts/JSTL tags for almost everything when EL tags would not only have 
sufficed but made the code cleaner and easier to read.  I recognize that 
there's some duplicity across the Struts tag library and JSTL, but it's 
like they found one way to do something and just ran with it, even if it 
meant it wasn't appropriate to use in a given instance.  It got so bad 
at the end, when a bug was filed to fix a validation problem in a form, 
they just removed the alert box that said there was an error and checked 
it in as the fix.


I know they used MyEclipse and based on the indention (or lack thereof) 
in the JSP's I suspect they were at least partially computer generated 
with some type of GUI builder because there's no way someone could write 
JSPs like that by hand and not go mad.


I recognize that there's some duplicity across the Struts tag library 
and JSTL, but it's like they found one way to do something and just ran 
with it, even if it meant it wasn't appropriate to use in a given instance.


--adam

Dave Newton wrote:

--- Adam Gordon [EMAIL PROTECTED] wrote:
  
Does anyone know if there's a server side library that can parse JSP 
pages (or the generated Java file) and look for dead Struts code?



Any of the typical code walkers should be able to deal with the generated
JSP, but it probably wouldn't be capable of identifying situations where
something was put into scope and referenced by name later.

I don't know of any JSP-source walkers with this capability. That said, it
shouldn't be *that* hard (depending on how well-formed the JSP/HTML is,
perhaps?) to write an ad-hoc tool that tracks whatever types of tag usages
you're concerned about and later references (or lack thereof) to the same.

HTHBIPD,
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: [OT] Re: Dead code parser/finder for Struts

2008-02-29 Thread Manos Batsis

Dave Newton wrote:

shouldn't be *that* hard (depending on how well-formed the JSP/HTML is,
perhaps?) 


Bingo. We use the XML JSP syntax and have done similar tasks in the past 
using XSLT or even SAX filters.


I've never encountered XML syntax users outside my company though.

Manos

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



Re: [OT] Re: Dead code parser/finder for Struts

2008-02-29 Thread Dave Newton
--- Adam Gordon [EMAIL PROTECTED] wrote:
 Dude, it's bad.

I feel your pain.

In fact, I revel in it ;)

It's pretty hard to mechanically find problems in JSP-space, though, and I
personally don't know of any generic tools that allow it (if you do find any,
please follow up!) My approach would depend on how many files there are
(well, maybe how many lines/syntactic elements) and if it was easy to
identify the various classes of problems.

You may get the joyous task of walking them by hand (perhaps writing
client-side tests as you go via Selenium, Watir, ec.) if the original
developers didn't provide any to help verify requirements compliance.

Dave



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



Re: Struts1 forms with empty Strings

2008-02-29 Thread Martin Gainty
//easiest solution would be to set all the attribute default values to null
e.g.
public class TestFormBean extends ActionForm
{
private String   stringProperty=null;
private Object[] arrayProperty=null;

public  String   getStringProperty()
   {
 return (stringProperty);
}
public  void   setStringProperty(String stringProperty)
{
  this.stringProperty = stringProperty;
}

public  Object[] getArrayProperty()
   {
 return (arrayProperty);
}
public  void setArrayProperty(Object[] arrayProperty)
{
  this.arrayProperty = arrayProperty;
}
}

Anyone else?
M-
- Original Message -
From: Andy [EMAIL PROTECTED]
To: user@struts.apache.org
Sent: Friday, February 29, 2008 1:58 PM
Subject: Struts1 forms with empty Strings


Hi,
I was wondering if there is a way to configure Struts1 so Form beans return
null values instead of empty String values when a user does not enter data
in a text field, for example.  The problem is that Hibernate then saves
empty Strings to the database instead of nulls.  I would like to configure
something globally if possible.
Thanks.. Andy


_
Helping your favorite cause is as easy as instant messaging. You IM, we
give.
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join


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



Re: Struts1 forms with empty Strings

2008-02-29 Thread Dave Newton
--- Martin Gainty [EMAIL PROTECTED] wrote:
 //easiest solution would be to set all the attribute default values to null

Isn't that the default value for a String field? [1]

Does this prevent and empty value from the HTML form being set on the
ActionForm?

Dave

[1] http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html

 e.g.
 public class TestFormBean extends ActionForm
 {
 private String   stringProperty=null;
 private Object[] arrayProperty=null;
 
 public  String   getStringProperty()
{
  return (stringProperty);
 }
 public  void   setStringProperty(String stringProperty)
 {
   this.stringProperty = stringProperty;
 }
 
 public  Object[] getArrayProperty()
{
  return (arrayProperty);
 }
 public  void setArrayProperty(Object[] arrayProperty)
 {
   this.arrayProperty = arrayProperty;
 }
 }
 
 - Original Message -
 From: Andy [EMAIL PROTECTED]
 
 I was wondering if there is a way to configure Struts1 so Form beans return
 null values instead of empty String values when a user does not enter data
 in a text field, for example.  The problem is that Hibernate then saves
 empty Strings to the database instead of nulls.  I would like to configure
 something globally if possible.


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



Re: Struts1 forms with empty Strings

2008-02-29 Thread Randy Burgess
Since Strings are immutable you get a new String whenever an operation is
performed on said String, so that seems to me that you would still get the
empty string.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



 From: Dave Newton [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List user@struts.apache.org
 Date: Fri, 29 Feb 2008 12:53:36 -0800 (PST)
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: Struts1 forms with empty Strings
 
 --- Martin Gainty [EMAIL PROTECTED] wrote:
 //easiest solution would be to set all the attribute default values to null
 
 Isn't that the default value for a String field? [1]
 
 Does this prevent and empty value from the HTML form being set on the
 ActionForm?
 
 Dave
 
 [1] http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html
 
 e.g.
 public class TestFormBean extends ActionForm
 {
 private String   stringProperty=null;
 private Object[] arrayProperty=null;
 
 public  String   getStringProperty()
{
  return (stringProperty);
 }
 public  void   setStringProperty(String stringProperty)
 {
   this.stringProperty = stringProperty;
 }
 
 public  Object[] getArrayProperty()
{
  return (arrayProperty);
 }
 public  void setArrayProperty(Object[] arrayProperty)
 {
   this.arrayProperty = arrayProperty;
 }
 }
 
 - Original Message -
 From: Andy [EMAIL PROTECTED]
 
 I was wondering if there is a way to configure Struts1 so Form beans return
 null values instead of empty String values when a user does not enter data
 in a text field, for example.  The problem is that Hibernate then saves
 empty Strings to the database instead of nulls.  I would like to configure
 something globally if possible.
 
 
 -
 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]



Struts2 vs JSF

2008-02-29 Thread Frans Thamura
hi there

i am a webwork user, and now because WW become S2, so i am part of this
community, and honestly i am blank of S1 :)

and i got Matt's comparison here, and i think that will be awesome if we can
share it here.

I found that like it or not, JSF have a lot of promotion esp from Sun and
Oracle and RedHat/JBoss

they bet very big in JSF, and we know S2 is a different tech with S1, and we
see that most of the IDE not support S2, which we can find in S1 world, all
IDE = S1 IDE.


Several of fellow of Java here, try to move to JSF, and object S2, esp
because IDE integration.


anyone have idea of this JSF vs Struts2 discussion?


i have around 5-6 project and power of S2, under our opensource umbrella and
in several client, and we glad S2 is easy to learn, but i dont have a lot of
believe to compete with, i feel a small community in Java Web world.

can help guys? give me the believe.

Frans


Re: Struts2 vs JSF

2008-02-29 Thread Nils-Helge Garli Hegvik
There was a pretty long conversation about this earlier [1]. Maybe you
can find some useful information there.

[1] - 
http://www.nabble.com/Is-Struts-still-a-better-choice-over-JSF-as-on-today---to11801750.html

On Fri, Feb 29, 2008 at 11:00 PM, Frans Thamura [EMAIL PROTECTED] wrote:
 hi there

  i am a webwork user, and now because WW become S2, so i am part of this
  community, and honestly i am blank of S1 :)

  and i got Matt's comparison here, and i think that will be awesome if we can
  share it here.

  I found that like it or not, JSF have a lot of promotion esp from Sun and
  Oracle and RedHat/JBoss

  they bet very big in JSF, and we know S2 is a different tech with S1, and we
  see that most of the IDE not support S2, which we can find in S1 world, all
  IDE = S1 IDE.


  Several of fellow of Java here, try to move to JSF, and object S2, esp
  because IDE integration.


  anyone have idea of this JSF vs Struts2 discussion?


  i have around 5-6 project and power of S2, under our opensource umbrella and
  in several client, and we glad S2 is easy to learn, but i dont have a lot of
  believe to compete with, i feel a small community in Java Web world.

  can help guys? give me the believe.

  Frans


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



[friday] Re: Struts2 vs JSF

2008-02-29 Thread Musachy Barroso
Search for Snatch fight in youtube, and you will get a felling of
what Struts 2 would do to JSF in a fight :)

musachy

On Fri, Feb 29, 2008 at 5:00 PM, Frans Thamura [EMAIL PROTECTED] wrote:
 hi there

  i am a webwork user, and now because WW become S2, so i am part of this
  community, and honestly i am blank of S1 :)

  and i got Matt's comparison here, and i think that will be awesome if we can
  share it here.

  I found that like it or not, JSF have a lot of promotion esp from Sun and
  Oracle and RedHat/JBoss

  they bet very big in JSF, and we know S2 is a different tech with S1, and we
  see that most of the IDE not support S2, which we can find in S1 world, all
  IDE = S1 IDE.


  Several of fellow of Java here, try to move to JSF, and object S2, esp
  because IDE integration.


  anyone have idea of this JSF vs Struts2 discussion?


  i have around 5-6 project and power of S2, under our opensource umbrella and
  in several client, and we glad S2 is easy to learn, but i dont have a lot of
  believe to compete with, i feel a small community in Java Web world.

  can help guys? give me the believe.

  Frans




-- 
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: [friday] Re: Struts2 vs JSF

2008-02-29 Thread Frans Thamura
On Sat, Mar 1, 2008 at 5:12 AM, Musachy Barroso [EMAIL PROTECTED] wrote:

 Search for Snatch fight in youtube, and you will get a felling of
 what Struts 2 would do to JSF in a fight :)



cannot get it


Re: [friday] Re: Struts2 vs JSF

2008-02-29 Thread Dave Newton
--- Musachy Barroso [EMAIL PROTECTED] wrote:
 Search for Snatch fight in youtube, and you will get a felling of
 what Struts 2 would do to JSF in a fight :)

I was *really* scared to see what that would bring up (snatch, in the US,
is a somewhat derogatory term for... uh... female parts).

Turns out it was just a scene from the movie Snatch, so it was all okay.

Dave


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



Re: [friday] Re: Struts2 vs JSF

2008-02-29 Thread Ray Clough
I have quite a lot of experience with S2 and JSF which I'd like to share.  
Although on many levels the technologies are different, we have managed to make 
them work together with profound benefits to each.  

First a caveat:  our use of JSF as served from S2 is in a limited fashion.  
There are things we haven't tried because we haven't needed them.  There may be 
things which wouldn't work with this technique.  Our use is primarily as a 
reporting engine.  We use S2 to manage all the 'control' functions of the MVC 
cycle.  There are no beans or navigation rules in the faces-config file.  We 
have produced a clear separation of the Model functionality from the Struts 
functions, with Struts merely retrieving the model objects and placing them 
into Session storage.  Then the model objects are queried from a JSP page, 
which causes the model to 'export' itself to JSF components.  The model 
components have zero getters/setters, except a method 'getData()' which 
triggers the export process, and returns a jsf 'UIComponent'.  The export 
process consists of creating the JSF 'UIComponent' in code, very similarly to 
the way you'd make pages in Swing (assuming that you are not using a totally 
lame graphic page generator).  Then the completed component is rendered by a 
single jsf tag on the page.  Any submittals, which in JSF are to some funky 
url, are redirected by javascript to the correct S2 url.  This was the main 
problem until we figured out how to fix it.

When I started designing the app I envisioned using standard JSP functionality 
to produce the pages, including the use of the S2 tags.  However I really hated 
the S2 tags (I still believe that they are somewhat below horrible in the 
panoply of functionality).  A co-worker suggested working around this with JSF, 
and as a result the app is much stronger than I ever envisioned.

The app does not use the struts-jsf plugin, and also uses tiles, again not 
using the struts-tiles plugin.  We have found that the use of these plugins is 
really limiting, and we are much better off with independent installations of 
both these functions in our app.  It would be nice to have a good struts-jsf 
function, but my impression is that there is not much being done with the 
plugin lately (I could be wrong, of course).  As it works out, the 
configuration of all the services is quite demanding, but perfectly 
straightforward once you have figured things out.

In short, we have had excellent results with JSF with S2.  We use the JSF 
components from Trinidad, and they are first rate - with built in table 
sorting, paging, etc all using Ajax behind the scenes.  S2 is a superior 
'Control' component, but not really great at 'View'.  With the proper approach, 
they are perfectly compatible.  (Too bad Shale seems moribund).

- Ray Clough
[EMAIL PROTECTED]

 - Original Message -
 From: Dave Newton [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: [friday] Re: Struts2 vs JSF
 Date: Fri, 29 Feb 2008 14:24:26 -0800 (PST)
 
 
 --- Musachy Barroso [EMAIL PROTECTED] wrote:
  Search for Snatch fight in youtube, and you will get a felling of
  what Struts 2 would do to JSF in a fight :)
 
 I was *really* scared to see what that would bring up (snatch, in the US,
 is a somewhat derogatory term for... uh... female parts).
 
 Turns out it was just a scene from the movie Snatch, so it was all okay.
 
 Dave
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]





- Ray Clough
[EMAIL PROTECTED]



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



Re: [friday] Re: Struts2 vs JSF

2008-02-29 Thread Martin Gainty
interesting ...can you implement ajax functionality such as theme='ajax'
from dojo?

Martin-
- Original Message -
From: Ray Clough [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Friday, February 29, 2008 6:08 PM
Subject: Re: [friday] Re: Struts2 vs JSF


I have quite a lot of experience with S2 and JSF which I'd like to share.
Although on many levels the technologies are different, we have managed to
make them work together with profound benefits to each.

First a caveat:  our use of JSF as served from S2 is in a limited fashion.
There are things we haven't tried because we haven't needed them.  There may
be things which wouldn't work with this technique.  Our use is primarily as
a reporting engine.  We use S2 to manage all the 'control' functions of the
MVC cycle.  There are no beans or navigation rules in the faces-config file.
We have produced a clear separation of the Model functionality from the
Struts functions, with Struts merely retrieving the model objects and
placing them into Session storage.  Then the model objects are queried from
a JSP page, which causes the model to 'export' itself to JSF components.
The model components have zero getters/setters, except a method 'getData()'
which triggers the export process, and returns a jsf 'UIComponent'.  The
export process consists of creating the JSF 'UIComponent' in code, very
similarly to the way you'd make pages in Swing (assuming that you are not
using a totally lame graphic page generator).  Then the completed component
is rendered by a single jsf tag on the page.  Any submittals, which in JSF
are to some funky url, are redirected by javascript to the correct S2 url.
This was the main problem until we figured out how to fix it.

When I started designing the app I envisioned using standard JSP
functionality to produce the pages, including the use of the S2 tags.
However I really hated the S2 tags (I still believe that they are somewhat
below horrible in the panoply of functionality).  A co-worker suggested
working around this with JSF, and as a result the app is much stronger than
I ever envisioned.

The app does not use the struts-jsf plugin, and also uses tiles, again not
using the struts-tiles plugin.  We have found that the use of these plugins
is really limiting, and we are much better off with independent
installations of both these functions in our app.  It would be nice to have
a good struts-jsf function, but my impression is that there is not much
being done with the plugin lately (I could be wrong, of course).  As it
works out, the configuration of all the services is quite demanding, but
perfectly straightforward once you have figured things out.

In short, we have had excellent results with JSF with S2.  We use the JSF
components from Trinidad, and they are first rate - with built in table
sorting, paging, etc all using Ajax behind the scenes.  S2 is a superior
'Control' component, but not really great at 'View'.  With the proper
approach, they are perfectly compatible.  (Too bad Shale seems moribund).

- Ray Clough
[EMAIL PROTECTED]

 - Original Message -
 From: Dave Newton [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: [friday] Re: Struts2 vs JSF
 Date: Fri, 29 Feb 2008 14:24:26 -0800 (PST)


 --- Musachy Barroso [EMAIL PROTECTED] wrote:
  Search for Snatch fight in youtube, and you will get a felling of
  what Struts 2 would do to JSF in a fight :)

 I was *really* scared to see what that would bring up (snatch, in the
US,
 is a somewhat derogatory term for... uh... female parts).

 Turns out it was just a scene from the movie Snatch, so it was all okay.

 Dave


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





- Ray Clough
[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: [friday] Re: Struts2 vs JSF

2008-02-29 Thread Ray Clough

Yes, but only for those pages which use S2 view components.  We have some
pure S2 pages, also some pure JSF pages (but not with S2 Controller fcns),
also pure S1 pages, and all pages use Tiles.  Quite a complex deployment
descriptor, as you might imagine.

- Ray C.



mgainty wrote:
 
 interesting ...can you implement ajax functionality such as theme='ajax'
 from dojo?
 
 Martin-
 - Original Message -
 From: Ray Clough [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Sent: Friday, February 29, 2008 6:08 PM
 Subject: Re: [friday] Re: Struts2 vs JSF
 
 
 I have quite a lot of experience with S2 and JSF which I'd like to share.
 Although on many levels the technologies are different, we have managed to
 make them work together with profound benefits to each.
 
 First a caveat:  our use of JSF as served from S2 is in a limited fashion.
 There are things we haven't tried because we haven't needed them.  There
 may
 be things which wouldn't work with this technique.  Our use is primarily
 as
 a reporting engine.  We use S2 to manage all the 'control' functions of
 the
 MVC cycle.  There are no beans or navigation rules in the faces-config
 file.
 We have produced a clear separation of the Model functionality from the
 Struts functions, with Struts merely retrieving the model objects and
 placing them into Session storage.  Then the model objects are queried
 from
 a JSP page, which causes the model to 'export' itself to JSF components.
 The model components have zero getters/setters, except a method
 'getData()'
 which triggers the export process, and returns a jsf 'UIComponent'.  The
 export process consists of creating the JSF 'UIComponent' in code, very
 similarly to the way you'd make pages in Swing (assuming that you are not
 using a totally lame graphic page generator).  Then the completed
 component
 is rendered by a single jsf tag on the page.  Any submittals, which in JSF
 are to some funky url, are redirected by javascript to the correct S2 url.
 This was the main problem until we figured out how to fix it.
 
 When I started designing the app I envisioned using standard JSP
 functionality to produce the pages, including the use of the S2 tags.
 However I really hated the S2 tags (I still believe that they are somewhat
 below horrible in the panoply of functionality).  A co-worker suggested
 working around this with JSF, and as a result the app is much stronger
 than
 I ever envisioned.
 
 The app does not use the struts-jsf plugin, and also uses tiles, again not
 using the struts-tiles plugin.  We have found that the use of these
 plugins
 is really limiting, and we are much better off with independent
 installations of both these functions in our app.  It would be nice to
 have
 a good struts-jsf function, but my impression is that there is not much
 being done with the plugin lately (I could be wrong, of course).  As it
 works out, the configuration of all the services is quite demanding, but
 perfectly straightforward once you have figured things out.
 
 In short, we have had excellent results with JSF with S2.  We use the JSF
 components from Trinidad, and they are first rate - with built in table
 sorting, paging, etc all using Ajax behind the scenes.  S2 is a superior
 'Control' component, but not really great at 'View'.  With the proper
 approach, they are perfectly compatible.  (Too bad Shale seems moribund).
 
 - Ray Clough
 [EMAIL PROTECTED]
 
 - Original Message -
 From: Dave Newton [EMAIL PROTECTED]
 To: Struts Users Mailing List user@struts.apache.org
 Subject: Re: [friday] Re: Struts2 vs JSF
 Date: Fri, 29 Feb 2008 14:24:26 -0800 (PST)


 --- Musachy Barroso [EMAIL PROTECTED] wrote:
  Search for Snatch fight in youtube, and you will get a felling of
  what Struts 2 would do to JSF in a fight :)

 I was *really* scared to see what that would bring up (snatch, in the
 US,
 is a somewhat derogatory term for... uh... female parts).

 Turns out it was just a scene from the movie Snatch, so it was all
 okay.

 Dave


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

 
 
 
 - Ray Clough
 [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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts2-vs-JSF-tp15768740p15772606.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: about current action name acsess

2008-02-29 Thread hns

Thanks to you
and also thanks to kedar for great logic
but i dont know why postLoginURL remains empty in my case
so i have choose way of session it works fine right now but i dont know
about future problems of it
i have done like this

 Inside interceptor i wrote

  if (!isAuthenticated) {

String urlGoingTo = actionInvocation.getProxy().getNamespace()+/+
 actionInvocation.getProxy().getActionName()+.do;
 session.put( actionurl, urlGoingTo);


struts.xml
--
action name=Login_*  method={1} class=authentic.Login
result name=input/Login.jsp/result
result name=cancel type=redirect-actionWelcome/result
result type=redirect-actionMainMenu/result
result name=redirect
type=redirect${session.actionurl}/result
interceptor-ref name=guest/
/action
---

Login.java

-
if(session.get(actionurl) != null  !session.get(actionurl).equals())
 {
 return redirect;
 }
  
 return SUCCESS;


Thanks
-- 
View this message in context: 
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15773049.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: about current action name acsess

2008-02-29 Thread hns

After Inspecting postLoginURL I have found that entry of ctx hashtable
PostLoginURL remains in it but it can not come at Login.java(getter and
setter of PostLoginURL)
so i think some thing missing in it or wrong at login.jsp so value can not
come after submitting form at login.java 
-- 
View this message in context: 
http://www.nabble.com/about-current-action-name-acsess-tp15736383p15773060.html
Sent from the Struts - User mailing list archive at Nabble.com.


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