Re: Struts 2 instance creation in memorey

2009-03-17 Thread musomesa
Hi Sumit -- the two are different. Easiest to illustrate by example:

Definitions:
Interceptor stack: an ordered list of interceptors with pre/post processing 
logic. You have one.

Value stack: a stack (in data structure sense) that holds javabeans including 
your current action. You have one *per request*
When an interceptor calls a method on an action it will be the action sitting 
on the value stack of the *current request*.

So if I have 
an action called test?with action class TestAction and?action method 
execute()?
?configured to use TestInterceptor which calls method testMethod of the action 
before execute() runs
?and I send three requests to the test action I will have
one testInterceptor object but get a new?value stack with a new testAction 
object each time?(testAction1, testAction2, testAction3).

The?method call sequence till be? testInterceptor.intercept() -- 
testAction1.testMethod() -- testAction1.execute()
then testInterceptor.intercept() -- testAction2.testMethod() -- 
testAction2.execute()
then testInterceptor.intercept() -- testAction3.testMethod() -- 
testAction2.execute()

Note that testInterceptor is shared and so not thread safe but the actions are 
thread safe.
Hope that helps.
Cheers
Chris Mawata








-Original Message-
From: Sumit Agarwal 2005.su...@gmail.com
To: user@struts.apache.org
Sent: Mon, 16 Mar 2009 9:26 pm
Subject: Re: Struts 2 instance creation in memorey




Well i have one doubt regarding interceptor and value stack:-

i have read interceptor can store and read the data from value stack.well if
interceptor is defined in the stack.as per below answer one stack will be
create for interceptor and  two instance(for two request) for value stack
then in this case which value stack instance will be refer by the
interceptor?
looking forward to hear from all of you guys.

Thanks in advance.



newton.dave wrote:
 
 Sumit Agarwal wrote:
 we are given 2 request for this application from different system
   at a time.As per Struts2 two Action instance will be created right?
 
 Correct: unlike servlets or Struts 1 actions, Struts 2 actions are 
 created per-request.
 
 I wanna know how many value stack instance will get create in memory?
 
 Two, one for each action, otherwise it'd defeat the purpose of having 
 separate action instances.
 
 How many Action context instance will get create in memory?
 
 Action contexts are thread-local variables, and there's one per... 
 action context.
 
 how many interceptor instance will get create?
 
 Depends, but in general there will be one interceptor stack for a Struts 
 2 package, and it's created at startup, not per-request.
 
 If an action has configured its own interceptors then there can be 
 multiple interceptor stacks, but they're still not created per-request 
 (and interceptors are not inherently thread-safe).
 
 Dave
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-instance-creation-in-memorey-tp22388082p22537006.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




how to update/persist associate entity?

2009-03-17 Thread xnpeng
class Site{
  String id;
  String name;
  SetSiteProperty properties;
  ...setter/getter
}
 
class SiteProperty{
 String typeId;
 String typeName;
 Site site;
 ...
 setter/getter
}
 
SiteController.java
class SiteController extends ActionSupport{
  Site site;
  setter/getter...
  public String update(){
 Session session = SessionFactory.getSession();
 Transaction tx = session.beginTransaction();
 try{
session.saveOrUpdate(site);
Set props = site.getProperties();
Iterator it = props.iterator();
while(it.hasNext()){
   SiteProperty prop = (SiteProperty)it.next();
   prop.setSite(site);
   session.saveOrUpdate(prop);
}
tx.commit();
 }catch(HibernateException e){
tx.rollback();
 }
 return index;
  }
}
 
site-edit.jsp:
s:form action=site/%{site.id}
  s:hidden name=_method value=put/
  s:textvalue name=site.id/
  s:textvalue name=site.name/
  s:iterator value=site.properties
 s:textvalue name=propId/
 s:textvalue name=propName/
 s:textvalue name=site.id/
  /s:iterator
  s:submit/
/s:form
 
my question is,i can insert/update Site entity into database, while the 
propertiesSiteProperty cannot save to database, even in memory,the properties 
data refuse to take any change i made in client.
 
i'm confused by form/action mapping, how does the data transfer to action when 
client submit the form? i traced the action's setter/getter method,there is no 
step into these methods,how does the request data transfer to action?
 
thank you.


 

Web Services

2009-03-17 Thread Rafael Taboada
Hi list!

I have a Struts2+Dojo+JPA+Spring project working fine in a production
environment, but suddenly I have the requirement of exposing web services
from my project. I mean, I need to implement web services about my project
funcionality which other systems can consume.

I'm completely new at web services. Please can you guide me how I can
implement web services? Would Spring Web Services be a good point to start?

Thanks in advance for your help!

-- 
Rafael Taboada


Re : springOpenEntityManagerInViewFilter (with Hibernate)

2009-03-17 Thread François Rouxel

no but I'm gonna try it
I'll tell you
  
 



- Message d'origine 
De : Burton Rhodes burtonrho...@gmail.com
À : Struts Users Mailing List user@struts.apache.org
Envoyé le : Dimanche, 15 Mars 2009, 18h27mn 56s
Objet : Re: springOpenEntityManagerInViewFilter (with Hibernate)

I didn't see a reply to your question. Did you ever find an answer?
Interested to know what you found out.

On 3/11/09, fr Rouxel rouxe...@yahoo.com wrote:

 Hi,

 do you know how this filter manage the rollback when a db error occurres?

 Is it simple to add an struts 2 error message?

 Right now, I'm using a struts 2 interceptor, and I can manage the error
 message. (If you are interesting by my code...just ask)

 And I wonder if it's better to use the spring filter

 thanks
 fr/
 --
 View this message in context:
 http://www.nabble.com/springOpenEntityManagerInViewFilter-%28with-Hibernate%29-tp22455668p22455668.html
 Sent from the Struts - User mailing list archive at Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



-- 
Sent from my mobile device

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Web Services

2009-03-17 Thread Sidharth Bhatia
Hey Rafael,

I think Spring webservices are a great point to start at. If you already
know spring. The learning curve is not quite so steep.

thanks,

Sid Bhatia
Try not. Do...  or do not. There is no try -- Yoda
_
_ mailto:sidharth.bhat...@gmail.com 

-Original Message-
From: Rafael Taboada [mailto:kaliman.fore...@gmail.com] 
Sent: Tuesday, March 17, 2009 8:39 AM
To: user@struts.apache.org
Subject: Web Services

Hi list!

I have a Struts2+Dojo+JPA+Spring project working fine in a production
environment, but suddenly I have the requirement of exposing web services
from my project. I mean, I need to implement web services about my project
funcionality which other systems can consume.

I'm completely new at web services. Please can you guide me how I can
implement web services? Would Spring Web Services be a good point to start?

Thanks in advance for your help!

-- 
Rafael Taboada


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 2 Container Security problem

2009-03-17 Thread Musachy Barroso
Just as a reference, there is a ticket open for this:

https://issues.apache.org/struts/browse/WW-2642

musachy

On Mon, Mar 16, 2009 at 5:37 PM, Struts Two struts...@yahoo.ca wrote:

 There is a problem running Struts 2.1.6 on Websphere when security is 
 enabled. The case happens when url is an action not a resource like jsp or 
 html. Refer to JIRA WW-2642 that I opened almost a year ago.

 I was hoping that Apache group can get their hands on Websphere to verify the 
 issue but it seems like a distant probability as I have not heard any news on 
 that for sometime.

 But on the bright site, there may be some good news on this soon. As I had to 
 locate WAS L3 support in person and I am working with them on this issue 
 [though the pace is slow].

 Also keep in mind, the same issue exists on WAS 7.0.0.1 with a slight 
 variation. If this is determined to be a Websphere problem with WAS 6.1. Then 
 I have a stronger case to press issue for WAS 7.0.

 --- On Mon, 3/16/09, pblatner pblat...@gmail.com wrote:

 From: pblatner pblat...@gmail.com
 Subject: Re: Struts 2 Container Security problem
 To: user@struts.apache.org
 Received: Monday, March 16, 2009, 9:05 PM

 I have tried to do the exact thing that Jeromy suggests
 below with 2
 packages.  And then in the web.xml specify a security
 constraint with the
 URL pattern /protected/*.  After doing so, I am not
 getting the result
 that I think I should be.

 When issuing a request for my action at
 http://localhost/MyApp/protected/HomeAction;, the
 container is not
 intercepting and challenging me with my logon.html page.

 Anyone know why this isn't working?

 The struts 2 servlet-filter pattern is /*..  It seems
 pretty obvious that
 the struts 2 servlet filter is responding to the first part
 of the URL:
 http://localhost/MyApp/*; and the container isn't
 seeing that as a secured
 resource.

 Am I missing a configuration pattern somewhere that tells
 the container to
 inspect the full URL before allowing the servlet filter to
 process it?

 My deployment environment is WebSphere 6.1.  Are there
 any incompatibilities
 between WebSphere 6.1 and struts 2 that could be causing
 this?

 Thanks,
 Pete.


 Jeromy Evans - Blue Sky Minds wrote:
 
  In struts.xml, the namespace given to your package
 needs be in
  /protected as well.
  eg. package name=myPackage
 namespace=/protected
  Otherwise, as you've seen, it's available in the root
 of the
  application's context path.
 
  I usually split my struts2 application into at least
 two packages:
  package name=public namespace=/ ...
  package name=secure namespace=/protected
 

 --
 View this message in context: 
 http://www.nabble.com/Struts-2-Container-Security-problem-tp15571409p22547426.html
 Sent from the Struts - User mailing list archive at
 Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




      __
 Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
 Canada Messenger at http://ca.beta.messenger.yahoo.com/


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





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

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Best Practices for Forms

2009-03-17 Thread Timothy Orme

Sorry to revive an old thread here, but I've run into another issue with this.

I decided to go with the second of Hernan's recommendations here, so I now have the 
following flow.

1. User visits ViewForm.action.
2. User submits the form and we go to AddData.action
3. If the data validated okay, we send the user on to ViewData.action,
otherwise, we send them back to ViewForm.action.

And in XML it looks something like:

action name=AddData class=action.AddDataAction
result name=success 
type=redirectViewData.action?id=%{dataId}/result
result name=input type=redirectViewForm.action/result
/action

The problem is, as Hernan stated, that I now lose all my ActionErrors that were added to the stack. So the page redirects ok, but now if the user entered bad data, I can't send messages back to them 
to tell them what went wrong. Again, this seems like something that should be a common goal, but I can't seem to find the right way to do it. Does anyone have any suggestions?


Thanks,
Tim

Timothy Orme wrote:
Ok, this helps a lot. Simply from a usability standpoint though, the 
latter example seems more in line with what I'd want. It seems silly to 
have to bring the user to a page where, in my case, they would 
invariably click a link. I was aware of the TokenSession interceptor, 
and as you stated, it does fix the issue, but I was more curious about 
the best practice.


Thanks,
Tim

hernan gonzalez wrote:

To avoid the problem of duplicated submissions (not only when
refreshing the result page, but also when double clicking the submit
button, or going back to the submited form and submitting again) you
should take a look at  the TokenSessionStoreInterceptor.

But that is complementary with the other issue: it is not bad practice
to separate the actions addData  from the action viewData, the
later is idempotent , the former is not. Hence, you might implement
two separate Actions (or a same Action with two methods that return
different results). For example

- 


action name=SubmitData class=action.SubmitDataAction
result name=success/viewSubmitResult.jsp/result
/action

action name=ViewData class=action.ViewDataAction
result name=success/viewData.jsp/result
/action

(Here SubmitDataAction should include the Token interceptor to avoid
double submissions. And /viewSubmitResult.jsp might just show a
generic succes message with a link to the ViewDataAction action)

 



or

action name=SubmitData class=action.SubmitDataAction
result name=success
type=redirectViewDataAction.do?id=%{dataId}/result
/action

action name=ViewData class=action.ViewDataAction
result name=success/viewData.jsp/result
/action

(This is a little more straightforward, but has the slight
disadvantage of losing any ActionMessage you might have produced in
the SubmitDataAction)

--- 



Hernán J. González
http://hjg.com.ar/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Web Services

2009-03-17 Thread Griffith, Michael *
Spring has excellent remoting abilities. If you are already using
Spring, I'd check out Spring Remoting as my first option. 

-Original Message-
From: Rafael Taboada [mailto:kaliman.fore...@gmail.com] 
Sent: Tuesday, March 17, 2009 7:39 AM
To: user@struts.apache.org
Subject: Web Services

Hi list!

I have a Struts2+Dojo+JPA+Spring project working fine in a production
environment, but suddenly I have the requirement of exposing web
services from my project. I mean, I need to implement web services about
my project funcionality which other systems can consume.

I'm completely new at web services. Please can you guide me how I can
implement web services? Would Spring Web Services be a good point to
start?

Thanks in advance for your help!

--
Rafael Taboada

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Best Practices for Forms

2009-03-17 Thread Timothy Orme

Ok, I think this works. If I do:

action name=AddData class=action.AddDataAction
result name=success 
type=redirectViewData.action?id=%{dataId}/result
result name=inputViewForm.action/result
 /action

And remove the redirect on input, instead of

action name=AddData class=action.AddDataAction
result name=success 
type=redirectViewData.action?id=%{dataId}/result
result name=input type=redirectViewForm.action/result
/action

Then I think this will be ok. On the chance that the user does have a validation error, they will be sent back to the ViewForm.action with the correct stack of errors, though now the browser will 
still have them at AddData.action. This is ok though, since if the user refreshes the page, I shouldn't have to worry about double submits; the validation will simply kick in again and the user will 
just be dispatched correctly again.


Thanks for the help!
-Tim

Paweł Wielgus wrote:

Hi Timothy,
You may consider flow like this:
1. request from browser
2. action on server
3. result returned to browser

That way You can do as follows:
1. when receiving request for AddData
2. perform AddData action
3. then dispatch to apropriate forward
3.1. when with success redirect to ViewData or ListData action (any
necessary messages should be in session not in request)
3.2. when with errors redirect to a page where Data can be edited (no
redirect - so You have access to errors) and finally submited back
again

That kind of scheme works for me well, but i don't claim it's best.

Best greetings,
Paweł Wielgus.

2009/3/17 Timothy Orme to...@genome.med.harvard.edu:

Sorry to revive an old thread here, but I've run into another issue with
this.

I decided to go with the second of Hernan's recommendations here, so I now
have the following flow.

1. User visits ViewForm.action.
2. User submits the form and we go to AddData.action
3. If the data validated okay, we send the user on to ViewData.action,
   otherwise, we send them back to ViewForm.action.

And in XML it looks something like:

action name=AddData class=action.AddDataAction
   result name=success
type=redirectViewData.action?id=%{dataId}/result
   result name=input type=redirectViewForm.action/result
/action

The problem is, as Hernan stated, that I now lose all my ActionErrors that
were added to the stack. So the page redirects ok, but now if the user
entered bad data, I can't send messages back to them to tell them what went
wrong. Again, this seems like something that should be a common goal, but I
can't seem to find the right way to do it. Does anyone have any suggestions?

Thanks,
Tim

Timothy Orme wrote:

Ok, this helps a lot. Simply from a usability standpoint though, the
latter example seems more in line with what I'd want. It seems silly to have
to bring the user to a page where, in my case, they would invariably click a
link. I was aware of the TokenSession interceptor, and as you stated, it
does fix the issue, but I was more curious about the best practice.

Thanks,
Tim

hernan gonzalez wrote:

To avoid the problem of duplicated submissions (not only when
refreshing the result page, but also when double clicking the submit
button, or going back to the submited form and submitting again) you
should take a look at  the TokenSessionStoreInterceptor.

But that is complementary with the other issue: it is not bad practice
to separate the actions addData  from the action viewData, the
later is idempotent , the former is not. Hence, you might implement
two separate Actions (or a same Action with two methods that return
different results). For example


-
action name=SubmitData class=action.SubmitDataAction
   result name=success/viewSubmitResult.jsp/result
/action

action name=ViewData class=action.ViewDataAction
   result name=success/viewData.jsp/result
/action

(Here SubmitDataAction should include the Token interceptor to avoid
double submissions. And /viewSubmitResult.jsp might just show a
generic succes message with a link to the ViewDataAction action)




or

action name=SubmitData class=action.SubmitDataAction
   result name=success
type=redirectViewDataAction.do?id=%{dataId}/result
/action

action name=ViewData class=action.ViewDataAction
   result name=success/viewData.jsp/result
/action

(This is a little more straightforward, but has the slight
disadvantage of losing any ActionMessage you might have produced in
the SubmitDataAction)


---

Hernán J. González
http://hjg.com.ar/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 2 Container Security problem

2009-03-17 Thread pblatner

I don't see how this fix applies to the problem I mentioned below: 
http://www-01.ibm.com/support/docview.wss?rs=180uid=swg1PK31377

The text there doesn't say anything about resolving an issue where WebSphere
doesn't seem to be recognizing servlet filters as resources to secure using
web container authentication.


Musachy Barroso wrote:
 
 Just as a reference, there is a ticket open for this:
 
 https://issues.apache.org/struts/browse/WW-2642
 
 musachy
 
 On Mon, Mar 16, 2009 at 5:37 PM, Struts Two struts...@yahoo.ca wrote:

 There is a problem running Struts 2.1.6 on Websphere when security is
 enabled. The case happens when url is an action not a resource like jsp
 or html. Refer to JIRA WW-2642 that I opened almost a year ago.

 I was hoping that Apache group can get their hands on Websphere to verify
 the issue but it seems like a distant probability as I have not heard any
 news on that for sometime.

 But on the bright site, there may be some good news on this soon. As I
 had to locate WAS L3 support in person and I am working with them on this
 issue [though the pace is slow].

 Also keep in mind, the same issue exists on WAS 7.0.0.1 with a slight
 variation. If this is determined to be a Websphere problem with WAS 6.1.
 Then I have a stronger case to press issue for WAS 7.0.

 --- On Mon, 3/16/09, pblatner pblat...@gmail.com wrote:

 From: pblatner pblat...@gmail.com
 Subject: Re: Struts 2 Container Security problem
 To: user@struts.apache.org
 Received: Monday, March 16, 2009, 9:05 PM

 I have tried to do the exact thing that Jeromy suggests
 below with 2
 packages.  And then in the web.xml specify a security
 constraint with the
 URL pattern /protected/*.  After doing so, I am not
 getting the result
 that I think I should be.

 When issuing a request for my action at
 http://localhost/MyApp/protected/HomeAction;, the
 container is not
 intercepting and challenging me with my logon.html page.

 Anyone know why this isn't working?

 The struts 2 servlet-filter pattern is /*..  It seems
 pretty obvious that
 the struts 2 servlet filter is responding to the first part
 of the URL:
 http://localhost/MyApp/*; and the container isn't
 seeing that as a secured
 resource.

 Am I missing a configuration pattern somewhere that tells
 the container to
 inspect the full URL before allowing the servlet filter to
 process it?

 My deployment environment is WebSphere 6.1.  Are there
 any incompatibilities
 between WebSphere 6.1 and struts 2 that could be causing
 this?

 Thanks,
 Pete.


 Jeromy Evans - Blue Sky Minds wrote:
 
  In struts.xml, the namespace given to your package
 needs be in
  /protected as well.
  eg. package name=myPackage
 namespace=/protected
  Otherwise, as you've seen, it's available in the root
 of the
  application's context path.
 
  I usually split my struts2 application into at least
 two packages:
  package name=public namespace=/ ...
  package name=secure namespace=/protected
 

 --
 View this message in context:
 http://www.nabble.com/Struts-2-Container-Security-problem-tp15571409p22547426.html
 Sent from the Struts - User mailing list archive at
 Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




      __
 Instant Messaging, free SMS, sharing photos and more... Try the new
 Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


 
 
 
 -- 
 Hey you! Would you help me to carry the stone? Pink Floyd
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-Container-Security-problem-tp15571409p22562774.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Required field only works with text fields?

2009-03-17 Thread Griffith, Michael *
Can anyone help me with this?

By adding the @RequiredField annotation to the relationship field
(status in my example below) the form did not submit, which is good
because the status had not been specified from the list. However, the
form did not present a message too the user saying why the form
submission failed.  I have the field annotated as:


@ManyToOne(cascade = {CascadeType.PERSIST, CascadeType.MERGE},
fetch=FetchType.EAGER)
@JoinColumn(name = STATUS)
@RequiredFieldValidator(message=Validation
Error,key=validate.notEmpty)
public Status getStatus() {
return status;
} 

Any reply would be appreciated.

Best Regards,

MG

-Original Message-
From: Griffith, Michael * [mailto:michael.griff...@fda.hhs.gov] 
Sent: Monday, March 16, 2009 1:18 PM
To: Struts Users Mailing List
Subject: RE: Required field only works with text fields?

Ok, So I am being a bone-head.  

When I added the @RequiredStringValidator to the model, the validation
is in sync with what is being required on the form. That makes sense to
me, but... 

How are relationships handled? I have a form control as such:

s:select key=component.status name=selectedStatus required=true
tabindex=12
   headerKey=-1
   headerValue=-- Select Status --
   list=statusList
   listKey=id
   value=%{status.id}
   listValue=description/

And the relationship is being managed via a JPA @ManyToOne(cascade =
{CascadeType.PERSIST, CascadeType.MERGE},
fetch=FetchType.EAGER)
@JoinColumn(name = STATUS)
public Status getStatus() {
return status;
}

What sort of annotation should I use to validate the user selected an
item from the list?

Any reply is appreciated...

MG


-Original Message-
From: stanl...@gmail.com [mailto:stanl...@gmail.com]
Sent: Friday, March 13, 2009 6:01 PM
To: Struts Users Mailing List
Subject: Re: Required field only works with text fields?

The required attribute only paints the asterisk -- it has nothing to do
with actually requiring input.  Nice huh?

Peace,
Scott

On Fri, Mar 13, 2009 at 4:14 PM, Griffith, Michael * 
michael.griff...@fda.hhs.gov wrote:

 Hi all,

 I just noticed that the only required field validations that seem to 
 be working in my form are text field validations.

 Any HTML tag that renders a list, check box or radio button doesn't 
 validate, even though the template shows the field as required.

 In other words, this tag:
 s:radio key=component.modified name=modifiedFromSource
 list=#{'Y':'Yes', 'N':'No'} required=true tabindex=7/

 Shows a radio button with the * required indicator, but the form is 
 allowed to be submitted without a button selected, which of course 
 breaks my request/response cycle...

 Do I need to do something special to make the required non-text inputs

 to behave as I expect?

 Any help is appreciated.

 Best Regards,

 MG





-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Duan, Bin
I was trying to get a parameter from a Http GET. The get from jsp looks
like this: 

a href=/providerDetail.action?drProviderId=1000Provider Name 

The providerDetail.action maps to ProviderAction class. In the action
class, I have a setDrProviderId() method, but found the id was not set.
Then I tried to get the id from
ServletActionRequest.getRequest().getParameter(drProviderId), but
still did not get anything.

 

I debugged the code, in the request object, I saw request input as GET
/providerDetail.action?drProviderId=1000, this pretty much meant the
parameter was sent to the server side correctly. But
request.getParameter(drProviderId) returned me null. 

 

If I switch to use form POST, my setDrProviderId() method was still NOT
called, but I could get the id from
request.getParameter(drProviderId).

 

This problem will almost be a show stopper for our project to use
Struts. Anybody has any ideas of what could be wrong? 

 

I am using Struts 2.1.6. I tried both on oc4j and JBoss. 

 

 

 

Following is my struts.xml file

 

 

struts

 

package name=dataReceiving extends=struts-default

 

action name=listProvider method=listProvider

 
class=com.claritas.mms.radish.dataReceiving.DrProviderAction

result/dataReceiving/ProviderList.jsp/result

/action

action name=providerDetail method=providerDetail

 
class=com.claritas.mms.radish.dataReceiving.DrProviderAction

result/dataReceiving/ProviderDetails.jsp/result

/action

/package

 

/struts

 

Following is my DrProviderAction class

 

public void setDrProviderId(String id) 

{

this.drProviderId = new Integer(id).intValue();

}

 

public String providerDetail() 

{

Map map = request.getParameterMap();

 

String sid = request.getParameter(drProviderId);

drProviderId = new Integer(sid).intValue();

//check if the 

if(session != null) 

{

MapInteger, DrProvider providerMap =
(Map)session.get(provider_map);

if(providerMap != null) 

{

provider = providerMap.get(drProviderId);

}

}

else //go to database

{

provider = service.getProvider(drProviderId); 

}



return SUCCESS;



}

 

 



Re: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Struts Two

Why do n't you let your action implement RequestAware interface and then get 
parameter from the request map.

--- On Tue, 3/17/09, Duan, Bin bd...@claritas.com wrote:

 From: Duan, Bin bd...@claritas.com
 Subject: Problem getting request parameters in HTTP GET in Struts 2
 To: user@struts.apache.org
 Received: Tuesday, March 17, 2009, 7:01 PM
 I was trying to get a parameter from
 a Http GET. The get from jsp looks
 like this: 
 
 a
 href=/providerDetail.action?drProviderId=1000Provider
 Name 
 
 The providerDetail.action maps to ProviderAction class. In
 the action
 class, I have a setDrProviderId() method, but found the id
 was not set.
 Then I tried to get the id from
 ServletActionRequest.getRequest().getParameter(drProviderId),
 but
 still did not get anything.
 
  
 
 I debugged the code, in the request object, I saw request
 input as GET
 /providerDetail.action?drProviderId=1000, this pretty much
 meant the
 parameter was sent to the server side correctly. But
 request.getParameter(drProviderId) returned me null. 
 
  
 
 If I switch to use form POST, my setDrProviderId() method
 was still NOT
 called, but I could get the id from
 request.getParameter(drProviderId).
 
  
 
 This problem will almost be a show stopper for our project
 to use
 Struts. Anybody has any ideas of what could be wrong? 
 
  
 
 I am using Struts 2.1.6. I tried both on oc4j and JBoss. 
 
  
 
  
 
  
 
 Following is my struts.xml file
 
  
 
  
 
 struts
 
  
 
     package name=dataReceiving
 extends=struts-default
 
  
 
         action name=listProvider
 method=listProvider
 
  
 class=com.claritas.mms.radish.dataReceiving.DrProviderAction
 
            
 result/dataReceiving/ProviderList.jsp/result
 
         /action
 
         action
 name=providerDetail method=providerDetail
 
  
 class=com.claritas.mms.radish.dataReceiving.DrProviderAction
 
            
 result/dataReceiving/ProviderDetails.jsp/result
 
         /action
 
     /package
 
  
 
 /struts
 
  
 
 Following is my DrProviderAction class
 
  
 
     public void setDrProviderId(String id) 
 
     {
 
         this.drProviderId = new
 Integer(id).intValue();
 
 }
 
  
 
     public String providerDetail() 
 
     {
 
         Map map =
 request.getParameterMap();
 
  
 
         String sid =
 request.getParameter(drProviderId);
 
         drProviderId = new
 Integer(sid).intValue();
 
         //check if the 
 
         if(session != null) 
 
         {
 
             MapInteger,
 DrProvider providerMap =
 (Map)session.get(provider_map);
 
             if(providerMap !=
 null) 
 
             {
 
                
 provider = providerMap.get(drProviderId);
 
             }   
         
 
         }
 
         else //go to database
 
         {
 
             provider =
 service.getProvider(drProviderId); 
 
         }
 
         
 
         return SUCCESS;
 
         
 
     }
 
  
 
  
 
 


  __
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
Canada Messenger at http://ca.beta.messenger.yahoo.com/


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Duan, Bin
Thanks for the response.

I did that. The request obtained by implementing RequestAware is the same as 
the one obtained from ServletActionRequest.getRequest(). 

None of them worked. Actually, I did get the parameter map from the request, 
and it contained null data.

Have you tried the scenario, did it work for your application?

-Original Message-
From: Struts Two [mailto:struts...@yahoo.ca] 
Sent: Tuesday, March 17, 2009 3:46 PM
To: Struts Users Mailing List
Subject: Re: Problem getting request parameters in HTTP GET in Struts 2


Why do n't you let your action implement RequestAware interface and then get 
parameter from the request map.

--- On Tue, 3/17/09, Duan, Bin bd...@claritas.com wrote:

 From: Duan, Bin bd...@claritas.com
 Subject: Problem getting request parameters in HTTP GET in Struts 2
 To: user@struts.apache.org
 Received: Tuesday, March 17, 2009, 7:01 PM
 I was trying to get a parameter from
 a Http GET. The get from jsp looks
 like this: 
 
 a
 href=/providerDetail.action?drProviderId=1000Provider
 Name 
 
 The providerDetail.action maps to ProviderAction class. In
 the action
 class, I have a setDrProviderId() method, but found the id
 was not set.
 Then I tried to get the id from
 ServletActionRequest.getRequest().getParameter(drProviderId),
 but
 still did not get anything.
 
  
 
 I debugged the code, in the request object, I saw request
 input as GET
 /providerDetail.action?drProviderId=1000, this pretty much
 meant the
 parameter was sent to the server side correctly. But
 request.getParameter(drProviderId) returned me null. 
 
  
 
 If I switch to use form POST, my setDrProviderId() method
 was still NOT
 called, but I could get the id from
 request.getParameter(drProviderId).
 
  
 
 This problem will almost be a show stopper for our project
 to use
 Struts. Anybody has any ideas of what could be wrong? 
 
  
 
 I am using Struts 2.1.6. I tried both on oc4j and JBoss. 
 
  
 
  
 
  
 
 Following is my struts.xml file
 
  
 
  
 
 struts
 
  
 
     package name=dataReceiving
 extends=struts-default
 
  
 
         action name=listProvider
 method=listProvider
 
  
 class=com.claritas.mms.radish.dataReceiving.DrProviderAction
 
            
 result/dataReceiving/ProviderList.jsp/result
 
         /action
 
         action
 name=providerDetail method=providerDetail
 
  
 class=com.claritas.mms.radish.dataReceiving.DrProviderAction
 
            
 result/dataReceiving/ProviderDetails.jsp/result
 
         /action
 
     /package
 
  
 
 /struts
 
  
 
 Following is my DrProviderAction class
 
  
 
     public void setDrProviderId(String id) 
 
     {
 
         this.drProviderId = new
 Integer(id).intValue();
 
 }
 
  
 
     public String providerDetail() 
 
     {
 
         Map map =
 request.getParameterMap();
 
  
 
         String sid =
 request.getParameter(drProviderId);
 
         drProviderId = new
 Integer(sid).intValue();
 
         //check if the 
 
         if(session != null) 
 
         {
 
             MapInteger,
 DrProvider providerMap =
 (Map)session.get(provider_map);
 
             if(providerMap !=
 null) 
 
             {
 
                
 provider = providerMap.get(drProviderId);
 
             }   
         
 
         }
 
         else //go to database
 
         {
 
             provider =
 service.getProvider(drProviderId); 
 
         }
 
         
 
         return SUCCESS;
 
         
 
     }
 
  
 
  
 
 


  __
Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
Canada Messenger at http://ca.beta.messenger.yahoo.com/


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Musachy Barroso
Something is very wrong in your configuration. Can you post your web.xml?

musachy

On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin bd...@claritas.com wrote:
 Thanks for the response.

 I did that. The request obtained by implementing RequestAware is the same as 
 the one obtained from ServletActionRequest.getRequest().

 None of them worked. Actually, I did get the parameter map from the request, 
 and it contained null data.

 Have you tried the scenario, did it work for your application?

 -Original Message-
 From: Struts Two [mailto:struts...@yahoo.ca]
 Sent: Tuesday, March 17, 2009 3:46 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2


 Why do n't you let your action implement RequestAware interface and then get 
 parameter from the request map.

 --- On Tue, 3/17/09, Duan, Bin bd...@claritas.com wrote:

 From: Duan, Bin bd...@claritas.com
 Subject: Problem getting request parameters in HTTP GET in Struts 2
 To: user@struts.apache.org
 Received: Tuesday, March 17, 2009, 7:01 PM
 I was trying to get a parameter from
 a Http GET. The get from jsp looks
 like this:

 a
 href=/providerDetail.action?drProviderId=1000Provider
 Name

 The providerDetail.action maps to ProviderAction class. In
 the action
 class, I have a setDrProviderId() method, but found the id
 was not set.
 Then I tried to get the id from
 ServletActionRequest.getRequest().getParameter(drProviderId),
 but
 still did not get anything.



 I debugged the code, in the request object, I saw request
 input as GET
 /providerDetail.action?drProviderId=1000, this pretty much
 meant the
 parameter was sent to the server side correctly. But
 request.getParameter(drProviderId) returned me null.



 If I switch to use form POST, my setDrProviderId() method
 was still NOT
 called, but I could get the id from
 request.getParameter(drProviderId).



 This problem will almost be a show stopper for our project
 to use
 Struts. Anybody has any ideas of what could be wrong?



 I am using Struts 2.1.6. I tried both on oc4j and JBoss.







 Following is my struts.xml file





 struts



     package name=dataReceiving
 extends=struts-default



         action name=listProvider
 method=listProvider


 class=com.claritas.mms.radish.dataReceiving.DrProviderAction


 result/dataReceiving/ProviderList.jsp/result

         /action

         action
 name=providerDetail method=providerDetail


 class=com.claritas.mms.radish.dataReceiving.DrProviderAction


 result/dataReceiving/ProviderDetails.jsp/result

         /action

     /package



 /struts



 Following is my DrProviderAction class



     public void setDrProviderId(String id)

     {

         this.drProviderId = new
 Integer(id).intValue();

 }



     public String providerDetail()

     {

         Map map =
 request.getParameterMap();



         String sid =
 request.getParameter(drProviderId);

         drProviderId = new
 Integer(sid).intValue();

         //check if the

         if(session != null)

         {

             MapInteger,
 DrProvider providerMap =
 (Map)session.get(provider_map);

             if(providerMap !=
 null)

             {


 provider = providerMap.get(drProviderId);

             }


         }

         else //go to database

         {

             provider =
 service.getProvider(drProviderId);

         }



         return SUCCESS;



     }








      __
 Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! 
 Canada Messenger at http://ca.beta.messenger.yahoo.com/


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org





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

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Best Practices for Forms

2009-03-17 Thread Greg Lindholm

Well that's about the most common question one sees on this list.
Check this out:

http://struts.apache.org/2.1.6/docs/how-do-we-repopulate-controls-when-validation-fails.html


Timothy Orme wrote:
 
 Hi Greg,
 
   Thanks, I actually just stumbled across this. I'm actually having some
 problems with it however.
 
 I have it setup as follows:
 
 action name=ViewForm class=ViewFormAction
   interceptor-ref name=redirectStack /
   result name=success/form.jsp?id=${id}/result
   result name=input/form.jsp?id=${id}/result
 /action
 
 action name=AddData class=AddDataAction
   interceptor-ref name=redirectStack /
   result name=success type=redirectViewData.action?id=${id}/result
   result name=input type=redirectViewForm.action?id=${id}/result
 /action
 
 This comes close to working. If the user enters bad data, I get moved from
 the AddData action back to the ViewForm action, and the action errors are
 there, but now the dynamic parts of the form are 
 not present. After debugging this, I see that when the user enters bad
 data, it hits the validate method of the AddData action, but never hits
 the execute() method of view form. What am I doing wrong?
 
 Thanks,
 Tim
 
 Greg Lindholm wrote:
 To preserve your action errors and messages across a redirect you can use
 this interceptor.
 
 http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/
 
 
 Timothy Orme wrote:
 Sorry to revive an old thread here, but I've run into another issue with
 this.

 I decided to go with the second of Hernan's recommendations here, so I
 now
 have the following flow.

 1. User visits ViewForm.action.
 2. User submits the form and we go to AddData.action
 3. If the data validated okay, we send the user on to ViewData.action,
 otherwise, we send them back to ViewForm.action.

 And in XML it looks something like:

 action name=AddData class=action.AddDataAction
 result name=success
 type=redirectViewData.action?id=%{dataId}/result
 result name=input type=redirectViewForm.action/result
 /action

 The problem is, as Hernan stated, that I now lose all my ActionErrors
 that
 were added to the stack. So the page redirects ok, but now if the user
 entered bad data, I can't send messages back to them 
 to tell them what went wrong. Again, this seems like something that
 should
 be a common goal, but I can't seem to find the right way to do it. Does
 anyone have any suggestions?

 Thanks,
 Tim

 Timothy Orme wrote:
 Ok, this helps a lot. Simply from a usability standpoint though, the 
 latter example seems more in line with what I'd want. It seems silly to 
 have to bring the user to a page where, in my case, they would 
 invariably click a link. I was aware of the TokenSession interceptor, 
 and as you stated, it does fix the issue, but I was more curious about 
 the best practice.

 Thanks,
 Tim

 hernan gonzalez wrote:
 To avoid the problem of duplicated submissions (not only when
 refreshing the result page, but also when double clicking the submit
 button, or going back to the submited form and submitting again) you
 should take a look at  the TokenSessionStoreInterceptor.

 But that is complementary with the other issue: it is not bad practice
 to separate the actions addData  from the action viewData, the
 later is idempotent , the former is not. Hence, you might implement
 two separate Actions (or a same Action with two methods that return
 different results). For example

 -
  

 action name=SubmitData class=action.SubmitDataAction
 result name=success/viewSubmitResult.jsp/result
 /action

 action name=ViewData class=action.ViewDataAction
 result name=success/viewData.jsp/result
 /action

 (Here SubmitDataAction should include the Token interceptor to avoid
 double submissions. And /viewSubmitResult.jsp might just show a
 generic succes message with a link to the ViewDataAction action)

 
  


 or

 action name=SubmitData class=action.SubmitDataAction
 result name=success
 type=redirectViewDataAction.do?id=%{dataId}/result
 /action

 action name=ViewData class=action.ViewDataAction
 result name=success/viewData.jsp/result
 /action

 (This is a little more straightforward, but has the slight
 disadvantage of losing any ActionMessage you might have produced in
 the SubmitDataAction)

 ---
  


 Hernán J. González
 http://hjg.com.ar/

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org

 -
 

Re: Best Practices for Forms

2009-03-17 Thread Timothy Orme

Awesome, thank you!

Greg Lindholm wrote:

Well that's about the most common question one sees on this list.
Check this out:

http://struts.apache.org/2.1.6/docs/how-do-we-repopulate-controls-when-validation-fails.html


Timothy Orme wrote:

Hi Greg,

Thanks, I actually just stumbled across this. I'm actually having some
problems with it however.

I have it setup as follows:

action name=ViewForm class=ViewFormAction
interceptor-ref name=redirectStack /
result name=success/form.jsp?id=${id}/result
result name=input/form.jsp?id=${id}/result
/action

action name=AddData class=AddDataAction
interceptor-ref name=redirectStack /
result name=success type=redirectViewData.action?id=${id}/result
result name=input type=redirectViewForm.action?id=${id}/result
/action

This comes close to working. If the user enters bad data, I get moved from
the AddData action back to the ViewForm action, and the action errors are
there, but now the dynamic parts of the form are 
not present. After debugging this, I see that when the user enters bad

data, it hits the validate method of the AddData action, but never hits
the execute() method of view form. What am I doing wrong?

Thanks,
Tim

Greg Lindholm wrote:

To preserve your action errors and messages across a redirect you can use
this interceptor.

http://glindholm.wordpress.com/2008/07/02/preserving-messages-across-a-redirect-in-struts-2/


Timothy Orme wrote:

Sorry to revive an old thread here, but I've run into another issue with
this.

I decided to go with the second of Hernan's recommendations here, so I
now
have the following flow.

1. User visits ViewForm.action.
2. User submits the form and we go to AddData.action
3. If the data validated okay, we send the user on to ViewData.action,
otherwise, we send them back to ViewForm.action.

And in XML it looks something like:

action name=AddData class=action.AddDataAction
result name=success
type=redirectViewData.action?id=%{dataId}/result
result name=input type=redirectViewForm.action/result
/action

The problem is, as Hernan stated, that I now lose all my ActionErrors
that
were added to the stack. So the page redirects ok, but now if the user
entered bad data, I can't send messages back to them 
to tell them what went wrong. Again, this seems like something that

should
be a common goal, but I can't seem to find the right way to do it. Does
anyone have any suggestions?

Thanks,
Tim

Timothy Orme wrote:
Ok, this helps a lot. Simply from a usability standpoint though, the 
latter example seems more in line with what I'd want. It seems silly to 
have to bring the user to a page where, in my case, they would 
invariably click a link. I was aware of the TokenSession interceptor, 
and as you stated, it does fix the issue, but I was more curious about 
the best practice.


Thanks,
Tim

hernan gonzalez wrote:

To avoid the problem of duplicated submissions (not only when
refreshing the result page, but also when double clicking the submit
button, or going back to the submited form and submitting again) you
should take a look at  the TokenSessionStoreInterceptor.

But that is complementary with the other issue: it is not bad practice
to separate the actions addData  from the action viewData, the
later is idempotent , the former is not. Hence, you might implement
two separate Actions (or a same Action with two methods that return
different results). For example

- 


action name=SubmitData class=action.SubmitDataAction
result name=success/viewSubmitResult.jsp/result
/action

action name=ViewData class=action.ViewDataAction
result name=success/viewData.jsp/result
/action

(Here SubmitDataAction should include the Token interceptor to avoid
double submissions. And /viewSubmitResult.jsp might just show a
generic succes message with a link to the ViewDataAction action)

 



or

action name=SubmitData class=action.SubmitDataAction
result name=success
type=redirectViewDataAction.do?id=%{dataId}/result
/action

action name=ViewData class=action.ViewDataAction
result name=success/viewData.jsp/result
/action

(This is a little more straightforward, but has the slight
disadvantage of losing any ActionMessage you might have produced in
the SubmitDataAction)

--- 



Hernán J. González
http://hjg.com.ar/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


-
To unsubscribe, e-mail: 

Re: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Musachy Barroso
can you try the new filters?

 filter
filter-namestruts-prepare/filter-name

filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter/filter-class
/filter

filter
filter-namestruts-execute/filter-name

filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter/filter-class
/filter

   filter-mapping
filter-namestruts-prepare/filter-name
url-pattern/*/url-pattern
/filter-mapping

filter-mapping
filter-namestruts-execute/filter-name
url-pattern/*/url-pattern
/filter-mapping


musachy

On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin bd...@claritas.com wrote:
 Musachy,

 The web.xml is very simple since we just started this project. Here it is. 
 Please advise:


 ?xml version = '1.0' encoding = 'windows-1252'?
 web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 
 xmlns=http://java.sun.com/xml/ns/j2ee;
    descriptionNew MMS Website/description

    filter
        filter-namestruts2/filter-name
        filter-class
            org.apache.struts2.dispatcher.FilterDispatcher
        /filter-class
    /filter
    filter-mapping
        filter-namestruts2/filter-name
        url-pattern/*/url-pattern
    /filter-mapping
    session-config
        session-timeout240/session-timeout
    /session-config
    mime-mapping
        extensionhtml/extension
        mime-typetext/html/mime-type
    /mime-mapping
    mime-mapping
        extensiontxt/extension
        mime-typetext/plain/mime-type
    /mime-mapping
 /web-app

 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 4:17 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

 Something is very wrong in your configuration. Can you post your web.xml?

 musachy

 On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin bd...@claritas.com wrote:
 Thanks for the response.

 I did that. The request obtained by implementing RequestAware is the same as 
 the one obtained from ServletActionRequest.getRequest().

 None of them worked. Actually, I did get the parameter map from the request, 
 and it contained null data.

 Have you tried the scenario, did it work for your application?

 -Original Message-
 From: Struts Two [mailto:struts...@yahoo.ca]
 Sent: Tuesday, March 17, 2009 3:46 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2


 Why do n't you let your action implement RequestAware interface and then get 
 parameter from the request map.

 --- On Tue, 3/17/09, Duan, Bin bd...@claritas.com wrote:

 From: Duan, Bin bd...@claritas.com
 Subject: Problem getting request parameters in HTTP GET in Struts 2
 To: user@struts.apache.org
 Received: Tuesday, March 17, 2009, 7:01 PM
 I was trying to get a parameter from
 a Http GET. The get from jsp looks
 like this:

 a
 href=/providerDetail.action?drProviderId=1000Provider
 Name

 The providerDetail.action maps to ProviderAction class. In
 the action
 class, I have a setDrProviderId() method, but found the id
 was not set.
 Then I tried to get the id from
 ServletActionRequest.getRequest().getParameter(drProviderId),
 but
 still did not get anything.



 I debugged the code, in the request object, I saw request
 input as GET
 /providerDetail.action?drProviderId=1000, this pretty much
 meant the
 parameter was sent to the server side correctly. But
 request.getParameter(drProviderId) returned me null.



 If I switch to use form POST, my setDrProviderId() method
 was still NOT
 called, but I could get the id from
 request.getParameter(drProviderId).



 This problem will almost be a show stopper for our project
 to use
 Struts. Anybody has any ideas of what could be wrong?



 I am using Struts 2.1.6. I tried both on oc4j and JBoss.







 Following is my struts.xml file





 struts



     package name=dataReceiving
 extends=struts-default



         action name=listProvider
 method=listProvider


 class=com.claritas.mms.radish.dataReceiving.DrProviderAction


 result/dataReceiving/ProviderList.jsp/result

         /action

         action
 name=providerDetail method=providerDetail


 class=com.claritas.mms.radish.dataReceiving.DrProviderAction


 result/dataReceiving/ProviderDetails.jsp/result

         /action

     /package



 /struts



 Following is my DrProviderAction class



     public void setDrProviderId(String id)

     {

         this.drProviderId = new
 Integer(id).intValue();

 }



     public String providerDetail()

     {

         Map map =
 request.getParameterMap();



         String sid =
 request.getParameter(drProviderId);

         drProviderId = new
 Integer(sid).intValue();

         //check if the

         if(session != null)

         {

             MapInteger,
 DrProvider providerMap =
 

Re: Type conversion exceptions

2009-03-17 Thread Lukasz Lenart
2009/3/16 ryangr grigg...@gmail.com:
 com.opensymphony.xwork2.util.XWorkConverter  - processing conversion file
 [com/rjssoft/webdocs/admin/SettingAction-conversion.properties] [class=class
 com.rjssoft.webdocs.admin.SettingAction]

As I see you have only SettingAction-conversion.properties, could you
try to use global xwork-conversion.properties?

http://struts.apache.org/2.x/docs/type-conversion.html#TypeConversion-ApplyingaTypeConverterforanapplication


Regards
-- 
Lukasz
http://www.lenart.org.pl/

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Musachy Barroso
Why don't you try the blank application or showcase? if they work,
then at least you know it is not some container config, but your app.

musachy

On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin bd...@claritas.com wrote:
 It doesn't work. I still get null for the parameter.

 Some additional info. The request is actually a StrutsRequestWrapper 
 instance. I did the debug, the whole http content on the server side looks 
 like this. You can see the drProviderId is in the get.

 GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: image/gif, 
 image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, 
 application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, 
 application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, 
 application/x-ms-application, application/x-silverlight, 
 application/x-silverlight-2-b2, */*6

 I called request.getRequestURI(), the result is /providerDetail.action. It 
 missed the parameter section.

 Another thought where might be the problem?

 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 4:32 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

 can you try the new filters?

     filter
        filter-namestruts-prepare/filter-name
        
 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter/filter-class
    /filter

    filter
        filter-namestruts-execute/filter-name
        
 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter/filter-class
    /filter

   filter-mapping
        filter-namestruts-prepare/filter-name
        url-pattern/*/url-pattern
    /filter-mapping

    filter-mapping
        filter-namestruts-execute/filter-name
        url-pattern/*/url-pattern
    /filter-mapping


 musachy

 On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin bd...@claritas.com wrote:
 Musachy,

 The web.xml is very simple since we just started this project. Here it is. 
 Please advise:


 ?xml version = '1.0' encoding = 'windows-1252'?
 web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 
 xmlns=http://java.sun.com/xml/ns/j2ee;
    descriptionNew MMS Website/description

    filter
        filter-namestruts2/filter-name
        filter-class
            org.apache.struts2.dispatcher.FilterDispatcher
        /filter-class
    /filter
    filter-mapping
        filter-namestruts2/filter-name
        url-pattern/*/url-pattern
    /filter-mapping
    session-config
        session-timeout240/session-timeout
    /session-config
    mime-mapping
        extensionhtml/extension
        mime-typetext/html/mime-type
    /mime-mapping
    mime-mapping
        extensiontxt/extension
        mime-typetext/plain/mime-type
    /mime-mapping
 /web-app

 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 4:17 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

 Something is very wrong in your configuration. Can you post your web.xml?

 musachy

 On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin bd...@claritas.com wrote:
 Thanks for the response.

 I did that. The request obtained by implementing RequestAware is the same 
 as the one obtained from ServletActionRequest.getRequest().

 None of them worked. Actually, I did get the parameter map from the 
 request, and it contained null data.

 Have you tried the scenario, did it work for your application?

 -Original Message-
 From: Struts Two [mailto:struts...@yahoo.ca]
 Sent: Tuesday, March 17, 2009 3:46 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2


 Why do n't you let your action implement RequestAware interface and then 
 get parameter from the request map.

 --- On Tue, 3/17/09, Duan, Bin bd...@claritas.com wrote:

 From: Duan, Bin bd...@claritas.com
 Subject: Problem getting request parameters in HTTP GET in Struts 2
 To: user@struts.apache.org
 Received: Tuesday, March 17, 2009, 7:01 PM
 I was trying to get a parameter from
 a Http GET. The get from jsp looks
 like this:

 a
 href=/providerDetail.action?drProviderId=1000Provider
 Name

 The providerDetail.action maps to ProviderAction class. In
 the action
 class, I have a setDrProviderId() method, but found the id
 was not set.
 Then I tried to get the id from
 ServletActionRequest.getRequest().getParameter(drProviderId),
 but
 still did not get anything.



 I debugged the code, in the request object, I saw request
 input as GET
 /providerDetail.action?drProviderId=1000, this pretty much
 meant the
 parameter was sent to the server side correctly. But
 request.getParameter(drProviderId) returned me null.



 If I switch to use form POST, my setDrProviderId() method
 was still NOT
 called, but I 

Re: Struts 2 Container Security problem

2009-03-17 Thread pblatner

I installed the latest fix pack for WebSphere, bringing my version up to
6.1.0.21 and it did the trick.  The Web container authentication now works
as I expected it to.  

Thanks for the feedback.
Pete.


pblatner wrote:
 
 I don't see how this fix applies to the problem I mentioned below: 
 http://www-01.ibm.com/support/docview.wss?rs=180uid=swg1PK31377
 
 The text there doesn't say anything about resolving an issue where
 WebSphere doesn't seem to be recognizing servlet filters as resources to
 secure using web container authentication.
 
 
 Musachy Barroso wrote:
 
 Just as a reference, there is a ticket open for this:
 
 https://issues.apache.org/struts/browse/WW-2642
 
 musachy
 
 On Mon, Mar 16, 2009 at 5:37 PM, Struts Two struts...@yahoo.ca wrote:

 There is a problem running Struts 2.1.6 on Websphere when security is
 enabled. The case happens when url is an action not a resource like jsp
 or html. Refer to JIRA WW-2642 that I opened almost a year ago.

 I was hoping that Apache group can get their hands on Websphere to
 verify the issue but it seems like a distant probability as I have not
 heard any news on that for sometime.

 But on the bright site, there may be some good news on this soon. As I
 had to locate WAS L3 support in person and I am working with them on
 this issue [though the pace is slow].

 Also keep in mind, the same issue exists on WAS 7.0.0.1 with a slight
 variation. If this is determined to be a Websphere problem with WAS 6.1.
 Then I have a stronger case to press issue for WAS 7.0.

 --- On Mon, 3/16/09, pblatner pblat...@gmail.com wrote:

 From: pblatner pblat...@gmail.com
 Subject: Re: Struts 2 Container Security problem
 To: user@struts.apache.org
 Received: Monday, March 16, 2009, 9:05 PM

 I have tried to do the exact thing that Jeromy suggests
 below with 2
 packages.  And then in the web.xml specify a security
 constraint with the
 URL pattern /protected/*.  After doing so, I am not
 getting the result
 that I think I should be.

 When issuing a request for my action at
 http://localhost/MyApp/protected/HomeAction;, the
 container is not
 intercepting and challenging me with my logon.html page.

 Anyone know why this isn't working?

 The struts 2 servlet-filter pattern is /*..  It seems
 pretty obvious that
 the struts 2 servlet filter is responding to the first part
 of the URL:
 http://localhost/MyApp/*; and the container isn't
 seeing that as a secured
 resource.

 Am I missing a configuration pattern somewhere that tells
 the container to
 inspect the full URL before allowing the servlet filter to
 process it?

 My deployment environment is WebSphere 6.1.  Are there
 any incompatibilities
 between WebSphere 6.1 and struts 2 that could be causing
 this?

 Thanks,
 Pete.


 Jeromy Evans - Blue Sky Minds wrote:
 
  In struts.xml, the namespace given to your package
 needs be in
  /protected as well.
  eg. package name=myPackage
 namespace=/protected
  Otherwise, as you've seen, it's available in the root
 of the
  application's context path.
 
  I usually split my struts2 application into at least
 two packages:
  package name=public namespace=/ ...
  package name=secure namespace=/protected
 

 --
 View this message in context:
 http://www.nabble.com/Struts-2-Container-Security-problem-tp15571409p22547426.html
 Sent from the Struts - User mailing list archive at
 Nabble.com.


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




      __
 Instant Messaging, free SMS, sharing photos and more... Try the new
 Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/


 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org


 
 
 
 -- 
 Hey you! Would you help me to carry the stone? Pink Floyd
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Struts-2-Container-Security-problem-tp15571409p22568026.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Type conversion exceptions

2009-03-17 Thread ryangr

If I do that, then there will be two lines as such in the properties file:

com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting
com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.converter.SettingListConverter

How will it know the difference? I followed the documentation where it said
to use () instead of [] which was apparently wrong, now putting
com.rjssoft.webdocs.setting.SettingList=com.rjssoft.webdocs.setting.Setting
instead of Element_settings like the examples...neither way works and this
is getting frustrating. :(

Making this change (with or without the second line) simply causes
exceptions to be thrown setting each of the 3 attributes:

ERROR com.opensymphony.xwork2.util.InstantiatingNullHandler  - Could not
create and/or set value back on to object
ognl.OgnlException: settings [java.lang.IllegalArgumentException: argument
type mismatch]

ERROR com.opensymphony.xwork2.interceptor.ParametersInterceptor  -
ParametersInterceptor - [setParameters]: Unexpected Exception caught setting
'settings[0].title' on 'class com.rjssoft.webdocs.admin.SettingAction: Error
setting expression 'settings[0].title' with value
'[Ljava.lang.String;@13acc52'


Ryan



Lukasz Lenart wrote:
 
 2009/3/17 ryangr grigg...@gmail.com:
 Element_settings=com.rjssoft.webdocs.setting.Setting
 
 But you should put there
 com.rjssoft.webdocs.setting.SettingList =
 com.rjssoft.webdocs.setting.Setting
 
 
 Regards
 -- 
 Lukasz
 http://www.lenart.org.pl/
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Type-conversion-exceptions-tp22497261p22568375.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Duan, Bin
We found a post in the mailing list that reported the same problem. Check it 
out. The final solution of it was that the user had to implement a customized 
map class, which was pretty nasty. Is this something we have to go through, or 
is there better solution? Is this a bug in S2? Check it out.

http://www.mail-archive.com/user@struts.apache.org/msg64440.html

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com] 
Sent: Tuesday, March 17, 2009 5:12 PM
To: Struts Users Mailing List
Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

Why don't you try the blank application or showcase? if they work,
then at least you know it is not some container config, but your app.

musachy

On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin bd...@claritas.com wrote:
 It doesn't work. I still get null for the parameter.

 Some additional info. The request is actually a StrutsRequestWrapper 
 instance. I did the debug, the whole http content on the server side looks 
 like this. You can see the drProviderId is in the get.

 GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: image/gif, 
 image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, 
 application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, 
 application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, 
 application/x-ms-application, application/x-silverlight, 
 application/x-silverlight-2-b2, */*6

 I called request.getRequestURI(), the result is /providerDetail.action. It 
 missed the parameter section.

 Another thought where might be the problem?

 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 4:32 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

 can you try the new filters?

     filter
        filter-namestruts-prepare/filter-name
        
 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter/filter-class
    /filter

    filter
        filter-namestruts-execute/filter-name
        
 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter/filter-class
    /filter

   filter-mapping
        filter-namestruts-prepare/filter-name
        url-pattern/*/url-pattern
    /filter-mapping

    filter-mapping
        filter-namestruts-execute/filter-name
        url-pattern/*/url-pattern
    /filter-mapping


 musachy

 On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin bd...@claritas.com wrote:
 Musachy,

 The web.xml is very simple since we just started this project. Here it is. 
 Please advise:


 ?xml version = '1.0' encoding = 'windows-1252'?
 web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 
 xmlns=http://java.sun.com/xml/ns/j2ee;
    descriptionNew MMS Website/description

    filter
        filter-namestruts2/filter-name
        filter-class
            org.apache.struts2.dispatcher.FilterDispatcher
        /filter-class
    /filter
    filter-mapping
        filter-namestruts2/filter-name
        url-pattern/*/url-pattern
    /filter-mapping
    session-config
        session-timeout240/session-timeout
    /session-config
    mime-mapping
        extensionhtml/extension
        mime-typetext/html/mime-type
    /mime-mapping
    mime-mapping
        extensiontxt/extension
        mime-typetext/plain/mime-type
    /mime-mapping
 /web-app

 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 4:17 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

 Something is very wrong in your configuration. Can you post your web.xml?

 musachy

 On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin bd...@claritas.com wrote:
 Thanks for the response.

 I did that. The request obtained by implementing RequestAware is the same 
 as the one obtained from ServletActionRequest.getRequest().

 None of them worked. Actually, I did get the parameter map from the 
 request, and it contained null data.

 Have you tried the scenario, did it work for your application?

 -Original Message-
 From: Struts Two [mailto:struts...@yahoo.ca]
 Sent: Tuesday, March 17, 2009 3:46 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 2


 Why do n't you let your action implement RequestAware interface and then 
 get parameter from the request map.

 --- On Tue, 3/17/09, Duan, Bin bd...@claritas.com wrote:

 From: Duan, Bin bd...@claritas.com
 Subject: Problem getting request parameters in HTTP GET in Struts 2
 To: user@struts.apache.org
 Received: Tuesday, March 17, 2009, 7:01 PM
 I was trying to get a parameter from
 a Http GET. The get from jsp looks
 like this:

 a
 href=/providerDetail.action?drProviderId=1000Provider
 Name

 The providerDetail.action maps to 

Re: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Dave Newton

What's the action mapping look like (along with its package definition)?

Dave

Duan, Bin wrote:

We found a post in the mailing list that reported the same problem. Check it 
out. The final solution of it was that the user had to implement a customized 
map class, which was pretty nasty. Is this something we have to go through, or 
is there better solution? Is this a bug in S2? Check it out.

http://www.mail-archive.com/user@struts.apache.org/msg64440.html

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com] 
Sent: Tuesday, March 17, 2009 5:12 PM

To: Struts Users Mailing List
Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

Why don't you try the blank application or showcase? if they work,
then at least you know it is not some container config, but your app.

musachy

On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin bd...@claritas.com wrote:

It doesn't work. I still get null for the parameter.

Some additional info. The request is actually a StrutsRequestWrapper instance. 
I did the debug, the whole http content on the server side looks like this. You 
can see the drProviderId is in the get.

GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: image/gif, 
image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, 
application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, 
application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, 
application/x-ms-application, application/x-silverlight, 
application/x-silverlight-2-b2, */*6

I called request.getRequestURI(), the result is /providerDetail.action. It 
missed the parameter section.

Another thought where might be the problem?

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com]
Sent: Tuesday, March 17, 2009 4:32 PM
To: Struts Users Mailing List
Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

can you try the new filters?

filter
   filter-namestruts-prepare/filter-name
   
filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter/filter-class
   /filter

   filter
   filter-namestruts-execute/filter-name
   
filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter/filter-class
   /filter

  filter-mapping
   filter-namestruts-prepare/filter-name
   url-pattern/*/url-pattern
   /filter-mapping

   filter-mapping
   filter-namestruts-execute/filter-name
   url-pattern/*/url-pattern
   /filter-mapping


musachy

On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin bd...@claritas.com wrote:

Musachy,

The web.xml is very simple since we just started this project. Here it is. 
Please advise:


?xml version = '1.0' encoding = 'windows-1252'?
web-app xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; 
version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
   descriptionNew MMS Website/description

   filter
   filter-namestruts2/filter-name
   filter-class
   org.apache.struts2.dispatcher.FilterDispatcher
   /filter-class
   /filter
   filter-mapping
   filter-namestruts2/filter-name
   url-pattern/*/url-pattern
   /filter-mapping
   session-config
   session-timeout240/session-timeout
   /session-config
   mime-mapping
   extensionhtml/extension
   mime-typetext/html/mime-type
   /mime-mapping
   mime-mapping
   extensiontxt/extension
   mime-typetext/plain/mime-type
   /mime-mapping
/web-app

-Original Message-
From: Musachy Barroso [mailto:musa...@gmail.com]
Sent: Tuesday, March 17, 2009 4:17 PM
To: Struts Users Mailing List
Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

Something is very wrong in your configuration. Can you post your web.xml?

musachy

On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin bd...@claritas.com wrote:

Thanks for the response.

I did that. The request obtained by implementing RequestAware is the same as 
the one obtained from ServletActionRequest.getRequest().

None of them worked. Actually, I did get the parameter map from the request, 
and it contained null data.

Have you tried the scenario, did it work for your application?

-Original Message-
From: Struts Two [mailto:struts...@yahoo.ca]
Sent: Tuesday, March 17, 2009 3:46 PM
To: Struts Users Mailing List
Subject: Re: Problem getting request parameters in HTTP GET in Struts 2


Why do n't you let your action implement RequestAware interface and then get 
parameter from the request map.

--- On Tue, 3/17/09, Duan, Bin bd...@claritas.com wrote:


From: Duan, Bin bd...@claritas.com
Subject: Problem getting request parameters in HTTP GET in Struts 2
To: user@struts.apache.org
Received: Tuesday, March 17, 2009, 7:01 PM
I was trying to get a parameter from
a Http GET. The get from jsp looks
like this:

a
href=/providerDetail.action?drProviderId=1000Provider
Name

The providerDetail.action maps to 

RE: Problem getting request parameters in HTTP GET in Struts 2

2009-03-17 Thread Relph,Brian

First, the post you referenced had a follow up a few days later, and the custom 
mapper was not actually needed, there was instead a bug in the oracle app 
server that was fixed in a later release.

Second, let struts handle the type conversion for you.  You don't need to 
convert from a string to an integer, it will be done automatically if the 
parameter names matches the bean property. 

Brian Relph

-Original Message-
From: Dave Newton [mailto:newton.d...@yahoo.com] 
Sent: Tuesday, March 17, 2009 6:05 PM
To: Struts Users Mailing List
Subject: Re: Problem getting request parameters in HTTP GET in Struts 2

What's the action mapping look like (along with its package definition)?

Dave

Duan, Bin wrote:
 We found a post in the mailing list that reported the same problem. Check it 
 out. The final solution of it was that the user had to implement a customized 
 map class, which was pretty nasty. Is this something we have to go through, 
 or is there better solution? Is this a bug in S2? Check it out.
 
 http://www.mail-archive.com/user@struts.apache.org/msg64440.html
 
 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 5:12 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 
 2
 
 Why don't you try the blank application or showcase? if they work, 
 then at least you know it is not some container config, but your app.
 
 musachy
 
 On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin bd...@claritas.com wrote:
 It doesn't work. I still get null for the parameter.

 Some additional info. The request is actually a StrutsRequestWrapper 
 instance. I did the debug, the whole http content on the server side looks 
 like this. You can see the drProviderId is in the get.

 GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: 
 image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
 application/x-shockwave-flash, application/vnd.ms-excel, 
 application/vnd.ms-powerpoint, application/msword, 
 application/xaml+xml, application/vnd.ms-xpsdocument, 
 application/x-ms-xbap, application/x-ms-application, 
 application/x-silverlight, application/x-silverlight-2-b2, */*6

 I called request.getRequestURI(), the result is /providerDetail.action. It 
 missed the parameter section.

 Another thought where might be the problem?

 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 4:32 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in Struts 
 2

 can you try the new filters?

 filter
filter-namestruts-prepare/filter-name

 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter/filter-class
/filter

filter
filter-namestruts-execute/filter-name

 filter-classorg.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter/filter-class
/filter

   filter-mapping
filter-namestruts-prepare/filter-name
url-pattern/*/url-pattern
/filter-mapping

filter-mapping
filter-namestruts-execute/filter-name
url-pattern/*/url-pattern
/filter-mapping


 musachy

 On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin bd...@claritas.com wrote:
 Musachy,

 The web.xml is very simple since we just started this project. Here it is. 
 Please advise:


 ?xml version = '1.0' encoding = 'windows-1252'? web-app 
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 
 xmlns=http://java.sun.com/xml/ns/j2ee;
descriptionNew MMS Website/description

filter
filter-namestruts2/filter-name
filter-class
org.apache.struts2.dispatcher.FilterDispatcher
/filter-class
/filter
filter-mapping
filter-namestruts2/filter-name
url-pattern/*/url-pattern
/filter-mapping
session-config
session-timeout240/session-timeout
/session-config
mime-mapping
extensionhtml/extension
mime-typetext/html/mime-type
/mime-mapping
mime-mapping
extensiontxt/extension
mime-typetext/plain/mime-type
/mime-mapping
 /web-app

 -Original Message-
 From: Musachy Barroso [mailto:musa...@gmail.com]
 Sent: Tuesday, March 17, 2009 4:17 PM
 To: Struts Users Mailing List
 Subject: Re: Problem getting request parameters in HTTP GET in 
 Struts 2

 Something is very wrong in your configuration. Can you post your web.xml?

 musachy

 On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin bd...@claritas.com wrote:
 Thanks for the response.

 I did that. The request obtained by implementing RequestAware is the same 
 as the one obtained from ServletActionRequest.getRequest().

 None of them worked. Actually, I did get the parameter map from the 
 request, and it contained null data.

 Have you tried the scenario, did it work for your application?

 

Re: Struts 2 Container Security problem

2009-03-17 Thread Struts Two

Are you able to Access a URL that goes to an action directly? I myself have 
Websphere 6.1.0.21 for my RAD 7.5 and I am not able to do so. 
Hm...I am going to try this on our AIX test servers to double 
check. 

--- On Tue, 3/17/09, pblatner pblat...@gmail.com wrote:

 From: pblatner pblat...@gmail.com
 Subject: Re: Struts 2 Container Security problem
 To: user@struts.apache.org
 Received: Tuesday, March 17, 2009, 9:20 PM
 
 I installed the latest fix pack for WebSphere, bringing my
 version up to
 6.1.0.21 and it did the trick.  The Web container
 authentication now works
 as I expected it to.  
 
 Thanks for the feedback.
 Pete.
 
 
 pblatner wrote:
  
  I don't see how this fix applies to the problem I
 mentioned below: 
  http://www-01.ibm.com/support/docview.wss?rs=180uid=swg1PK31377
  
  The text there doesn't say anything about resolving an
 issue where
  WebSphere doesn't seem to be recognizing servlet
 filters as resources to
  secure using web container authentication.
  
  
  Musachy Barroso wrote:
  
  Just as a reference, there is a ticket open for
 this:
  
  https://issues.apache.org/struts/browse/WW-2642
  
  musachy
  
  On Mon, Mar 16, 2009 at 5:37 PM, Struts Two struts...@yahoo.ca
 wrote:
 
  There is a problem running Struts 2.1.6 on
 Websphere when security is
  enabled. The case happens when url is an
 action not a resource like jsp
  or html. Refer to JIRA WW-2642 that I opened
 almost a year ago.
 
  I was hoping that Apache group can get their
 hands on Websphere to
  verify the issue but it seems like a distant
 probability as I have not
  heard any news on that for sometime.
 
  But on the bright site, there may be some good
 news on this soon. As I
  had to locate WAS L3 support in person and I
 am working with them on
  this issue [though the pace is slow].
 
  Also keep in mind, the same issue exists on
 WAS 7.0.0.1 with a slight
  variation. If this is determined to be a
 Websphere problem with WAS 6.1.
  Then I have a stronger case to press issue for
 WAS 7.0.
 
  --- On Mon, 3/16/09, pblatner pblat...@gmail.com
 wrote:
 
  From: pblatner pblat...@gmail.com
  Subject: Re: Struts 2 Container Security
 problem
  To: user@struts.apache.org
  Received: Monday, March 16, 2009, 9:05 PM
 
  I have tried to do the exact thing that
 Jeromy suggests
  below with 2
  packages.  And then in the web.xml
 specify a security
  constraint with the
  URL pattern /protected/*.  After doing
 so, I am not
  getting the result
  that I think I should be.
 
  When issuing a request for my action at
  http://localhost/MyApp/protected/HomeAction;, the
  container is not
  intercepting and challenging me with my
 logon.html page.
 
  Anyone know why this isn't working?
 
  The struts 2 servlet-filter pattern is
 /*..  It seems
  pretty obvious that
  the struts 2 servlet filter is responding
 to the first part
  of the URL:
  http://localhost/MyApp/*; and the
 container isn't
  seeing that as a secured
  resource.
 
  Am I missing a configuration pattern
 somewhere that tells
  the container to
  inspect the full URL before allowing the
 servlet filter to
  process it?
 
  My deployment environment is WebSphere
 6.1.  Are there
  any incompatibilities
  between WebSphere 6.1 and struts 2 that
 could be causing
  this?
 
  Thanks,
  Pete.
 
 
  Jeromy Evans - Blue Sky Minds wrote:
  
   In struts.xml, the namespace given to
 your package
  needs be in
   /protected as well.
   eg. package name=myPackage
  namespace=/protected
   Otherwise, as you've seen, it's
 available in the root
  of the
   application's context path.
  
   I usually split my struts2
 application into at least
  two packages:
   package name=public
 namespace=/ ...
   package name=secure
 namespace=/protected
  
 
  --
  View this message in context:
  http://www.nabble.com/Struts-2-Container-Security-problem-tp15571409p22547426.html
  Sent from the Struts - User mailing list
 archive at
  Nabble.com.
 
 
 
 -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 
     
  __
  Instant Messaging, free SMS, sharing photos
 and more... Try the new
  Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/
 
 
 
 -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
  
  
  
  -- 
  Hey you! Would you help me to carry the stone?
 Pink Floyd
  
 
 -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
  
  
  
  
  
 
 -- 
 View this message in context: 
 

Re: Web Services

2009-03-17 Thread Miguel
You may take a look at Spring-WS. Remoting is like RMI over http,
meanwhile Spring-WS is a contract-first approach.

Si quieres ser más positivo, pierde un electrón
Miguel Ruiz Velasco S.



On Tue, Mar 17, 2009 at 09:02, Griffith, Michael *
michael.griff...@fda.hhs.gov wrote:
 Spring has excellent remoting abilities. If you are already using
 Spring, I'd check out Spring Remoting as my first option.

 -Original Message-
 From: Rafael Taboada [mailto:kaliman.fore...@gmail.com]
 Sent: Tuesday, March 17, 2009 7:39 AM
 To: user@struts.apache.org
 Subject: Web Services

 Hi list!

 I have a Struts2+Dojo+JPA+Spring project working fine in a production
 environment, but suddenly I have the requirement of exposing web
 services from my project. I mean, I need to implement web services about
 my project funcionality which other systems can consume.

 I'm completely new at web services. Please can you guide me how I can
 implement web services? Would Spring Web Services be a good point to
 start?

 Thanks in advance for your help!

 --
 Rafael Taboada

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Web Services

2009-03-17 Thread Martin Gainty

WebService(s) allow client to consume published services identified by WSDL 
contract

some of the older RMI implementations default to CORBA (not configured on most 
machines by default) ..personally i prefer RPC

the more recent versions of Axis are moving to doc-literal and away from RPC..
Spring is powerful (i've used it primarily as a SessionFactory..) i have'nt seen
any web-services deployed thru Spring Framework..would appreciate a touchback 
on anyone who has used Spring for Web-Service deployment

thanks,
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung / Disclaimer and confidentiality note 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
This message is confidential and may be privileged. If you are not the intended 
recipient, we kindly ask you to  please inform the sender. Any unauthorised 
dissemination or copying hereof is prohibited. This message serves for 
information purposes only and shall not have any legally binding effect. Given 
that e-mails can easily be subject to manipulation, we can not accept any 
liability for the content provided.






 Date: Tue, 17 Mar 2009 19:03:16 -0600
 Subject: Re: Web Services
 From: miguel...@gmail.com
 To: user@struts.apache.org
 
 You may take a look at Spring-WS. Remoting is like RMI over http,
 meanwhile Spring-WS is a contract-first approach.
 
 Si quieres ser más positivo, pierde un electrón
 Miguel Ruiz Velasco S.
 
 
 
 On Tue, Mar 17, 2009 at 09:02, Griffith, Michael *
 michael.griff...@fda.hhs.gov wrote:
  Spring has excellent remoting abilities. If you are already using
  Spring, I'd check out Spring Remoting as my first option.
 
  -Original Message-
  From: Rafael Taboada [mailto:kaliman.fore...@gmail.com]
  Sent: Tuesday, March 17, 2009 7:39 AM
  To: user@struts.apache.org
  Subject: Web Services
 
  Hi list!
 
  I have a Struts2+Dojo+JPA+Spring project working fine in a production
  environment, but suddenly I have the requirement of exposing web
  services from my project. I mean, I need to implement web services about
  my project funcionality which other systems can consume.
 
  I'm completely new at web services. Please can you guide me how I can
  implement web services? Would Spring Web Services be a good point to
  start?
 
  Thanks in advance for your help!
 
  --
  Rafael Taboada
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional commands, e-mail: user-h...@struts.apache.org
 
 
 
 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org
 

_
Hotmail® is up to 70% faster. Now good news travels really fast. 
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_HM_70faster_032009

redirect parameters lost when using convention plugin 2.1.6

2009-03-17 Thread John Liptak

I'm in the process of upgrading an app from 2.0.11.2 to 2.1.6.

I've been following the instructions at 
http://cwiki.apache.org/S2WIKI/troubleshooting-guide-migrating-from-struts-20x-to-21x.html#TroubleshootingguidemigratingfromStruts2.0.xto2.1.x-Updatestruts.xmlConfiguration
converting from 2.0 to 2.1 . 

Since we are currently using the zero config plugin, I'm also looking at the
convention plugin 
http://cwiki.apache.org/WW/convention-plugin.html#ConventionPlugin-Resultsandresultcodes
here .

The issue I'm having is that parameters that are set on the redirect are
lost.  I'm getting the OGNL exception that the trouble shooting guide says
I'm supposed to get, but then the parameters are not sent as part of the
redirect.

Things that might be causing issues:
1.) I've kept the naming of the original URLs using @Action annotations
2.) I've set the action extention to only be action and not action,
3.) I'm using Weblogic 10.2

I've tried all of the different ways I know to do a redirect:
1.) Class level using params
@Result(name = redirect, location = pingDestination.action, type =
redirect,
params = { aParam, a parameter } )
2.) Class level using location
 @Result(name = redirect2, location =
/test/pingDestination.action?aParam=${message}, type = redirect )
3.) Action level
   @Action(value = /test/pingRedirect3, 
result...@result(name = redirect, location =
pingDestination.action, type = redirect,
params = { parse , true, aParam, a parameter } )},
params = { parse , true, aParam, another parameter })
public String executeRedirect3() throws Exception {...
4.) I tried two different SNAPSHOT builds of 2.1.7 but the new config
loading and WebLogic don't like each other.

Any ideas?

Here is my struts.xml
!DOCTYPE struts PUBLIC
-//Apache Software Foundation//DTD Struts Configuration 2.0//EN
http://struts.apache.org/dtds/struts-2.0.dtd;
struts
constant name=struts.devMode value=false /
constant name=struts.objectFactory
value=org.apache.struts2.spring.StrutsSpringObjectFactory /
constant name=struts.action.extension value=action /
constant name=struts.convention.result.path value=/ /
constant name=struts.convention.package.locators
value=action,actions,struts,struts2,view /

package name=qcadmin extends=struts-default

global-exception-mappings
exception-mapping exception=java.lang.Exception
result=error/
exception-mapping exception=java.rmi.RemoteException
result=error/
exception-mapping exception=javax.xml.rpc.ServiceException
result=error/
exception-mapping exception=org.apache.xmlbeans.XmlException
result=error/
/global-exception-mappings
   
   action name=ExceptionHandle
result name=error 
type=chain/WEB-INF/common/Error.jsp/result
   /action
/package

package name=mfw extends=qcadmin namespace=/qcadmin/mfw

default-interceptor-ref name=paramsPrepareParamsStack/

/package
/struts
-- 
View this message in context: 
http://www.nabble.com/redirect-parameters-lost-when-using-convention-plugin-2.1.6-tp22572248p22572248.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org