Re: Problem Sumitting Struts Form containing a drop down list html:optionsCollection

2009-11-10 Thread Hanen Ben Rhouma
Morning,

If I give code details, no one will show interest with so much details and
with only the description of my requirement no one also could understand,
that's pretty complicated you know!!

Well, let me represent it with another approach, by screeshots maybe is
better (please take a look at my jsp page shown in the attached screeshot).
By selecting one change ID I'd like to forward my form to another jsp page
representing the details of the selected change (description, change number,
creation date, user, workspace...).

The problem is that I'm either using dojo to code the drop down list from
user side (and the mapping between simple input parameters and a struts
form html:form isn't that trivial to do), or I've tried also to code it
from server side (eventhough it's too slow) by using a struts form
html:form action=someAction containing html:optionsCollection to
represent the dynamic drop down list (here the problem is that
html:optionsCollection will make use of the struts action someAction to
retrieve the data necessary to fill the drop down list and not to code the
form's behavior after submitting it.

Hope that my point is clearer this time, I'll be really grateful if someone
got a clue to all this headache :(((

Regards,
Hanen


On Mon, Nov 9, 2009 at 7:06 PM, Kawczynski, David 
david_kawczyn...@merck.com wrote:

 I'd love to be able to help but am confused with what you are having
 trouble with.  I think I heard something about wanting to modify the
 action of a form based on the value selected in a drop-down.  I also
 heard something about forwarding to another jsp page.  If you can
 clarify your intent you may end up with a good pointer or two.
 :)

  -Original Message-
  From: Hanen Ben Rhouma [mailto:hanen...@gmail.com]
  Sent: Monday, November 09, 2009 12:49 PM
  To: Struts Users Mailing List
  Subject: Problem Sumitting Struts Form containing a drop down
  list html:optionsCollection
 
  Please, I need your help: I've spent more than one week on trying to
 figure out how to submit a struts 1 form containing a drop down list
 (using optionsCollection). The problem is that the items in the
 optionsCollection refer to the action assigned to the form while I need
 that same action to submit my form and trigger the forward to another
 jsp page.  I'm loosing my cool temper in front of such futility, any
 ideas PLEASE???
 Notice:  This e-mail message, together with any attachments, contains
 information of Merck  Co., Inc. (One Merck Drive, Whitehouse Station, New
 Jersey, USA 08889), and/or its affiliates Direct contact information for
 affiliates is available at http://www.merck.com/contact/contacts.html)
 that may be confidential, proprietary copyrighted and/or legally privileged.
 It is intended solely for the use of the individual or entity named on this
 message. If you are not the intended recipient, and have received this
 message in error, please notify us immediately by reply e-mail and then
 delete it from your system.


 -
 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 with Global Exceptions

2009-11-10 Thread RogerV

Could someone just confirm what sort of exception I should be catching to
intercept There is no Action mapped for namespace /secure and action name
errors. I've currently got;

global-exception-mappings
   exception-mapping exception=java.lang.Exception
result=login/
/global-exception-mappings

and 

constant name=struts.devMode value=false /

which I assumed would catch everything, but if I enter gibberish into the
browser url box, I still get the No Action mapped ... message in the
server logs and Tomcats 404 page in the browser. Using
config-browser/index.action confirms that Struts is recognising the mapping,
but it is not catching it.

Regards
-- 
View this message in context: 
http://old.nabble.com/Problem-with-Global-Exceptions-tp26280416p26280416.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



Action tag is forced to use input result if outer action has action errors

2009-11-10 Thread Matt Jiang
Hi All,

I use Sitemesh as template engine with Struts2.
In my decorator jsp file, I use s:action/ for division content source.
Now I encounter a problem that if an action has an action error, there will
be a input result used. It will cause all s:action in decorator JSP file
also execute input result directly. That's means s:action method won't be
called.

How do I make s:action execute its action method no matter its outer
action's result  when using sitemesh together?

thanks a lot.
Matt


Re: Problem Sumitting Struts Form containing a drop down list html:optionsCollection

2009-11-10 Thread Paweł Wielgus
Hi Hanen,
firstly I see no attachements, maybe because they are deleted by
mailing list itself.
Secondly, if the problem You have is hard to explain,
then maybe You have trouble to understand it.

If You want to understand your problem better You need to shrink it to
minimum size,
best if this will be one action, one jsp, and one form.
Then keep in mind that Struts is based on HTTP, that give some restrictions,
and also remember how Struts workflow is done.
Ajax is also based on HTTP and the same restrictions apply.

Then try to describe your problem again,
but before sending it give it to someone else who will read it for You
and check if there is anything thats important.

These all are just general best practises to write a post on mailing list.
Keep in mind that if people doesn't understand your post they simply
tend to skip it,
or if some one like David have more time or more good will they ask
for more details.

At the end, i read your question two times,
and i don't understand what You are trying to achieve,
maybe that's me who is not bright enought,
but that's definitively your problem You want to solve.

Best greetings,
Paweł Wielgus.


2009/11/10 Hanen Ben Rhouma hanen...@gmail.com:
 Morning,

 If I give code details, no one will show interest with so much details and
 with only the description of my requirement no one also could understand,
 that's pretty complicated you know!!

 Well, let me represent it with another approach, by screeshots maybe is
 better (please take a look at my jsp page shown in the attached screeshot).
 By selecting one change ID I'd like to forward my form to another jsp page
 representing the details of the selected change (description, change number,
 creation date, user, workspace...).

 The problem is that I'm either using dojo to code the drop down list from
 user side (and the mapping between simple input parameters and a struts
 form html:form isn't that trivial to do), or I've tried also to code it
 from server side (eventhough it's too slow) by using a struts form
 html:form action=someAction containing html:optionsCollection to
 represent the dynamic drop down list (here the problem is that
 html:optionsCollection will make use of the struts action someAction to
 retrieve the data necessary to fill the drop down list and not to code the
 form's behavior after submitting it.

 Hope that my point is clearer this time, I'll be really grateful if someone
 got a clue to all this headache :(((

 Regards,
 Hanen


 On Mon, Nov 9, 2009 at 7:06 PM, Kawczynski, David
 david_kawczyn...@merck.com wrote:

 I'd love to be able to help but am confused with what you are having
 trouble with.  I think I heard something about wanting to modify the
 action of a form based on the value selected in a drop-down.  I also
 heard something about forwarding to another jsp page.  If you can
 clarify your intent you may end up with a good pointer or two.
 :)

  -Original Message-
  From: Hanen Ben Rhouma [mailto:hanen...@gmail.com]
  Sent: Monday, November 09, 2009 12:49 PM
  To: Struts Users Mailing List
  Subject: Problem Sumitting Struts Form containing a drop down
  list html:optionsCollection
 
  Please, I need your help: I've spent more than one week on trying to
 figure out how to submit a struts 1 form containing a drop down list
 (using optionsCollection). The problem is that the items in the
 optionsCollection refer to the action assigned to the form while I need
 that same action to submit my form and trigger the forward to another
 jsp page.  I'm loosing my cool temper in front of such futility, any
 ideas PLEASE???
 Notice:  This e-mail message, together with any attachments, contains
 information of Merck  Co., Inc. (One Merck Drive, Whitehouse Station, New
 Jersey, USA 08889), and/or its affiliates Direct contact information for
 affiliates is available at http://www.merck.com/contact/contacts.html) that
 may be confidential, proprietary copyrighted and/or legally privileged. It
 is intended solely for the use of the individual or entity named on this
 message. If you are not the intended recipient, and have received this
 message in error, please notify us immediately by reply e-mail and then
 delete it from your system.


 -
 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: Action tag is forced to use input result if outer action has action errors

2009-11-10 Thread Oscar Calderón
Hi Matt, You could add to your action declaration in the struts.xml a
parameter called excluded methods, where you can add the name of the methods
of your action that you don't want to be validated, for example:

interceptor-ref name=yourInterceptor
  param name=excludeMethodsmethodName1,methodName2/param
/interceptor-ref

Even if your interceptor is a default interceptor like workflow or the
interceptor is inside a interceptor stack you can reference it with the same
declaration

interceptor-ref name=stackThatContainsTheInterceptor
  param
name=interceptorName.excludeMethodsmethodName1,methodName2/param
/interceptor-ref


2009/11/10 Matt Jiang matt.ji...@gmail.com

 Hi All,

 I use Sitemesh as template engine with Struts2.
 In my decorator jsp file, I use s:action/ for division content source.
 Now I encounter a problem that if an action has an action error, there will
 be a input result used. It will cause all s:action in decorator JSP
 file
 also execute input result directly. That's means s:action method won't be
 called.

 How do I make s:action execute its action method no matter its outer
 action's result  when using sitemesh together?

 thanks a lot.
 Matt




-- 
Visita mi blog
http://codigo-java.com
http://aeblogs.com/uiq


Re: struts 2 helloWorld example not properly working in tomcat 5.5

2009-11-10 Thread reason

thanks musachy

that was actually my initial attempt but it ran aground (see below) so i
gave up and did it the hard way

[kos...@ares tmp]$ echo $JAVA_HOME;echo;echo;mvn archetype:create  
-DgroupId=tutorial-DartifactId=tutorial 
  
-DarchetypeGroupId=org.apache.struts   
-DarchetypeArtifactId=struts2-archetype-starter   
-DarchetypeVersion=2.0.11   
-DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0


Warning: JAVA_HOME environment variable is not set.
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO]

[INFO] Building Maven Default Project
[INFO]task-segment: [archetype:create] (aggregator-style)
[INFO]

[INFO] Setting property: classpath.resource.loader.class =
'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
[INFO] Setting property: velocimacro.messages.on = 'false'.
[INFO] Setting property: resource.loader = 'classpath'.
[INFO] Setting property: resource.manager.logwhenfound = 'false'.
[INFO] [archetype:create {execution: default-cli}]
[WARNING] This goal is deprecated. Please use mvn archetype:generate instead
[INFO] Defaulting package to group ID: tutorial
[INFO] We are using command line specified remote repositories:
http://people.apache.org/repo/m2-snapshot-repository
Downloading:
http://people.apache.org/repo/m2-snapshot-repository/org/apache/struts/struts2-archetype-starter/2.0.11/struts2-archetype-starter-2.0.11.jar
[INFO] Unable to find resource
'org.apache.struts:struts2-archetype-starter:jar:2.0.11' in repository id0
(http://people.apache.org/repo/m2-snapshot-repository)
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Error creating from archetype

Embedded error:
org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested
download does not exist.
Unable to download the artifact from any repository
[INFO]

[INFO] For more information, run Maven with the -e switch
[INFO]

[INFO] Total time: 6 seconds
[INFO] Finished at: Tue Nov 10 14:02:53 EET 2009
[INFO] Final Memory: 8M/14M
[INFO]

[kos...@ares tmp]$ 


that's why i'm talking about a steep learning curve. it's all fun though...
hihi
-- 
View this message in context: 
http://old.nabble.com/struts-2-helloWorld-example-not-properly-working-in-tomcat-5.5-tp26240890p26282285.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



Alligning multiple buttons in a single row.

2009-11-10 Thread vikrant S

Hi All,
I am new to struts programming and trying to learn struts from the tutorials
provided online.
First Let me descibe my application.
 I am using html inside  a jsp page for the frontend. I have three buttons
in this page. They are as START , STOP, and CHANGE. I have different
actions for each buttons and I have mapped this actions to respective
methods in the action class. My problem is that I am not able to design the
page. I  need these three buttons in the same row But  I am not able to do
so. I tried to put these buttons inside a tables but still All buttons are
coming vertically and  not horizontally. I will provide you my both html
script.
!) One without using tables
%@ taglib prefix=s uri=/struts-tags %
s:form action=Workload
s:textfield label=Load  name=load
s:textfield label=Duration name=time
s:submit action=start method=StartWorkload value=START/
s:submit action=stop method=StopWorkload value=STOP/
s:submit action=change method=ChangeWorkload value=CHANGE/
2) One with using Tables
%@ taglib prefix=s uri=/struts-tags %
html
titleStruts Application/title
body style=background-color:  #CBCE8A 
table frame=below align=center rules=rows
tr
s:form action=Workload
table
tr
tds:textfield label=Load  
name=load/s:textfield/td
/tr
tr
tds:textfield label=Duration 
name=time/s:textfield/td
/tr
tr
tds:submit action=start method=StartWorkload 
value=START//td
tds:submit action=stop method=StopWorkload 
value=STOP//td
tds:submit action=change method=ChangeWorkload
value=CHANGE//td
/tr
/table

/s:form 
/tr
/table
/body
/html


By using both Scripts i am getting same result with all buttons vertically.
I need these buttons to be in a single horizontal line.
Please Help me out of this!
Thanks in advance!
-- 
View this message in context: 
http://old.nabble.com/Alligning-multiple-buttons-in-a-single-row.-tp26284283p26284283.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: JQuery UI datepicker doesn't work in a struts 2 ajax page

2009-11-10 Thread fireapple

Thanks, Johannes, I tried the plugin of the second link but it didn't work
out. It seems the plugin doesn't work for my struts 2.0.11.

 The build in Datepicker from dojo doesn't work for me because I use
s:iterator. segmentList[%{#stat.index}].departureDate can transfer value
back(can't display value) while segmentList[#stat.index].departureDate can
display value(can't transfer value back).


Johannes Geppert wrote:
 
 Long time ago I also have trouble to execute Scripts in AJAX Content.
 http://old.nabble.com/-S2--No-JavaScript-in-TabbedPanel-to14772176.html#a14772176
 
 So I switch to jQuery also for AJAX functions.
 
 Why do you mix Dojo and jQuery?
 You can use the build in Datepicker from dojo or switch 
 to one of the two jQuery Plugins they exists for struts2.
 
 http://code.google.com/p/struts2-jquery/
 
 or
 
 http://code.google.com/p/struts2-jquery-plugin/
 
 Best Regards
 
 Johannes Geppert
 
 
 
 fireapple wrote:
 
 Thanks Johannes, I'm using struts 2.0.11, this is my ajax submit tag:
 
 s:submitaction=segment_udpateSegmentList value=Update theme=ajax
 targets=%{'segment_edit_message'+#ind.index} showLoadingText=false
 indicator=%{'loadingImage'+#ind.index} executeScripts=true /
 
 I just added executeScripts=true to it but still doesn't work. Any
 other possibility may cause this problem?
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/JQuery-UI-datepicker-doesn%27t-work-in-a-struts-2-ajax-page-tp26230811p26284590.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: Alligning multiple buttons in a single row.

2009-11-10 Thread Paweł Wielgus
Hi,
add theme=simple inside s:submit.

Best greetings,
Paweł Wielgus.

2009/11/10 vikrant S shimpi.vikr...@gmail.com:

 Hi All,
 I am new to struts programming and trying to learn struts from the tutorials
 provided online.
 First Let me descibe my application.
  I am using html inside  a jsp page for the frontend. I have three buttons
 in this page. They are as START , STOP, and CHANGE. I have different
 actions for each buttons and I have mapped this actions to respective
 methods in the action class. My problem is that I am not able to design the
 page. I  need these three buttons in the same row But  I am not able to do
 so. I tried to put these buttons inside a tables but still All buttons are
 coming vertically and  not horizontally. I will provide you my both html
 script.
 !) One without using tables
 %@ taglib prefix=s uri=/struts-tags %
 s:form action=Workload
 s:textfield label=Load  name=load
 s:textfield label=Duration name=time
 s:submit action=start method=StartWorkload value=START/
 s:submit action=stop method=StopWorkload value=STOP/
 s:submit action=change method=ChangeWorkload value=CHANGE/
 2) One with using Tables
 %@ taglib prefix=s uri=/struts-tags %
 html
 titleStruts Application/title
 body style=background-color:  #CBCE8A
 table frame=below align=center rules=rows
 tr
 s:form action=Workload
        table
                tr
                        tds:textfield label=Load  
 name=load/s:textfield/td
                /tr
                tr
                        tds:textfield label=Duration 
 name=time/s:textfield/td
                /tr
                tr
                tds:submit action=start method=StartWorkload 
 value=START//td
                tds:submit action=stop method=StopWorkload 
 value=STOP//td
                tds:submit action=change method=ChangeWorkload
 value=CHANGE//td
                /tr
        /table

 /s:form
 /tr
 /table
 /body
 /html


 By using both Scripts i am getting same result with all buttons vertically.
 I need these buttons to be in a single horizontal line.
 Please Help me out of this!
 Thanks in advance!
 --
 View this message in context: 
 http://old.nabble.com/Alligning-multiple-buttons-in-a-single-row.-tp26284283p26284283.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



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



RE: Problem Sumitting Struts Form containing a drop down list html:optionsCollection

2009-11-10 Thread Kawczynski, David
I believe I understand what you are trying to accomplish:
Ignoring the details (dojo, struts html:form, etc) for now... at a
high level, you want to render a page containing a list of items.  You
want to enable a user to get low-level details on any one of those
items.  
So far so good?  
While there are plenty of ways to accomplish this, I don't want to
confuse you further so I'll only cover the simplest scenario:
Assuming each of these items has single unique identifier that can be
used to retrieve the details (your change number?) and a single simple
small description that will give the use a clue what that item refers to
(your description?)...
 
You want two pages: 

*   
one that will render the entire list of items (but only this
simple small description for each item) 
*   
one that will render all the low-level details for only one item

 
You want two different DAO methods:

*   
one that retrieves a List of all items' change number and
description.  
*   
one that retrieves one item's details (description, creation
date, user, workspace...) given the item's change number

You want two struts actions:

*   
one that calls the DAO's list method, puts the List into the
httprequest, and renders the list page
*   
one that calls the DAO's details method, puts those details into
a single object and puts that object into the httprequest, and renders
the details page

On the list page: create a form whose action points to the struts
details action.  
Create a select element, and populate its options from the list in the
http request.  
Make each option's value = the item's change number 
Make each option's text = the item's description.
On the details page, render attributes of the details object (found in
the http request).  
 
If you follow this approach, chances are any problem you run into will
be one that can be described in a clear and concise manner.  Once you
get this working correctly, you have the building blocks to do more
advanced things like ajax interactions.  But if you don't have a firm
grasp on the basics you'll only end up frustrating yourself and wasting
a lot your time.  
 
Good luck,
-dave
 



From: Hanen Ben Rhouma [mailto:hanen...@gmail.com] 
Sent: Tuesday, November 10, 2009 4:00 AM
To: Struts Users Mailing List
Subject: Re: Problem Sumitting Struts Form containing a drop
down list html:optionsCollection


Morning,

If I give code details, no one will show interest with so much
details and with only the description of my requirement no one also
could understand, that's pretty complicated you know!!

Well, let me represent it with another approach, by screeshots
maybe is better (please take a look at my jsp page shown in the attached
screeshot). By selecting one change ID I'd like to forward my form to
another jsp page representing the details of the selected change
(description, change number, creation date, user, workspace...). 

The problem is that I'm either using dojo to code the drop down
list from user side (and the mapping between simple input parameters
and a struts form html:form isn't that trivial to do), or I've tried
also to code it from server side (eventhough it's too slow) by using a
struts form html:form action=someAction containing
html:optionsCollection to represent the dynamic drop down list (here
the problem is that html:optionsCollection will make use of the struts
action someAction to retrieve the data necessary to fill the drop down
list and not to code the form's behavior after submitting it.

Hope that my point is clearer this time, I'll be really grateful
if someone got a clue to all this headache :(((

Regards,
Hanen



On Mon, Nov 9, 2009 at 7:06 PM, Kawczynski, David
david_kawczyn...@merck.com wrote:


I'd love to be able to help but am confused with what
you are having
trouble with.  I think I heard something about wanting
to modify the
action of a form based on the value selected in a
drop-down.  I also
heard something about forwarding to another jsp page.
If you can
clarify your intent you may end up with a good pointer
or two.
:)


 -Original Message-
 From: Hanen Ben Rhouma [mailto:hanen...@gmail.com]
 Sent: Monday, November 09, 2009 12:49 PM
 To: Struts Users Mailing List
 Subject: Problem Sumitting Struts Form containing a
drop down
 list html:optionsCollection

 Please, I need your help: I've spent more than one
week on trying to
figure out how to submit a struts 1 form containing a
drop down list
 

Re: Alligning multiple buttons in a single row.

2009-11-10 Thread vikrant S

Hi,
I am very much thankful to you. My problem is solved. But the buttons are
not at equal distance from each other.
They are spaced unequally. Any Suggestions Please.



-- 
View this message in context: 
http://old.nabble.com/Alligning-multiple-buttons-in-a-single-row.-tp26284283p26284846.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: Alligning multiple buttons in a single row.

2009-11-10 Thread vikrant S

Hi ,
My problem is solved 

-- 
View this message in context: 
http://old.nabble.com/Alligning-multiple-buttons-in-a-single-row.-tp26284283p26284848.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: Struts tags with Groovy meta programming

2009-11-10 Thread Ronny Løvtangen

Anyone?

Does the struts tags do some reflection magic that bypass the Groovy  
MetaClass?



On Nov 9, 2009, at 5:55 PM, Ronny Løvtangen wrote:



How can I from a Struts tag access properties that is overridden by  
Groovy meta programming?

Example:

Bar.groovy
---

class Bar {
String baz
}



FooAction.groovy
-

class FooAction extends ActionSupport {

Bar bar

String retrieveBar() {
bar = new Bar(baz: original value)
bar.metaClass.getBaz = {new value}
return SUCCESS
}
}

foo.jsp


%@ taglib prefix=s uri=/struts-tags %
Baz is: s:property value=bar.baz/




Which yields the output  Baz is: original value

I was expecting Baz is: new value, which is true for this test:


class FooActionTest extends GroovyTestCase {

void testRetrieveBar() {
FooAction action = new FooAction()
action.retrieveBar()
assertEquals new value, action.bar.baz
}
}


Any idea on how I from a Struts tag can invoke the overridden getBaz  
method instead of the original one?



Ronny

-
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 with Global Exceptions

2009-11-10 Thread Brian Thompson
Something like this may help:

package name=myPackage extends=default
namespace=/my/package/path
default-action-ref name=myDefaultAction/

action name=myDefaultAction class=myActionClass
result name=success/pages/defaultPage.jsp/result
/action
/package

You could have myDefaultAction throw an exception for your exception
mappings, or you could simply have the defaultPage in that mapping be an
appropriate error page.


-Brian


On Tue, Nov 10, 2009 at 3:17 AM, RogerV roger.var...@googlemail.com wrote:


 Could someone just confirm what sort of exception I should be catching to
 intercept There is no Action mapped for namespace /secure and action name
 errors. I've currently got;

 global-exception-mappings
   exception-mapping exception=java.lang.Exception
 result=login/
/global-exception-mappings

 and

 constant name=struts.devMode value=false /

 which I assumed would catch everything, but if I enter gibberish into the
 browser url box, I still get the No Action mapped ... message in the
 server logs and Tomcats 404 page in the browser. Using
 config-browser/index.action confirms that Struts is recognising the
 mapping,
 but it is not catching it.

 Regards
 --
 View this message in context:
 http://old.nabble.com/Problem-with-Global-Exceptions-tp26280416p26280416.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: Trouble calling action methods from FreeMarker

2009-11-10 Thread Christopher Maloof
I guess no one recognizes the problem.  Next question: Has anyone gotten 
this (calling action methods from FreeMarker tags) to work 
successfully?  Just trying to figure out whether the correct approach is 
to hammer on my configuration somehow, or to file a bug.


Thanks,
Chris

On 11/9/2009 10:13 AM, Christopher Maloof wrote:
I'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8.  It 
mostly works fine: my templates are retrieving bean information with 
no problem.  However, I can't figure out how to call methods defined 
in my action classes.


If my action class looks like this:

public class MyAction extends MyActionSupport {
   public String getMyValue() {
  return hello;
   }
   public String myMethod() {
  return world;
   }
}

Then these things work:
${myValue}  (indirect access to bean getter)
${myValue.toUpperCase()}  (method call on object)
@s.property value=myMethod()/   (Struts tag calling a method)

But these things don't:
${myMethod()}
${getMyValue()}  (plain method calls as described in the docs)

Are public action methods not included in the data model for 
Freemarker, for some reason?  The Freemarker docs 
(http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_methodcall) 
seem to indicate that they ought to be.


Thanks for any help,
Chris



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



Re: Problem Sumitting Struts Form containing a drop down list html:optionsCollection

2009-11-10 Thread Hanen Ben Rhouma
Thanks for your reply Davidn but please guys try to stop talking to me as if
I'm an idiot stubborn girl who doesn't know what she wants or even what
she's talking about. I'm working with struts for almost 6 months now and I'm
still finding some difficulties not because of my stupidity but because of
the lack of support I've noticed on the web. Either they give you some peace
of code which you don't find a clue how to plug it into your solution or
they just keep turning around your precise requirement to stick with their
struts/java knowledge.

I'm not confused about my requirement sir, I know what I want but the way to
achieve it on struts way is still clueless for me. You've understood one
side of my requirement but you didn't touch my blocking point.

Here is a tutorial I've followed for coding the first part consisting of
rendering a dynamic drop down list with data assembled into a collection
http://www.laliluna.de/download/struts-html-optionscollection-en.pdf

If you got time, check it out and tell me how can I render my description
page into example action while it's configured to maintain the business
logic of the data rendered into that drop down list (supposed to be an entry
point and not a resulting page for our form behavior).

I know I'm not good enough in english to explain myself the way it should be
but it hasn't any relationship with my understanding of my requirement and
the logical way to get it done (reaching this state of seeing illogical
things made me wonder how come that no body has encountered such problem
before and how were they submitting their dynamic drop down lists
classicaly).

Regards,
Hanen

On Tue, Nov 10, 2009 at 3:59 PM, Kawczynski, David 
david_kawczyn...@merck.com wrote:

 I believe I understand what you are trying to accomplish:
 Ignoring the details (dojo, struts html:form, etc) for now... at a
 high level, you want to render a page containing a list of items.  You
 want to enable a user to get low-level details on any one of those
 items.
 So far so good?
 While there are plenty of ways to accomplish this, I don't want to
 confuse you further so I'll only cover the simplest scenario:
 Assuming each of these items has single unique identifier that can be
 used to retrieve the details (your change number?) and a single simple
 small description that will give the use a clue what that item refers to
 (your description?)...

 You want two pages:

 *
one that will render the entire list of items (but only this
 simple small description for each item)
 *
one that will render all the low-level details for only one item


 You want two different DAO methods:

 *
one that retrieves a List of all items' change number and
 description.
 *
one that retrieves one item's details (description, creation
 date, user, workspace...) given the item's change number

 You want two struts actions:

 *
one that calls the DAO's list method, puts the List into the
 httprequest, and renders the list page
 *
one that calls the DAO's details method, puts those details into
 a single object and puts that object into the httprequest, and renders
 the details page

 On the list page: create a form whose action points to the struts
 details action.
 Create a select element, and populate its options from the list in the
 http request.
 Make each option's value = the item's change number
 Make each option's text = the item's description.
 On the details page, render attributes of the details object (found in
 the http request).

 If you follow this approach, chances are any problem you run into will
 be one that can be described in a clear and concise manner.  Once you
 get this working correctly, you have the building blocks to do more
 advanced things like ajax interactions.  But if you don't have a firm
 grasp on the basics you'll only end up frustrating yourself and wasting
 a lot your time.

 Good luck,
 -dave


 

From: Hanen Ben Rhouma [mailto:hanen...@gmail.com]
 Sent: Tuesday, November 10, 2009 4:00 AM
 To: Struts Users Mailing List
 Subject: Re: Problem Sumitting Struts Form containing a drop
 down list html:optionsCollection


Morning,

If I give code details, no one will show interest with so much
 details and with only the description of my requirement no one also
 could understand, that's pretty complicated you know!!

Well, let me represent it with another approach, by screeshots
 maybe is better (please take a look at my jsp page shown in the attached
 screeshot). By selecting one change ID I'd like to forward my form to
 another jsp page representing the details of the selected change
 (description, change number, creation date, user, workspace...).

The problem is that I'm either using dojo to code the drop down
 list from user side (and the mapping between simple input parameters
 and a struts form html:form isn't that trivial to do), or 

Re: Problem Sumitting Struts Form containing a drop down list html:optionsCollection

2009-11-10 Thread Paul Benedict
Hanen,

I think your response to Dave is outrageous and over-the-top. I didn't
see anything offensive in his email.

Paul

On Tue, Nov 10, 2009 at 9:36 AM, Hanen Ben Rhouma hanen...@gmail.com wrote:
 Thanks for your reply Davidn but please guys try to stop talking to me as if
 I'm an idiot stubborn girl who doesn't know what she wants or even what
 she's talking about. I'm working with struts for almost 6 months now and I'm
 still finding some difficulties not because of my stupidity but because of
 the lack of support I've noticed on the web. Either they give you some peace
 of code which you don't find a clue how to plug it into your solution or
 they just keep turning around your precise requirement to stick with their
 struts/java knowledge.

 I'm not confused about my requirement sir, I know what I want but the way to
 achieve it on struts way is still clueless for me. You've understood one
 side of my requirement but you didn't touch my blocking point.

 Here is a tutorial I've followed for coding the first part consisting of
 rendering a dynamic drop down list with data assembled into a collection
 http://www.laliluna.de/download/struts-html-optionscollection-en.pdf

 If you got time, check it out and tell me how can I render my description
 page into example action while it's configured to maintain the business
 logic of the data rendered into that drop down list (supposed to be an entry
 point and not a resulting page for our form behavior).

 I know I'm not good enough in english to explain myself the way it should be
 but it hasn't any relationship with my understanding of my requirement and
 the logical way to get it done (reaching this state of seeing illogical
 things made me wonder how come that no body has encountered such problem
 before and how were they submitting their dynamic drop down lists
 classicaly).

 Regards,
 Hanen

 On Tue, Nov 10, 2009 at 3:59 PM, Kawczynski, David 
 david_kawczyn...@merck.com wrote:

 I believe I understand what you are trying to accomplish:
 Ignoring the details (dojo, struts html:form, etc) for now... at a
 high level, you want to render a page containing a list of items.  You
 want to enable a user to get low-level details on any one of those
 items.
 So far so good?
 While there are plenty of ways to accomplish this, I don't want to
 confuse you further so I'll only cover the simplest scenario:
 Assuming each of these items has single unique identifier that can be
 used to retrieve the details (your change number?) and a single simple
 small description that will give the use a clue what that item refers to
 (your description?)...

 You want two pages:

 *
        one that will render the entire list of items (but only this
 simple small description for each item)
 *
        one that will render all the low-level details for only one item


 You want two different DAO methods:

 *
        one that retrieves a List of all items' change number and
 description.
 *
        one that retrieves one item's details (description, creation
 date, user, workspace...) given the item's change number

 You want two struts actions:

 *
        one that calls the DAO's list method, puts the List into the
 httprequest, and renders the list page
 *
        one that calls the DAO's details method, puts those details into
 a single object and puts that object into the httprequest, and renders
 the details page

 On the list page: create a form whose action points to the struts
 details action.
 Create a select element, and populate its options from the list in the
 http request.
 Make each option's value = the item's change number
 Make each option's text = the item's description.
 On the details page, render attributes of the details object (found in
 the http request).

 If you follow this approach, chances are any problem you run into will
 be one that can be described in a clear and concise manner.  Once you
 get this working correctly, you have the building blocks to do more
 advanced things like ajax interactions.  But if you don't have a firm
 grasp on the basics you'll only end up frustrating yourself and wasting
 a lot your time.

 Good luck,
 -dave


 

        From: Hanen Ben Rhouma [mailto:hanen...@gmail.com]
         Sent: Tuesday, November 10, 2009 4:00 AM
         To: Struts Users Mailing List
         Subject: Re: Problem Sumitting Struts Form containing a drop
 down list html:optionsCollection


        Morning,

        If I give code details, no one will show interest with so much
 details and with only the description of my requirement no one also
 could understand, that's pretty complicated you know!!

        Well, let me represent it with another approach, by screeshots
 maybe is better (please take a look at my jsp page shown in the attached
 screeshot). By selecting one change ID I'd like to forward my form to
 another jsp page representing the details of the selected change
 (description, change number, creation 

Re: Action tag is forced to use input result if outer action has action errors

2009-11-10 Thread Matt Jiang
Hi Oscar,
Thanks for your advise, I also tried this approach, I make a new
interceptors stack and apply on s:action  tag to avoid validation and
workflow
 interceptors. But it seems that in sitemesh jsp, s:action  can't access
the same http session if target action has action error. Did you get the
same problems before?

Matt

On Tue, Nov 10, 2009 at 7:42 PM, Oscar Calderón oscar.kalde...@gmail.comwrote:

 Hi Matt, You could add to your action declaration in the struts.xml a
 parameter called excluded methods, where you can add the name of the
 methods
 of your action that you don't want to be validated, for example:

 interceptor-ref name=yourInterceptor
  param name=excludeMethodsmethodName1,methodName2/param
 /interceptor-ref

 Even if your interceptor is a default interceptor like workflow or the
 interceptor is inside a interceptor stack you can reference it with the
 same
 declaration

 interceptor-ref name=stackThatContainsTheInterceptor
  param
 name=interceptorName.excludeMethodsmethodName1,methodName2/param
 /interceptor-ref


 2009/11/10 Matt Jiang matt.ji...@gmail.com

  Hi All,
 
  I use Sitemesh as template engine with Struts2.
  In my decorator jsp file, I use s:action/ for division content source.
  Now I encounter a problem that if an action has an action error, there
 will
  be a input result used. It will cause all s:action in decorator JSP
  file
  also execute input result directly. That's means s:action method won't
 be
  called.
 
  How do I make s:action execute its action method no matter its outer
  action's result  when using sitemesh together?
 
  thanks a lot.
  Matt
 



 --
 Visita mi blog
 http://codigo-java.com
 http://aeblogs.com/uiq



Re: Trouble calling action methods from FreeMarker

2009-11-10 Thread Haroon Rafique
Hi Chris,

See reply embedded below...

On Today at 10:32am, CM=Christopher Maloof c_mal...@mail.jci.tju.edu wrote:

CM I guess no one recognizes the problem.  Next question: Has anyone 
CM gotten this (calling action methods from FreeMarker tags) to work 
CM successfully? Just trying to figure out whether the correct approach 
CM is to hammer on my configuration somehow, or to file a bug.
CM 
CM Thanks,
CM Chris
CM 
CM On 11/9/2009 10:13 AM, Christopher Maloof wrote:
CM  I'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8.  It mostly
CM  works fine: my templates are retrieving bean information with no problem.
CM  However, I can't figure out how to call methods defined in my action
CM  classes.
CM 
CM  If my action class looks like this:
CM 
CM  public class MyAction extends MyActionSupport {
CM public String getMyValue() {
CMreturn hello;
CM }
CM public String myMethod() {
CMreturn world;
CM }
CM  }
CM 
CM  Then these things work:
CM  ${myValue}  (indirect access to bean getter)
CM  ${myValue.toUpperCase()}  (method call on object)
CM  @s.property value=myMethod()/   (Struts tag calling a method)
CM 
CM  But these things don't:
CM  ${myMethod()}
CM  ${getMyValue()}  (plain method calls as described in the docs)
CM 


Try:

${stack.findValue(getMyValue())}
${stack.findValue(myMethod())}

Later,
--
Haroon Rafique
haroon.rafi...@utoronto.ca


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



Re: struts 2 helloWorld example not properly working in tomcat 5.5

2009-11-10 Thread Musachy Barroso
hum, I use this all the time:

mvn archetype:create   -DgroupId=tutorial \
   -DartifactId=tutorial \
   -DarchetypeGroupId=org.apache.struts \
   -DarchetypeArtifactId=struts2-archetype-starter \
   -DarchetypeVersion=2.0.11.2

I does take a few times setting it up to learn all the gotchas :)

musachy

On Tue, Nov 10, 2009 at 4:05 AM, reason k...@pop.gr wrote:

 thanks musachy

 that was actually my initial attempt but it ran aground (see below) so i
 gave up and did it the hard way

 [kos...@ares tmp]$ echo $JAVA_HOME;echo;echo;mvn archetype:create
 -DgroupId=tutorial                        -DartifactId=tutorial
 -DarchetypeGroupId=org.apache.struts
 -DarchetypeArtifactId=struts2-archetype-starter
 -DarchetypeVersion=2.0.11
 -DremoteRepositories=http://people.apache.org/repo/m2-snapshot-repository
 /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0


 Warning: JAVA_HOME environment variable is not set.
 [INFO] Scanning for projects...
 [INFO] Searching repository for plugin with prefix: 'archetype'.
 [INFO]
 
 [INFO] Building Maven Default Project
 [INFO]    task-segment: [archetype:create] (aggregator-style)
 [INFO]
 
 [INFO] Setting property: classpath.resource.loader.class =
 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'.
 [INFO] Setting property: velocimacro.messages.on = 'false'.
 [INFO] Setting property: resource.loader = 'classpath'.
 [INFO] Setting property: resource.manager.logwhenfound = 'false'.
 [INFO] [archetype:create {execution: default-cli}]
 [WARNING] This goal is deprecated. Please use mvn archetype:generate instead
 [INFO] Defaulting package to group ID: tutorial
 [INFO] We are using command line specified remote repositories:
 http://people.apache.org/repo/m2-snapshot-repository
 Downloading:
 http://people.apache.org/repo/m2-snapshot-repository/org/apache/struts/struts2-archetype-starter/2.0.11/struts2-archetype-starter-2.0.11.jar
 [INFO] Unable to find resource
 'org.apache.struts:struts2-archetype-starter:jar:2.0.11' in repository id0
 (http://people.apache.org/repo/m2-snapshot-repository)
 [INFO]
 
 [ERROR] BUILD ERROR
 [INFO]
 
 [INFO] Error creating from archetype

 Embedded error:
 org.apache.maven.archetype.downloader.DownloadNotFoundException: Requested
 download does not exist.
 Unable to download the artifact from any repository
 [INFO]
 
 [INFO] For more information, run Maven with the -e switch
 [INFO]
 
 [INFO] Total time: 6 seconds
 [INFO] Finished at: Tue Nov 10 14:02:53 EET 2009
 [INFO] Final Memory: 8M/14M
 [INFO]
 
 [kos...@ares tmp]$


 that's why i'm talking about a steep learning curve. it's all fun though...
 hihi
 --
 View this message in context: 
 http://old.nabble.com/struts-2-helloWorld-example-not-properly-working-in-tomcat-5.5-tp26240890p26282285.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



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



Re: Struts tags with Groovy meta programming

2009-11-10 Thread Musachy Barroso
yes, field/methods are calling using reflection, I have no idea how
the Groovy MetaClass works. You can look at the OGNLReflectionProvider
class, that's the one doing the reflection stuff.

musachy

On Tue, Nov 10, 2009 at 7:10 AM, Ronny Løvtangen li...@lovtangen.com wrote:
 Anyone?

 Does the struts tags do some reflection magic that bypass the Groovy
 MetaClass?


 On Nov 9, 2009, at 5:55 PM, Ronny Løvtangen wrote:


 How can I from a Struts tag access properties that is overridden by Groovy
 meta programming?
 Example:

 Bar.groovy
 ---

 class Bar {
        String baz
 }



 FooAction.groovy
 -

 class FooAction extends ActionSupport {

        Bar bar

        String retrieveBar() {
                bar = new Bar(baz: original value)
                bar.metaClass.getBaz = {new value}
                return SUCCESS
        }
 }

 foo.jsp
 

 %@ taglib prefix=s uri=/struts-tags %
 Baz is: s:property value=bar.baz/




 Which yields the output  Baz is: original value

 I was expecting Baz is: new value, which is true for this test:


 class FooActionTest extends GroovyTestCase {

        void testRetrieveBar() {
                FooAction action = new FooAction()
                action.retrieveBar()
                assertEquals new value, action.bar.baz
        }
 }


 Any idea on how I from a Struts tag can invoke the overridden getBaz
 method instead of the original one?


 Ronny

 -
 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: Problem Sumitting Struts Form containing a drop down list html:optionsCollection

2009-11-10 Thread Hanen Ben Rhouma
Ok, that's your point and I respect it. Sorry for engendering all this mess
in your rows. I take back my thread.


On Tue, Nov 10, 2009 at 5:06 PM, Paul Benedict pbened...@apache.org wrote:

 Hanen,

 I think your response to Dave is outrageous and over-the-top. I didn't
 see anything offensive in his email.

 Paul

 On Tue, Nov 10, 2009 at 9:36 AM, Hanen Ben Rhouma hanen...@gmail.com
 wrote:
  Thanks for your reply Davidn but please guys try to stop talking to me as
 if
  I'm an idiot stubborn girl who doesn't know what she wants or even what
  she's talking about. I'm working with struts for almost 6 months now and
 I'm
  still finding some difficulties not because of my stupidity but because
 of
  the lack of support I've noticed on the web. Either they give you some
 peace
  of code which you don't find a clue how to plug it into your solution or
  they just keep turning around your precise requirement to stick with
 their
  struts/java knowledge.
 
  I'm not confused about my requirement sir, I know what I want but the way
 to
  achieve it on struts way is still clueless for me. You've understood one
  side of my requirement but you didn't touch my blocking point.
 
  Here is a tutorial I've followed for coding the first part consisting of
  rendering a dynamic drop down list with data assembled into a collection
  http://www.laliluna.de/download/struts-html-optionscollection-en.pdf
 
  If you got time, check it out and tell me how can I render my description
  page into example action while it's configured to maintain the business
  logic of the data rendered into that drop down list (supposed to be an
 entry
  point and not a resulting page for our form behavior).
 
  I know I'm not good enough in english to explain myself the way it should
 be
  but it hasn't any relationship with my understanding of my requirement
 and
  the logical way to get it done (reaching this state of seeing illogical
  things made me wonder how come that no body has encountered such problem
  before and how were they submitting their dynamic drop down lists
  classicaly).
 
  Regards,
  Hanen
 
  On Tue, Nov 10, 2009 at 3:59 PM, Kawczynski, David 
  david_kawczyn...@merck.com wrote:
 
  I believe I understand what you are trying to accomplish:
  Ignoring the details (dojo, struts html:form, etc) for now... at a
  high level, you want to render a page containing a list of items.  You
  want to enable a user to get low-level details on any one of those
  items.
  So far so good?
  While there are plenty of ways to accomplish this, I don't want to
  confuse you further so I'll only cover the simplest scenario:
  Assuming each of these items has single unique identifier that can be
  used to retrieve the details (your change number?) and a single simple
  small description that will give the use a clue what that item refers to
  (your description?)...
 
  You want two pages:
 
  *
 one that will render the entire list of items (but only this
  simple small description for each item)
  *
 one that will render all the low-level details for only one item
 
 
  You want two different DAO methods:
 
  *
 one that retrieves a List of all items' change number and
  description.
  *
 one that retrieves one item's details (description, creation
  date, user, workspace...) given the item's change number
 
  You want two struts actions:
 
  *
 one that calls the DAO's list method, puts the List into the
  httprequest, and renders the list page
  *
 one that calls the DAO's details method, puts those details into
  a single object and puts that object into the httprequest, and renders
  the details page
 
  On the list page: create a form whose action points to the struts
  details action.
  Create a select element, and populate its options from the list in the
  http request.
  Make each option's value = the item's change number
  Make each option's text = the item's description.
  On the details page, render attributes of the details object (found in
  the http request).
 
  If you follow this approach, chances are any problem you run into will
  be one that can be described in a clear and concise manner.  Once you
  get this working correctly, you have the building blocks to do more
  advanced things like ajax interactions.  But if you don't have a firm
  grasp on the basics you'll only end up frustrating yourself and wasting
  a lot your time.
 
  Good luck,
  -dave
 
 
  
 
 From: Hanen Ben Rhouma [mailto:hanen...@gmail.com]
  Sent: Tuesday, November 10, 2009 4:00 AM
  To: Struts Users Mailing List
  Subject: Re: Problem Sumitting Struts Form containing a drop
  down list html:optionsCollection
 
 
 Morning,
 
 If I give code details, no one will show interest with so much
  details and with only the description of my requirement no one also
  could understand, that's pretty complicated you know!!
 

Re: struts 2 helloWorld example not properly working in tomcat 5.5

2009-11-10 Thread reason

wehey! it worked :)

i'm positive i had copy/pasted that line from somewhere official.
is someone playing tricks on us struts2 newbies?

evil bums!

cheers,
kostis


hum, I use this all the time:

mvn archetype:create   -DgroupId=tutorial \
   -DartifactId=tutorial \
   -DarchetypeGroupId=org.apache.struts \
   -DarchetypeArtifactId=struts2-archetype-starter \
   -DarchetypeVersion=2.0.11.2

I does take a few times setting it up to learn all the gotchas :)

musachy


-- 
View this message in context: 
http://old.nabble.com/struts-2-helloWorld-example-not-properly-working-in-tomcat-5.5-tp26240890p26287009.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 Sumitting Struts Form containing a drop down list html:optionsCollection

2009-11-10 Thread Kawczynski, David
 how can I render my description page into example action 
 while it's configured to maintain the business logic of the 
 data rendered into that drop down list 

That example action is a tutorial designed to demonstrate how
the optionsCollection tag works.  It is not meant to be a 
starting point for you to develop the functionality you speak
of.  You are trying to do too many things at once.  You need 
2 very different pieces of data... 
- a list of high-level details 
- a group of low-level details
Breaking down the steps allows you to focus your efforts on a
specific issue.  The 2-action class approach I described 
allows you to do that.

(supposed to be an entry point and not a resulting page for 
 our form behavior).
This sounds like you want AJAX-like functionality.  If you do 
what is described below, enabling AJAX is made easy because 
you only have to call details action and render its results
AJAX-style.  

Good luck!


 -Original Message-
 From: Hanen Ben Rhouma [mailto:hanen...@gmail.com] 
 Sent: Tuesday, November 10, 2009 10:36 AM
 To: Struts Users Mailing List
 Subject: Re: Problem Sumitting Struts Form containing a drop 
 down list html:optionsCollection
 
 Thanks for your reply Davidn but please guys try to stop 
 talking to me as if
 I'm an idiot stubborn girl who doesn't know what she wants or 
 even what
 she's talking about. I'm working with struts for almost 6 
 months now and I'm
 still finding some difficulties not because of my stupidity 
 but because of
 the lack of support I've noticed on the web. Either they give 
 you some peace
 of code which you don't find a clue how to plug it into your 
 solution or
 they just keep turning around your precise requirement to 
 stick with their
 struts/java knowledge.
 
 I'm not confused about my requirement sir, I know what I want 
 but the way to
 achieve it on struts way is still clueless for me. You've 
 understood one
 side of my requirement but you didn't touch my blocking point.
 
 Here is a tutorial I've followed for coding the first part 
 consisting of
 rendering a dynamic drop down list with data assembled into a 
 collection
 http://www.laliluna.de/download/struts-html-optionscollection-en.pdf
 
 If you got time, check it out and tell me how can I render my 
 description
 page into example action while it's configured to maintain 
 the business
 logic of the data rendered into that drop down list (supposed 
 to be an entry
 point and not a resulting page for our form behavior).
 
 I know I'm not good enough in english to explain myself the 
 way it should be
 but it hasn't any relationship with my understanding of my 
 requirement and
 the logical way to get it done (reaching this state of seeing 
 illogical
 things made me wonder how come that no body has encountered 
 such problem
 before and how were they submitting their dynamic drop down lists
 classicaly).
 
 Regards,
 Hanen
 
 On Tue, Nov 10, 2009 at 3:59 PM, Kawczynski, David 
 david_kawczyn...@merck.com wrote:
 
  I believe I understand what you are trying to accomplish:
  Ignoring the details (dojo, struts html:form, etc) for now... at a
  high level, you want to render a page containing a list of 
 items.  You
  want to enable a user to get low-level details on any one of those
  items.
  So far so good?
  While there are plenty of ways to accomplish this, I don't want to
  confuse you further so I'll only cover the simplest scenario:
  Assuming each of these items has single unique identifier 
 that can be
  used to retrieve the details (your change number?) and a 
 single simple
  small description that will give the use a clue what that 
 item refers to
  (your description?)...
 
  You want two pages:
 
  *
 one that will render the entire list of items (but only this
  simple small description for each item)
  *
 one that will render all the low-level details for 
 only one item
 
 
  You want two different DAO methods:
 
  *
 one that retrieves a List of all items' change number and
  description.
  *
 one that retrieves one item's details (description, creation
  date, user, workspace...) given the item's change number
 
  You want two struts actions:
 
  *
 one that calls the DAO's list method, puts the List into the
  httprequest, and renders the list page
  *
 one that calls the DAO's details method, puts those 
 details into
  a single object and puts that object into the httprequest, 
 and renders
  the details page
 
  On the list page: create a form whose action points to the struts
  details action.
  Create a select element, and populate its options from 
 the list in the
  http request.
  Make each option's value = the item's change number
  Make each option's text = the item's description.
  On the details page, render attributes of the details 
 object (found in
  the http request).
 
  If you follow this approach, chances are any problem you 
 run into will
  be one that can be described in a 

Re: Access Denied error with Struts 2.1.8

2009-11-10 Thread Eric Martin



Musachy Barroso wrote:
 
 did you try asking in the GAE forums? This is more of a GAE problem,
 so you have a better chance to find an answer there.
 

I posted a question in the GAE group
(http://groups.google.com/group/google-appengine-java/topics), but it has
not made it through moderation yet. Apparently, this is not an issue with
2.1.6, so it seems as though something about 2.1.8 is causing the issue,
perhaps?

-- 
View this message in context: 
http://old.nabble.com/Access-Denied-error-with-Struts-2.1.8-tp25707316p26287339.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: Trouble calling action methods from FreeMarker

2009-11-10 Thread Musachy Barroso
can you try ${action.someMethod()} ? I think that should work

musachy

On Tue, Nov 10, 2009 at 9:46 AM, Christopher Maloof
c_mal...@mail.jci.tju.edu wrote:
 Thanks!  I don't know what that's really doing, but it does work.  Adding
 parameters to the methods is a bit wonky; it's very difficult to get the
 syntax right for
   ${stack.findValue(getScore('${st.name()}'))}
 as opposed to the expected
   ${getScore(st.name())}

 but it's something.

 Maybe this should be added to
 http://struts.apache.org/2.x/docs/freemarker.html , assuming it's the
 intended behavior?  The question's been asked of the list at least a couple
 other times this year: http://markmail.org/message/4ordiw724kvdw5d6 and
 http://markmail.org/message/jjkic23knjk5tnpx.

 Best,
 Chris

 On 11/10/2009 11:20 AM, Haroon Rafique wrote:

 Hi Chris,

 See reply embedded below...

 On Today at 10:32am, CM=Christopher Maloofc_mal...@mail.jci.tju.edu
  wrote:

 CM  I guess no one recognizes the problem.  Next question: Has anyone
 CM  gotten this (calling action methods from FreeMarker tags) to work
 CM  successfully? Just trying to figure out whether the correct approach
 CM  is to hammer on my configuration somehow, or to file a bug.
 CM
 CM  Thanks,
 CM  Chris
 CM
 CM  On 11/9/2009 10:13 AM, Christopher Maloof wrote:
 CM    I'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8.
  It mostly
 CM    works fine: my templates are retrieving bean information with no
 problem.
 CM    However, I can't figure out how to call methods defined in my
 action
 CM    classes.
 CM  
 CM    If my action class looks like this:
 CM  
 CM    public class MyAction extends MyActionSupport {
 CM       public String getMyValue() {
 CM          return hello;
 CM       }
 CM       public String myMethod() {
 CM          return world;
 CM       }
 CM    }
 CM  
 CM    Then these things work:
 CM    ${myValue}  (indirect access to bean getter)
 CM    ${myValue.toUpperCase()}  (method call on object)
 CM    @s.property value=myMethod()/    (Struts tag calling a method)
 CM  
 CM    But these things don't:
 CM    ${myMethod()}
 CM    ${getMyValue()}  (plain method calls as described in the docs)
 CM  


 Try:

 ${stack.findValue(getMyValue())}
 ${stack.findValue(myMethod())}

 Later,
 --
 Haroon Rafique
 haroon.rafi...@utoronto.ca


 -
 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: Trouble calling action methods from FreeMarker

2009-11-10 Thread Christopher Maloof
Oh, that's much nicer!  Yes, using the action built-in variable works 
perfectly.  Thank you very much -


Chris

On 11/10/2009 12:53 PM, Musachy Barroso wrote:

can you try ${action.someMethod()} ? I think that should work

musachy

On Tue, Nov 10, 2009 at 9:46 AM, Christopher Maloof
c_mal...@mail.jci.tju.edu  wrote:
   

Thanks!  I don't know what that's really doing, but it does work.  Adding
parameters to the methods is a bit wonky; it's very difficult to get the
syntax right for
   ${stack.findValue(getScore('${st.name()}'))}
as opposed to the expected
   ${getScore(st.name())}

but it's something.

Maybe this should be added to
http://struts.apache.org/2.x/docs/freemarker.html , assuming it's the
intended behavior?  The question's been asked of the list at least a couple
other times this year: http://markmail.org/message/4ordiw724kvdw5d6 and
http://markmail.org/message/jjkic23knjk5tnpx.

Best,
Chris

On 11/10/2009 11:20 AM, Haroon Rafique wrote:
 

Hi Chris,

See reply embedded below...

On Today at 10:32am, CM=Christopher Maloofc_mal...@mail.jci.tju.edu
  wrote:

CMI guess no one recognizes the problem.  Next question: Has anyone
CMgotten this (calling action methods from FreeMarker tags) to work
CMsuccessfully? Just trying to figure out whether the correct approach
CMis to hammer on my configuration somehow, or to file a bug.
CM
CMThanks,
CMChris
CM
CMOn 11/9/2009 10:13 AM, Christopher Maloof wrote:
CMI'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8.
  It mostly
CMworks fine: my templates are retrieving bean information with no
problem.
CMHowever, I can't figure out how to call methods defined in my
action
CMclasses.
CM
CMIf my action class looks like this:
CM
CMpublic class MyAction extends MyActionSupport {
CM   public String getMyValue() {
CM  return hello;
CM   }
CM   public String myMethod() {
CM  return world;
CM   }
CM}
CM
CMThen these things work:
CM${myValue}  (indirect access to bean getter)
CM${myValue.toUpperCase()}  (method call on object)
CM@s.property value=myMethod()/  (Struts tag calling a method)
CM
CMBut these things don't:
CM${myMethod()}
CM${getMyValue()}  (plain method calls as described in the docs)
CM


Try:

${stack.findValue(getMyValue())}
${stack.findValue(myMethod())}

Later,
--
Haroon Rafique
haroon.rafi...@utoronto.ca


-
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: Inline downloading of file with Struts 1.2

2009-11-10 Thread Daniele Development-ML
Problem solved. The mistake was using part of the old content disposition
tag:

response.setHeader(Content-disposition, inline; filename=file.jar);

instead of specifying only inline, like this:

response.setHeader(Content-disposition, inline);

Thanks,

Dan



On Tue, Nov 3, 2009 at 2:25 PM, Mike Baranski 
list-subscripti...@secmgmt.com wrote:



 -Original Message-
 From: Daniele Development-ML [mailto:daniele@googlemail.com]
 Sent: Tuesday, November 03, 2009 8:58 AM
 To: Struts Users Mailing List
 Subject: Re: Inline downloading of file with Struts 1.2
 
 Hello,
 
 I was wondering if any of the more experience people have suggestion
 about
 this issue. The problem is that Firefox 3.5 - differently from Firefox 2
 -
 does not process automatically XUL files zipped in jar files, if the jar
 file is requested to be downloaded as attachment rather than inline
 within
 the browser window.
 
 Any suggestion/help, much appreciated!
 
 Dan
 
 On Fri, Oct 30, 2009 at 7:25 PM, Daniele Development-ML 
 daniele@googlemail.com wrote:
 
  Hello,
 
  I'm coding a Struts 1.2 action to download file available on the
 server. I
  need to send back the file as inline so that the browser will process
 it
  within the same window.
 
  the relevant code is :
 
  response.setContentType(application/java-archive);
  response.setHeader(Content-disposition, inline;
 filename=file.jar);
 
  However, when I try accessing the URL the Apache http client give the
  following response:
 
  HTTP/1.1 200 OK
  Response content length: -1
  Content-Type = application/java-archive
 
  With length -1.
 
  Any suggestion on how could I do this? It's essential that the jar
 file is
  processed within the browser window, as the file incorporates an XUL
 (XML
  file) that needs automatically be processed by Firefox.
 
  Many thanks,
 
  Dan
 

 Here are 2 examples, the first displays inline, and the second forces a
 download, both using the same action.

 action name=personImage class=StreamImageAction
result name=success type=stream
param name=contentTypeimage/jpeg/param
param name=inputNameinputStream/param
param
 name=contentDispositionfilename=image.jpg/param
param name=bufferSize1024/param
/result
 /action

 action name=saveImage class=StreamImageAction
 result name=success type=stream
param name=contentTypeimage/jpeg/param
param name=inputNameinputStream/param
param name=contentDispositionattachment;
 filename=image.jpg/param
param name=bufferSize1024/param
 /result
 /action


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




Re: Trouble calling action methods from FreeMarker

2009-11-10 Thread Christopher Maloof
Thanks!  I don't know what that's really doing, but it does work.  
Adding parameters to the methods is a bit wonky; it's very difficult to 
get the syntax right for

   ${stack.findValue(getScore('${st.name()}'))}
as opposed to the expected
   ${getScore(st.name())}

but it's something.

Maybe this should be added to 
http://struts.apache.org/2.x/docs/freemarker.html , assuming it's the 
intended behavior?  The question's been asked of the list at least a 
couple other times this year: 
http://markmail.org/message/4ordiw724kvdw5d6 and 
http://markmail.org/message/jjkic23knjk5tnpx.


Best,
Chris

On 11/10/2009 11:20 AM, Haroon Rafique wrote:

Hi Chris,

See reply embedded below...

On Today at 10:32am, CM=Christopher Maloofc_mal...@mail.jci.tju.edu  wrote:

CM  I guess no one recognizes the problem.  Next question: Has anyone
CM  gotten this (calling action methods from FreeMarker tags) to work
CM  successfully? Just trying to figure out whether the correct approach
CM  is to hammer on my configuration somehow, or to file a bug.
CM
CM  Thanks,
CM  Chris
CM
CM  On 11/9/2009 10:13 AM, Christopher Maloof wrote:
CMI'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8.  It 
mostly
CMworks fine: my templates are retrieving bean information with no 
problem.
CMHowever, I can't figure out how to call methods defined in my action
CMclasses.
CM  
CMIf my action class looks like this:
CM  
CMpublic class MyAction extends MyActionSupport {
CM   public String getMyValue() {
CM  return hello;
CM   }
CM   public String myMethod() {
CM  return world;
CM   }
CM}
CM  
CMThen these things work:
CM${myValue}  (indirect access to bean getter)
CM${myValue.toUpperCase()}  (method call on object)
CM@s.property value=myMethod()/(Struts tag calling a method)
CM  
CMBut these things don't:
CM${myMethod()}
CM${getMyValue()}  (plain method calls as described in the docs)
CM  


Try:

${stack.findValue(getMyValue())}
${stack.findValue(myMethod())}

Later,
--
Haroon Rafique
haroon.rafi...@utoronto.ca


-
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: Struts tags with Groovy meta programming

2009-11-10 Thread Musachy Barroso
please pardon the bot, it hasn't been patched in a while, this *is*
the right place to ask this question.

musachy

On Tue, Nov 10, 2009 at 12:57 PM, Martin Gainty mgai...@hotmail.com wrote:

 ask this question on tomcat-users list

 Groovy and all CGI languages do not exist in J2EE world (correction i havent 
 seen any Groovy parsers implemented in TC,GF or WL or JBoss)
 Groovy Rails as GRAILS with Spring Framework is available at
 http://grails.org

 Martin Gainty
 __
 Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

 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.
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
 destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
 l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci 
 est interdite. Ce message sert à l'information seulement et n'aura pas 
 n'importe quel effet légalement obligatoire. Étant donné que les email 
 peuvent facilement être sujets à la manipulation, nous ne pouvons accepter 
 aucune responsabilité pour le contenu fourni.




 Subject: Re: Struts tags with Groovy meta programming
 From: li...@lovtangen.com
 Date: Tue, 10 Nov 2009 16:10:08 +0100
 To: user@struts.apache.org

 Anyone?

 Does the struts tags do some reflection magic that bypass the Groovy
 MetaClass?


 On Nov 9, 2009, at 5:55 PM, Ronny Løvtangen wrote:

 
  How can I from a Struts tag access properties that is overridden by
  Groovy meta programming?
  Example:
 
  Bar.groovy
  ---
 
  class Bar {
      String baz
  }
 
 
 
  FooAction.groovy
  -
 
  class FooAction extends ActionSupport {
 
      Bar bar
 
      String retrieveBar() {
              bar = new Bar(baz: original value)
              bar.metaClass.getBaz = {new value}
              return SUCCESS
      }
  }
 
  foo.jsp
  
 
  %@ taglib prefix=s uri=/struts-tags %
  Baz is: s:property value=bar.baz/
 
 
 
 
  Which yields the output  Baz is: original value
 
  I was expecting Baz is: new value, which is true for this test:
 
 
  class FooActionTest extends GroovyTestCase {
 
      void testRetrieveBar() {
              FooAction action = new FooAction()
              action.retrieveBar()
              assertEquals new value, action.bar.baz
      }
  }
 
 
  Any idea on how I from a Struts tag can invoke the overridden getBaz
  method instead of the original one?
 
 
  Ronny
 
  -
  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


 _
 Bing brings you maps, menus, and reviews organized in one place.
 http://www.bing.com/search?q=restaurantsform=MFESRPpubl=WLHMTAGcrea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1

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



RE: Struts tags with Groovy meta programming

2009-11-10 Thread Martin Gainty

ask this question on tomcat-users list

Groovy and all CGI languages do not exist in J2EE world (correction i havent 
seen any Groovy parsers implemented in TC,GF or WL or JBoss)
Groovy Rails as GRAILS with Spring Framework is available at
http://grails.org

Martin Gainty 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
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.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Subject: Re: Struts tags with Groovy meta programming 
 From: li...@lovtangen.com
 Date: Tue, 10 Nov 2009 16:10:08 +0100
 To: user@struts.apache.org
 
 Anyone?
 
 Does the struts tags do some reflection magic that bypass the Groovy  
 MetaClass?
 
 
 On Nov 9, 2009, at 5:55 PM, Ronny Løvtangen wrote:
 
 
  How can I from a Struts tag access properties that is overridden by  
  Groovy meta programming?
  Example:
 
  Bar.groovy
  ---
 
  class Bar {
  String baz
  }
 
 
 
  FooAction.groovy
  -
 
  class FooAction extends ActionSupport {
 
  Bar bar
 
  String retrieveBar() {
  bar = new Bar(baz: original value)
  bar.metaClass.getBaz = {new value}
  return SUCCESS
  }
  }
 
  foo.jsp
  
 
  %@ taglib prefix=s uri=/struts-tags %
  Baz is: s:property value=bar.baz/
 
 
 
 
  Which yields the output  Baz is: original value
 
  I was expecting Baz is: new value, which is true for this test:
 
 
  class FooActionTest extends GroovyTestCase {
 
  void testRetrieveBar() {
  FooAction action = new FooAction()
  action.retrieveBar()
  assertEquals new value, action.bar.baz
  }
  }
 
 
  Any idea on how I from a Struts tag can invoke the overridden getBaz  
  method instead of the original one?
 
 
  Ronny
 
  -
  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
 
  
_
Bing brings you maps, menus, and reviews organized in one place.
http://www.bing.com/search?q=restaurantsform=MFESRPpubl=WLHMTAGcrea=TEXT_MFESRP_Local_MapsMenu_Resturants_1x1