Re: img tag?

2007-09-24 Thread Boon Leng

Yes, you need to use pure HTML.
You can use jsp tag file to create something similar to html:img (this is
what i did).


Adam Hardy-3 wrote:
 
 Is there a struts2 non-OGNL equivalent to the old html:img taglib?
 
 Or do I have to use c:url with pure HTML?
 
 c:url var=folder_shut value=/images/folder_shut.png/
  ${folder_shut} 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/img-tag--tf4511975.html#a12871952
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: Add style such as bgcolor, height, width to s:optiontransferselect, s:form Tags

2007-09-24 Thread Boon Leng

You can set the attribute cssClass, cssStyle, doubleCssClass,
doubleCssStyle which is equivalent to html class and style attributes
to control the style.
Example:
style
.mystyle {
background-color: #00F;
}
/style
s:form cssStyle=border: 1px solid #F00 cssClass=mystyle



Emi Lu-2 wrote:
 
 Hello,
 
 May I know how to give style such as border color, bgcolor to 
 s:optiontransferselect, s:form tags please?
 
 Thanks a lot!
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Add-style-such-as-bgcolor%2C-height%2C-width-to-s%3Aoptiontransferselect%2C-s%3Aform-Tags-tf4511770.html#a12871990
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Excluding path with namespace in Sitemesh

2007-09-20 Thread Boon Leng

I tried to exclude some pages from sitemesh decorator, but it seem that
sitemesh not able to recognise action path which has namespace. I have no
problem with pages stored in the folder or pages without namespace. 
Any idea how to use namespace inside sitemesh decorator? Thanks.
The following is my decorator:

decorators
excludes
pattern/ajax/*/pattern  !-- Not working using namespace --
pattern/scripts/*/pattern  !-- Working using folder --
/excludes
/decorators


-- 
View this message in context: 
http://www.nabble.com/-S2--Excluding-path-with-namespace-in-Sitemesh-tf4487732.html#a12797729
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Type Coversion in nested bean.

2007-08-29 Thread Boon Leng

Hi,

I'm able to use type conversion to populate bean into List in the Action.
But when I tried to populate bean into a List nested inside another bean, is
not working and there's no error printed.
May I know how can I implement type conversion for nested bean?
Any help would be appreciated. Thanks.
The following is my code.

Action
---
public class UserAction  extends ActionSupport {

private User user;
...
}

Bean
---
public class User {
private SetRole roles = new HashSetRole();

public SetRole getRoles() {
return roles;
}

public void setRoles(SetRole value) {
this.roles = value;
}

...
}

JSP
---
s:optiontransferselect theme=simple
name=roleOptions.value list=roleOptions listKey=value
listValue=label
doubleName=user.roles.id doubleList=user.roles doubleListKey=id
doubleListValue=name/

SampleAction-coversion.properties
---
Element_user.roles=sample.model.Role
KeyProperty_user.roles=id
CreateIfNull_user.roles=true


Regards,
Boon Leng
-- 
View this message in context: 
http://www.nabble.com/-S2--Type-Coversion-in-nested-bean.-tf4347142.html#a12385079
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Type Coversion in nested bean.

2007-08-29 Thread Boon Leng

Hi,

I'm trying to use type conversion for nested bean. I have no problem
populating the bean if the List is not nested inside another bean. Does
struts 2 able to perform type conversion for nested bean?
Any help would be appreciated. Thanks.

JSP
---
s:optiontransferselect theme=simple
name=roleOptions.value list=roleOptions listKey=value
listValue=label
doubleName=user.roles.roleId doubleList=user.roles
doubleListKey=roleId doubleListValue=name /

SampleAction-conversion.properties
---
Element_user.roles=com.intelopus.app.model.Role
KeyProperty_user.roles=roleId
CreateIfNull_user.roles=true
-- 
View this message in context: 
http://www.nabble.com/-S2--Type-Coversion-in-nested-bean.-tf4348629.html#a12389905
Sent from the Struts - User mailing list archive at Nabble.com.


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



Reload combo option if validation fail.

2007-08-20 Thread Boon Leng

In my form, I have a select box which get the option value populated from
database.
But when validation fail and return to input page (jsp page), I get the
error where the option value cannot be found. 

I know this is because the method (e.g search) is not called to retrieve
data from database. I tried to use chain result type to forward back to
the main action (e.g list) but I get Infinite recursion detected error.
May I know what is the best way to return to input page and at the sametime
retrieve data for the select box?

I don't want to store the option value in http session coz this way I need
to find a way to clean up unuse option value and might get problem is user
spore multiple tab on browser.

Appreciate is someone can give some guidelines. Thanks.


The following is my config and code.
struts.xml
-
action name=*_search class={1}Action method=list
result name=success/pages/{1}_search.jsp/result
result name=input/pages/{1}_search.jsp/result
result name=cancel type=redirectwelcome.html/result
/action

Sample_search.jsp
-
s:form
s:select name=user.country 
  label=%{getText('user.country')} 
  list=countryOptions
  headerKey=-1
  headerValue=%{getText('messages.select')}/

s:submit key=buttons.search method=search theme=simple/
s:submit key=buttons.cancel method=cancel theme=simple/
/s:form

SampleAction
-
public class SampleAction extends ActionSupport {


@SkipValidation
public String list() throws Exception {
this.countryOptions = lookupManager.getCountries();
return SUCCESS;
}

public String search() throws Exception {
List? results = userManager.findByValueBean(user);
this.listHolder = new PagedListHolder(results);

return SUCCESS;
}


}
-- 
View this message in context: 
http://www.nabble.com/Reload-combo-option-if-validation-fail.-tf4297263.html#a12231644
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: Reload combo option if validation fail.

2007-08-20 Thread Boon Leng

Hi,

I have tried using Preparable and putting all the collections loading in
prepare(), but because my action contains multiple methods and each load
different kind of collections, end up every method call will retrieve  all
the collections even though it's not using it. Is there anyway I able to
know which method will be execute in prepare() method? 


Zarar Siddiqi wrote:
 
 You could implement Preparable and load countryOptions in the prepare()
 method.
 
 http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
 
 Zarar
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Reload-combo-option-if-validation-fail.-tf4297263.html#a12247181
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: Reload combo option if validation fail.

2007-08-20 Thread Boon Leng

Hi Zarar,

I managed to solve the problem by using PreResultListener and find the
action info in ActionProxy.
Now I can load the collections base on method and result type :)
Thanks for your help.

Regards,
Boon Leng


Zarar Siddiqi wrote:
 
 You could implement Preparable and load countryOptions in the prepare()
 method.
 
 http://struts.apache.org/2.x/struts2-core/apidocs/com/opensymphony/xwork2/Preparable.html
 
 Zarar
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Reload-combo-option-if-validation-fail.-tf4297263.html#a12247320
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: Migrate Struts 1 EventDispatchAction to Struts 2

2007-07-14 Thread Boon Leng

Hi,

What I want to achieve is to migrate EventDispatchAction, which means the
methods will be called base on event, not base on request. Single action
name can dispatch to multiple methods base on event triggered.
And I would like to know is there anyway I can configure it in the action
mapping? or I need to handle the event dispatch inside the action class?


Thanks.

Regards,
Boon Leng


nuwan chandrasoma-2 wrote:
 
 Hi,
 
 you can have a action mapping like this.
 
 action name=sample_{*} method={1} ...
 
 and in your action class have 2 method according to you example
 
 public String add1() {
 
 // your logic
 
 return SUCCESS;
 
 }
 
 public String add2() {
 
 // your logic
 
 return SUCCESS;
 
 }
 
 
 if a call  like this
 eg: /sample_add1.action the method add1 one will be called
 
 you can get more infromation from the below link
 
 http://struts.apache.org/2.x/docs/action-configuration.html#ActionConfiguration-WildcardMethod
 
 Thanks,
 
 Nuwan
 
 - Original Message - 
 From: Boon Leng [EMAIL PROTECTED]
 To: user@struts.apache.org
 Sent: Saturday, July 14, 2007 4:45 AM
 Subject: Re: Migrate Struts 1 EventDispatchAction to Struts 2
 
 

 Hi,

 I would like to know is there any class in struts 2 which is equivalent
 to
 EventDispatchAction?
 So that I can convert the following:
action path=/sample_add parameter=insert, default=showForm ...
 to something like this:
action name=sample_add method=insert, default=showForm ...

 and struts 2 will call the method showForm() by default and call insert()
 when button is clicked.

 Currently I have to dispatch the method inside my action class if I
 maintaining the same action name.

public String execute() throws Exception {
if (insert) {
return insert();
} else {
return showForm();
}
}

 or slip the mapping into 2 actions:
action name=sample_add1 method=showForm ...
...
action name=sample_add2 method=insert ...

 Regards,
 Boon Leng


 Laurie Harper wrote:

 What do you specifically need help with? Struts2 supports wildcard
 action paths, dispatch to different methods in an action and
 parameterized results (equivalent to the forwards in your S1 config). Is
 there something in particular you're having trouble with?

 L.


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




 -- 
 View this message in context: 
 http://www.nabble.com/Migrate-Struts-1-EventDispatchAction-to-Struts-2-tf4074633.html#a11591032
 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]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Migrate-Struts-1-EventDispatchAction-to-Struts-2-tf4074633.html#a11599257
Sent from the Struts - User mailing list archive at Nabble.com.


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



Migrate Struts 1 EventDispatchAction to Struts 2

2007-07-13 Thread Boon Leng

May I know what is the best way to migrate Struts 1 EventDispatchAction to
Struts 2?

The following is my struts-config.xml where displaying form and submitting
form is using the same action name but execute different methods in the
action.

action path=/*_add
type=org.springframework.web.struts.DelegatingActionProxy
name={1}Form
attribute={1}AddForm
parameter=insert, default=showForm
scope=request
validate=false
forward name=input path=.{1}.add/
forward name=success path=/{1}_add.do   redirect=true/
forward name=cancel   path=/welcome.do   redirect=true/
/action

How do I convert it to Struts 2 mapping?
Any help would be appreciated. Thanks.

Regards,
Boon Leng
-- 
View this message in context: 
http://www.nabble.com/Migrate-Struts-1-EventDispatchAction-to-Struts-2-tf4074633.html#a11580060
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: Migrate Struts 1 EventDispatchAction to Struts 2

2007-07-13 Thread Boon Leng

Hi,

I would like to know is there any class in struts 2 which is equivalent to
EventDispatchAction?
So that I can convert the following:
action path=/sample_add parameter=insert, default=showForm ...
to something like this:
action name=sample_add method=insert, default=showForm ...

and struts 2 will call the method showForm() by default and call insert()
when button is clicked.

Currently I have to dispatch the method inside my action class if I
maintaining the same action name.

public String execute() throws Exception {
if (insert) {
return insert();
} else {
return showForm();
}
}

or slip the mapping into 2 actions:
action name=sample_add1 method=showForm ...
...
action name=sample_add2 method=insert ...

Regards,
Boon Leng


Laurie Harper wrote:
 
 What do you specifically need help with? Struts2 supports wildcard 
 action paths, dispatch to different methods in an action and 
 parameterized results (equivalent to the forwards in your S1 config). Is 
 there something in particular you're having trouble with?
 
 L.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Migrate-Struts-1-EventDispatchAction-to-Struts-2-tf4074633.html#a11591032
Sent from the Struts - User mailing list archive at Nabble.com.


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