Re: Interceptors with Ajax Actions

2008-02-27 Thread Grish

I tried what you suggested, I placed an empty div but I got the same result,
still undefined with IE. I looked at the debug output and it parses the
proper javascript code just that it doesn't execute. The debug output is
practically the same between firefox and IE.

I'll try reserching in the Dojo 0.4 wiki and mailing list as you suggested.

Thanks!


Jeromy Evans - Blue Sky Minds wrote:
> 
> 
>>>
>>>
>>> 
>>> 
>>> 
> Just a quick thought.  Try this but include an empty div in the body.  
> The "undefined" in IE may be because Dojo is inserting an empty string 
> into the DOM using innerHTML.
> (Dojo extracts the scripts and executes them separately afterwards).
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Interceptors-with-Ajax-Actions-tp15706322p15729034.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Interceptors with Ajax Actions

2008-02-27 Thread Grish

Well my interceptor was working already with the request object so from there
I just got the request URL. All my AJAX operations have the word Ajax in
them. So I just check if there's an Ajax string in my request URL.

This is what I had in my code:

boolean ajaxOperation = request.getRequestURL().indexOf("Ajax") > -1;

Although I don't know if that's the best approach since I'm fairly new to
this as well. Hope that helps!


Pablo Vazquez wrote:
> 
> - the interceptor can detect that the request is ajax either by the 
> partitioning of your packages/URLs or by inspecting the http header;
> 
> How can you know it is an ajax request by inspecting the http header?
> I looked in my request headers and I can´t know whether it is ajax or not.
> 
> Thanks.
> 
> Jeromy Evans escribió:
>> Grish wrote:
>>> Is there a way to intercept these ajax actions and properly direct my 
>>> users
>>> to the login page? Or is my approach fundamentally wrong? Any 
>>> suggestions?
>>>   
>>
>> You can only force the redirect to a login page from the client-side.
>>
>> There's a couple of ways you can do this:
>>  - the interceptor can detect that the request is ajax either by the 
>> partitioning of your packages/URLs or by inspecting the http header;
>>  - return a custom http header when its an ajax request and 
>> unauthorized (eg. return a 2xx or 4xx with a custom X-param).  See the 
>> headers result type.
>>  - in your javascript callback, detect the odd result and perform a 
>> redirect
>>
>> Hope that helps.
>>
>> Jeromy Evans
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Interceptors-with-Ajax-Actions-tp15706322p15710190.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Interceptors with Ajax Actions

2008-02-27 Thread Grish

Well I tried all approaches but I had a small problem with the javascript
redirect approach: I perform an AJAX operation and my interceptor redirects
to a page which displays the error message and has an inline javascript to
redirect to the login page as suggested.

It works fine in firefox but in IE I simply get "undefined" in my div area.

I tried out something simple and had a result page with this javascript:


<!--

window.location.href = "/newbie/login.action";

//-->


Unfortunately it doesn't work. Any suggestions?



Grish wrote:
> 
> Thanks Jeromy!
> 
> Yeah that helped a lot! 
> 
> It seems that making a topic for all ajax operations a little more tedious
> than the basic approaches you've suggested. Although, I'm going to try
> them all out for the learning experience! 
> 
> Thanks Again!
> 
> 
> 
> 
> Jeromy Evans - Blue Sky Minds wrote:
>> 
>> 
>> Grish wrote:
>>> I'm using the ajax theme with my struts tags, based on the struts 2
>>> tutorial,  to implement ajax functionality. Where can I define my code
>>> to
>>> catch the result and perform a redirect? I apologize for my
>>> inexperience.
>>>
>>> I'm a little unclear on how to 
>>>   
>> hmm...ok, this is using Dojo 0.4 and it gets messy pretty quickly.  I'd 
>> probably use a different approach given that constraint but I'll come 
>> back to that issue in a moment.
>> 
>> Basically with the tags you have two options:
>>   - subscribe to a Topic for all of the ajax operations. There should be 
>> a topic for when the response is received or handling an error response.
>>   - use a custom handler that performs the posts. 
>> I don't recall the details because I don't use these tags any more.  
>> Topics are touched on at [1] and [2] but you're quite limited in 2.0.x 
>> compared to 2.1.x. 
>> Dojo may have some global events but you'll have to search the API.
>> 
>> Given that constraint, I'd use these basic approaches:
>>   - return an HTML fragment for failed ajax requests instructing the 
>> user to login with an appropriate link; and/or
>>   - return an HTML fragment that also contains inline javascript that 
>> performs a redirection to the login page.  Make sure you have 
>> separateScripts=false and executeScripts=true on all the dojo tags.
>> 
>> I consider the latter case a hack but it should work with this version 
>> of Dojo in all the relevant browsers.
>> 
>> Hope that helps!
>> 
>> [1] http://struts.apache.org/2.0.11/docs/ajax-tags.html
>> [2]http://struts.apache.org/2.0.11/docs/ajax-and-javascript-recipes.html
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Interceptors-with-Ajax-Actions-tp15706322p15709991.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Interceptors with Ajax Actions

2008-02-27 Thread Grish

Thanks Jeromy!

Yeah that helped a lot! 

It seems that making a topic for all ajax operations a little more tedious
than the basic approaches you've suggested. Although, I'm going to try them
all out for the learning experience! 

Thanks Again!




Jeromy Evans - Blue Sky Minds wrote:
> 
> 
> Grish wrote:
>> I'm using the ajax theme with my struts tags, based on the struts 2
>> tutorial,  to implement ajax functionality. Where can I define my code to
>> catch the result and perform a redirect? I apologize for my inexperience.
>>
>> I'm a little unclear on how to 
>>   
> hmm...ok, this is using Dojo 0.4 and it gets messy pretty quickly.  I'd 
> probably use a different approach given that constraint but I'll come 
> back to that issue in a moment.
> 
> Basically with the tags you have two options:
>   - subscribe to a Topic for all of the ajax operations. There should be 
> a topic for when the response is received or handling an error response.
>   - use a custom handler that performs the posts. 
> I don't recall the details because I don't use these tags any more.  
> Topics are touched on at [1] and [2] but you're quite limited in 2.0.x 
> compared to 2.1.x. 
> Dojo may have some global events but you'll have to search the API.
> 
> Given that constraint, I'd use these basic approaches:
>   - return an HTML fragment for failed ajax requests instructing the 
> user to login with an appropriate link; and/or
>   - return an HTML fragment that also contains inline javascript that 
> performs a redirection to the login page.  Make sure you have 
> separateScripts=false and executeScripts=true on all the dojo tags.
> 
> I consider the latter case a hack but it should work with this version 
> of Dojo in all the relevant browsers.
> 
> Hope that helps!
> 
> [1] http://struts.apache.org/2.0.11/docs/ajax-tags.html
> [2]http://struts.apache.org/2.0.11/docs/ajax-and-javascript-recipes.html
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Interceptors-with-Ajax-Actions-tp15706322p15708088.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Interceptors with Ajax Actions

2008-02-26 Thread Grish

Thanks for the reply!

I'm a little unclear about using the header result and the javascript
callback. 

So I define a specific result for ajax actions and use the header type where
I define my own status code. Which will then be processed on the client
side.

I'm using the ajax theme with my struts tags, based on the struts 2
tutorial,  to implement ajax functionality. Where can I define my code to
catch the result and perform a redirect? I apologize for my inexperience.

I'm a little unclear on how to 

Jeromy Evans - Blue Sky Minds wrote:
> 
> Grish wrote:
>> Is there a way to intercept these ajax actions and properly direct my
>> users
>> to the login page? Or is my approach fundamentally wrong? Any
>> suggestions?
>>   
> 
> You can only force the redirect to a login page from the client-side.
> 
> There's a couple of ways you can do this:
>   - the interceptor can detect that the request is ajax either by the 
> partitioning of your packages/URLs or by inspecting the http header;
>   - return a custom http header when its an ajax request and 
> unauthorized (eg. return a 2xx or 4xx with a custom X-param).  See the 
> headers result type.
>   - in your javascript callback, detect the odd result and perform a 
> redirect
> 
> Hope that helps.
> 
> Jeromy Evans
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Interceptors-with-Ajax-Actions-tp15706322p15706535.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Interceptors with Ajax Actions

2008-02-26 Thread Grish

In my attempt to learn about interceptors, I tried creating a login
interceptor using Mark Menard's awesome cookbook. So I managed to make my
own login interceptor and everything is working fine. 

I realized though that I will encounter a problem when I intercept ajax
actions and direct the user to the login page. The result will come out on
the div area defined for that ajax action. True enough when I tried
submitting an ajax form, the login page appeared in the results div area.

I want to be able to direct my user to the login page regardless if it's an
ajax call or not. I tried experimenting with the other result types, or
redirecting the results to the login page but my login page still appears in
the div area as expected.

Is there a way to intercept these ajax actions and properly direct my users
to the login page? Or is my approach fundamentally wrong? Any suggestions?
-- 
View this message in context: 
http://www.nabble.com/Interceptors-with-Ajax-Actions-tp15706322p15706322.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Using il8n text in an interceptor

2008-02-13 Thread Grish

Well I read this:

"package.properties (of the directory where class is located and every
parent directory all the way to the root directory)"

and  tried moving around the package.properties around but findDefaultText
always returns null. My actions though are still able to retrieve the proper
text, but when my interceptor needs to access the resource bundle it can't
seem to find it. Anyone encountered a similar problem and figured it out? :(


Grish wrote:
> 
> Thanks for the suggestion! I tried integrating it to my code but the
> problem is findDefaultText always returns null. I traced the name and the
> locale that I am passing and they are correct. 
> 
> my package_en_US.properties is in my org.test.app.action package. My
> interceptor is in the org.test.app.interceptor package. Would the location
> of the property file be the problem? 
> 
> I read the API and I had the impression that if I moved up the properties
> up one level the properties file will still be seen. 
> 
> I tried moving it to org.test.app package  but i still seem to be getting
> null. Is there something wrong with my setup perhaps?
> 
> 
> Pablo Vazquez wrote:
>> 
>> // For future i18n purpose
>>  private String translate(String name) {
>> 
>>  String i18Name = LocalizedTextUtil.findDefaultText(name,
>> locale);
>> 
>>  if (i18Name == null) {
>>  i18Name = name;
>>  }
>> 
>>  return i18Name;
>>  }
>> 
>> Grish escribió:
>>> I'm studying how interceptors work and made a login interceptor based on
>>> Mark
>>> Menard's great tutorial:
>>> http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor
>>>
>>> I managed to integrate the interceptor in my sample application but I
>>> want
>>> to access my resource bundle for the localized error message. Is there a
>>> method similar to the getText method for Interceptors? What would be 
>>> the
>>> best approach for adding localized action error messages from an
>>> interceptor?
>>>   
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-il8n-text-in-an-interceptor-tp15427096p15473716.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Using il8n text in an interceptor

2008-02-12 Thread Grish

Thanks for the suggestion! I tried integrating it to my code but the problem
is findDefaultText always returns null. I traced the name and the locale
that I am passing and they are correct. 

my package_en_US.properties is in my org.test.app.action package. My
interceptor is in the org.test.app.interceptor package. Would the location
of the property file be the problem? 

I read the API and I had the impression that if I moved up the properties up
one level the properties file will still be seen. 

I tried moving it to org.test.app package  but i still seem to be getting
null. Is there something wrong with my setup perhaps?


Pablo Vazquez wrote:
> 
> // For future i18n purpose
>  private String translate(String name) {
> 
>  String i18Name = LocalizedTextUtil.findDefaultText(name, locale);
> 
>  if (i18Name == null) {
>  i18Name = name;
>  }
> 
>      return i18Name;
>  }
> 
> Grish escribió:
>> I'm studying how interceptors work and made a login interceptor based on
>> Mark
>> Menard's great tutorial:
>> http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor
>>
>> I managed to integrate the interceptor in my sample application but I
>> want
>> to access my resource bundle for the localized error message. Is there a
>> method similar to the getText method for Interceptors? What would be  the
>> best approach for adding localized action error messages from an
>> interceptor?
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-il8n-text-in-an-interceptor-tp15427096p15429285.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Using il8n text in an interceptor

2008-02-11 Thread Grish

I'm studying how interceptors work and made a login interceptor based on Mark
Menard's great tutorial:
http://www.vitarara.org/cms/struts_2_cookbook/creating_a_login_interceptor

I managed to integrate the interceptor in my sample application but I want
to access my resource bundle for the localized error message. Is there a
method similar to the getText method for Interceptors? What would be  the
best approach for adding localized action error messages from an
interceptor?
-- 
View this message in context: 
http://www.nabble.com/Using-il8n-text-in-an-interceptor-tp15427096p15427096.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Problems loading applet in Struts 2

2007-12-11 Thread Grish

well that's one of my problems, it seems like my browser hangs everytime the
page is rendered. I can't view the source of the page, so i can't verify the
codebase. So what I did try was putting the jar in the same folder as the
page. That didn't work, so I tried putting the class files in the same
directory as the page and jsut placed the class names. Unfortunately I get
the same error and my browser has to be killed in order to retry cuz it
seems to be in some kind of loop or hang.



Laurie Harper wrote:
> 
> Grish wrote:
>> Hi,
>> 
>> I just learned how to create applets and made my own ticker. It works
>> fine
>> but when I try to integrate it to my struts 2 project I have problems
>> loading the page with the applet. It seems like my browser hangs and I
>> need
>> to kill the process. 
>> 
>> I first did was package my applet and its files in a jar and placed it in
>> my
>> applets/ folder. Then on my page I had the following:
>> 
>> > codebase="${pageContext.request.contextPath}/applets/"
>> archive="ticker.jar">
>>   
>> 
>> but my applet doesn't load because it cannot find the TickerApplet class
>> and
>> my browser seems to hang. 
>> 
>> I get the following error:
>> 
>> load: class TickerApplet.class not found.
>> java.lang.ClassNotFoundException: TickerApplet.class
>>  at sun.applet.AppletClassLoader.findClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at sun.applet.AppletClassLoader.loadClass(Unknown Source)
>>  at java.lang.ClassLoader.loadClass(Unknown Source)
>>  at sun.applet.AppletClassLoader.loadCode(Unknown Source)
>>  at sun.applet.AppletPanel.createApplet(Unknown Source)
>>  at sun.plugin.AppletViewer.createApplet(Unknown Source)
>>  at sun.applet.AppletPanel.runLoader(Unknown Source)
>>  at sun.applet.AppletPanel.run(Unknown Source)
>>  at java.lang.Thread.run(Unknown Source)
>> Caused by: java.io.IOException: open HTTP connection failed.
>>  at sun.applet.AppletClassLoader.getBytes(Unknown Source)
>>  at sun.applet.AppletClassLoader.access$100(Unknown Source)
>>  at sun.applet.AppletClassLoader$1.run(Unknown Source)
>>  at java.security.AccessController.doPrivileged(Native Method)
>>  ... 10 more
>> 
>> I tried moving around my applet to the same directory as the page or just
>> use the class files but none of those approaches work.
>> 
>> Can anyone share any insight with my problem? Many thanks!
> 
> Look at the rendered HTML (view source) and check what's actually being 
> rendered as the value of the 'codebase' attribute. Does it look right? 
> What happens if you try visiting that URL? What happens if you append 
> 'ticker.jar' to that URL? Does the JAR file download?
> 
> Assuming that's all OK, check the contents of the JAR file (use 'jar -t 
> applets/ticker.jar); does it correctly contain all your applet's .class 
> files?
> 
> L.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Problems-loading-applet-in-Struts-2-tp14270527p14275440.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Problems loading applet in Struts 2

2007-12-11 Thread Grish

Hi,

I just learned how to create applets and made my own ticker. It works fine
but when I try to integrate it to my struts 2 project I have problems
loading the page with the applet. It seems like my browser hangs and I need
to kill the process. 

I first did was package my applet and its files in a jar and placed it in my
applets/ folder. Then on my page I had the following:


  

but my applet doesn't load because it cannot find the TickerApplet class and
my browser seems to hang. 

I get the following error:

load: class TickerApplet.class not found.
java.lang.ClassNotFoundException: TickerApplet.class
at sun.applet.AppletClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.applet.AppletClassLoader.loadCode(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: open HTTP connection failed.
at sun.applet.AppletClassLoader.getBytes(Unknown Source)
at sun.applet.AppletClassLoader.access$100(Unknown Source)
at sun.applet.AppletClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
... 10 more

I tried moving around my applet to the same directory as the page or just
use the class files but none of those approaches work.

Can anyone share any insight with my problem? Many thanks!
-- 
View this message in context: 
http://www.nabble.com/-S2--Problems-loading-applet-in-Struts-2-tp14270527p14270527.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Change updateFreq in a DIV

2007-11-07 Thread Grish

I did what you suggested and i saw the setInterval() function; which works!

Thanks for pointing me to the right direction and the learning experience!


Jeromy Evans - Blue Sky Minds wrote:
> 
> Grish wrote:
>> So I ended up with the following code:
>>
>> var myDiv = dojo.widget.byId("myDivId");
>> myDiv.timer.interval = newInterval;
>>
>>   
> Great!
>> Also you need to restart the timer by stopping it and starting again for
>> the
>> new interval to take effect. Would there be some kind of function I can
>> use
>> to change the interval or this is the only way?
>>
>>   
> Not sure, you know more about it than I do now.  If the div is using the 
> standard dojo timer (dojo.lang.timing.Timer) you should have access to 
> the setInterval(interval) method that looks like it will work while the 
> timer's running. 
> 
> myDiv.timer.setInterval(newInterval);
> 
> As with members, public methods should be browsable in Firebug.
> 
> If it is/extends a dojo timer, take a quick look at the implementation 
> in: 
> struts2-core-xxx.jar!/org/apache/struts2/static/dojo/src/lang/timing/Timer.js
> 
>>
>> Jeromy Evans - Blue Sky Minds wrote:
>>   
>>> Your code references "quoteDetails" but the div you provided is 
>>> "myDivId".  Other than that I don't see anything wrong with it. 
>>> updateFreq should be writeable using your approach although I haven't 
>>> tried it.
>>>
>>> Try a simple script:
>>>
>>>  var myWidget = dojo.widget.byId("myDivId");
>>>   myWidget.updateFreq = 10;
>>>
>>> Use a breakpoint in FireBug to ensure the widget is found and that the 
>>> updateFreq member is public.
>>>
>>> Hope that helps,
>>> Jeromy Evans
>>>
>>> Grish wrote:
>>> 
>>>> Ok I've made some progress but now i'm stuck. What I did was have a a
>>>> div
>>>> tag
>>>>
>>>>  >>>   showLoadingText="false" updateFreq="5000" autoStart="false" 
>>>>   startTimerListenTopics="/startTimer"
>>>> stopTimerListenTopics="/stopTimer" />
>>>>
>>>> then I have select box 
>>>>
>>>> >>> />
>>>>
>>>> then on my updateFreq function i have the following:
>>>>
>>>> function updateFreq(obj) {
>>>>   
>>>>   
>>>>   if (obj.selectedIndex == 0) {
>>>> dojo.event.topic.publish("/stopTimer");
>>>>   } 
>>>>   else {
>>>> // get Div and update frequency
>>>> var quoteDiv = dojo.byId("quoteDetails");
>>>> quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
>>>> dojo.event.topic.publish("/startTimer");
>>>>   }
>>>>   
>>>> }
>>>>
>>>> Right now everything is working except the change to the updateFreq.
>>>> When
>>>> the timer starts it still keeps with the 5 second interval Is it
>>>> possible
>>>> to
>>>> access this property and change it?
>>>>
>>>>
>>>>
>>>> Grish wrote:
>>>>   
>>>>   
>>>>> Hi,
>>>>>
>>>>> I'm having a hard time trying to implement this - I want to have a
>>>>> select
>>>>> box containing options for the user to select the update frequency of
>>>>> my
>>>>> div tag. So my select box has "no refresh", "30 seconds", "60
>>>>> seconds",
>>>>> "120 seconds" and depending on what the user selects the frequency
>>>>> will
>>>>> change. 
>>>>>
>>>>> I was thinking i could make a topic to change the updateFreq parameter
>>>>> then with the onchange event with the select tag i'll make a call for
>>>>> that
>>>>> topic:
>>>>>
>>>>> dojo.event.topic.subscribe("/changeRefresh", function(data, type,
>>>>> request)
>>>>> {
>>>>>   // code to change the updateFreq of the div tag
>>>>> }
>>>>>
>>>>> >>>> onchange="onchange="dojo.event.topic.publish('/changeRefresh')"
>>>>> ..
>>>>>
>>>>> I just don't know how to access the div tag and change the updateFreq
>>>>> parameter. I tried using the dojo.byId("myDivId") function but it
>>>>> didn't
>>>>> work. Suggestion on how to do this?
>>>>>
>>>>> Also just curious as to why there's no type variable when i call my
>>>>> topic
>>>>> from an event like onchange, it's always undefined. 
>>>>>
>>>>> 
>>>>> 
>>>>   
>>>>   
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>>
>>> 
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Triggering-topics-tf4722712.html#a13642168
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Change updateFreq in a DIV

2007-11-07 Thread Grish

Thanks for the reply!

Sorry about the example, the references were indeed wrong in my example but
the code was using the right references. My problem was when I would refer
to myDiv.updateFreq it would be undefined. But when I used your simple
script I was able to get the div widget and access the updateFreq. 

But it turned out that even if i changed the updateFreq my refresh interval
wouldn't work. So I took your advice and did a watch using firebug and
discovered there was a timer object and an interval property. Turns out
that's the one you have to modify.

So I ended up with the following code:

var myDiv = dojo.widget.byId("myDivId");
myDiv.timer.interval = newInterval;

Also you need to restart the timer by stopping it and starting again for the
new interval to take effect. Would there be some kind of function I can use
to change the interval or this is the only way?

Thanks again for the reply!



Jeromy Evans - Blue Sky Minds wrote:
> 
> Your code references "quoteDetails" but the div you provided is 
> "myDivId".  Other than that I don't see anything wrong with it. 
> updateFreq should be writeable using your approach although I haven't 
> tried it.
> 
> Try a simple script:
> 
>  var myWidget = dojo.widget.byId("myDivId");
>   myWidget.updateFreq = 10;
> 
> Use a breakpoint in FireBug to ensure the widget is found and that the 
> updateFreq member is public.
> 
> Hope that helps,
> Jeromy Evans
> 
> Grish wrote:
>> Ok I've made some progress but now i'm stuck. What I did was have a a div
>> tag
>>
>>  >   showLoadingText="false" updateFreq="5000" autoStart="false" 
>>   startTimerListenTopics="/startTimer"
>> stopTimerListenTopics="/stopTimer" />
>>
>> then I have select box 
>>
>> 
>>
>> then on my updateFreq function i have the following:
>>
>> function updateFreq(obj) {
>>   
>>   
>>   if (obj.selectedIndex == 0) {
>> dojo.event.topic.publish("/stopTimer");
>>   } 
>>   else {
>> // get Div and update frequency
>> var quoteDiv = dojo.byId("quoteDetails");
>> quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
>> dojo.event.topic.publish("/startTimer");
>>   }
>>   
>> }
>>
>> Right now everything is working except the change to the updateFreq. When
>> the timer starts it still keeps with the 5 second interval Is it possible
>> to
>> access this property and change it?
>>
>>
>>
>> Grish wrote:
>>   
>>> Hi,
>>>
>>> I'm having a hard time trying to implement this - I want to have a
>>> select
>>> box containing options for the user to select the update frequency of my
>>> div tag. So my select box has "no refresh", "30 seconds", "60 seconds",
>>> "120 seconds" and depending on what the user selects the frequency will
>>> change. 
>>>
>>> I was thinking i could make a topic to change the updateFreq parameter
>>> then with the onchange event with the select tag i'll make a call for
>>> that
>>> topic:
>>>
>>> dojo.event.topic.subscribe("/changeRefresh", function(data, type,
>>> request)
>>> {
>>>   // code to change the updateFreq of the div tag
>>> }
>>>
>>> >> onchange="onchange="dojo.event.topic.publish('/changeRefresh')"
>>> ..
>>>
>>> I just don't know how to access the div tag and change the updateFreq
>>> parameter. I tried using the dojo.byId("myDivId") function but it didn't
>>> work. Suggestion on how to do this?
>>>
>>> Also just curious as to why there's no type variable when i call my
>>> topic
>>> from an event like onchange, it's always undefined. 
>>>
>>> 
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Triggering-topics-tf4722712.html#a13640865
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Change updateFreq in a DIV

2007-11-06 Thread Grish

Ok I've made some progress but now i'm stuck. What I did was have a a div tag

 

then I have select box 



then on my updateFreq function i have the following:

function updateFreq(obj) {
  
  
  if (obj.selectedIndex == 0) {
dojo.event.topic.publish("/stopTimer");
  } 
  else {
// get Div and update frequency
var quoteDiv = dojo.byId("quoteDetails");
quoteDiv.updateFreq = obj.options[obj.selectedIndex].value;
dojo.event.topic.publish("/startTimer");
  }
  
}

Right now everything is working except the change to the updateFreq. When
the timer starts it still keeps with the 5 second interval Is it possible to
access this property and change it?



Grish wrote:
> 
> Hi,
> 
> I'm having a hard time trying to implement this - I want to have a select
> box containing options for the user to select the update frequency of my
> div tag. So my select box has "no refresh", "30 seconds", "60 seconds",
> "120 seconds" and depending on what the user selects the frequency will
> change. 
> 
> I was thinking i could make a topic to change the updateFreq parameter
> then with the onchange event with the select tag i'll make a call for that
> topic:
> 
> dojo.event.topic.subscribe("/changeRefresh", function(data, type, request)
> {
>   // code to change the updateFreq of the div tag
> }
> 
>  ..
> 
> I just don't know how to access the div tag and change the updateFreq
> parameter. I tried using the dojo.byId("myDivId") function but it didn't
> work. Suggestion on how to do this?
> 
> Also just curious as to why there's no type variable when i call my topic
> from an event like onchange, it's always undefined. 
> 

-- 
View this message in context: 
http://www.nabble.com/Triggering-topics-tf4722712.html#a13603045
Sent from the Struts - User mailing list archive at Nabble.com.


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



Triggering a topics

2007-10-30 Thread Grish

Hi,

I'm having a hard time trying to implement this - I want to have a select
box containing options for the user to select the update frequency of my div
tag. So my select box has "no refresh", "30 seconds", "60 seconds", "120
seconds" and depending on what the user selects the frequency will change. 

I was thinking i could make a topic to change the updateFreq parameter then
with the onchange event with the select tag i'll make a call for that topic:

dojo.event.topic.subscribe("/changeRefresh", function(data, type, request) {
  // code to change the updateFreq of the div tag
}

http://www.nabble.com/Triggering-a-topics-tf4722712.html#a13502518
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Access a SiteMesh Object in a Struts tag

2007-10-21 Thread Grish

After going through the OGNL documents and trial and error I was able to get
the properties from the page object from sitemesh using the following code:




Hope this is of some use to someone out there :)


Grish wrote:
> 
> So I tried the following:
> 
> 
> <% String current = myPage.getProperty("meta.current"); %>
> 
> 
> 
> but this displays blank. What I want to do is get the property from the
> Page object of sitemesh and make it accessible to my s2 tags. I was
> reading about OGNL and the syntax but i can't seem to get that property.
> Is my syntax incorrect?
> 
> 
> Grish wrote:
>> 
>> Hi,
>> 
>> I was wondering if this is possible, I want to access a SiteMesh object
>> in a struts tag like the set tag:
>> 
>> I want to access the Page object from SiteMesh and get a property from
>> that object and assign it a value
>> 
>> 
>> 
>> 
>> 
>> where value would be myPage.getProperty("meta.curentPage").
>> 
>> I have a feeling i'm just using incorrect syntax. Can anyone point me to
>> the right direction?
>> 
>> Thanks!
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Access-a-SiteMesh-Object-in-a-Struts-tag-tf4646229.html#a13336246
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Access a SiteMesh Object in a Struts tag

2007-10-19 Thread Grish

So I tried the following:


<% String current = myPage.getProperty("meta.current"); %>



but this displays blank. What I want to do is get the property from the Page
object of sitemesh and make it accessible to my s2 tags. I was reading about
OGNL and the syntax but i can't seem to get that property. Is my syntax
incorrect?


Grish wrote:
> 
> Hi,
> 
> I was wondering if this is possible, I want to access a SiteMesh object in
> a struts tag like the set tag:
> 
> I want to access the Page object from SiteMesh and get a property from
> that object and assign it a value
> 
> 
> 
> 
> 
> where value would be myPage.getProperty("meta.curentPage").
> 
> I have a feeling i'm just using incorrect syntax. Can anyone point me to
> the right direction?
> 
> Thanks!
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Access-a-SiteMesh-Object-in-a-Struts-tag-tf4646229.html#a13292503
Sent from the Struts - User mailing list archive at Nabble.com.


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



Access a SiteMesh Object in a Struts tag

2007-10-18 Thread Grish

Hi,

I was wondering if this is possible, I want to access a SiteMesh object in a
struts tag like the set tag:

I want to access the Page object from SiteMesh and get a property from that
object and assign it a value





where value would be myPage.getProperty("meta.curentPage").

I have a feeling i'm just using incorrect syntax. Can anyone point me to the
right direction?

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Access-a-SiteMesh-Object-in-a-Struts-tag-tf4646229.html#a13272172
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Issues with AJAX in IE

2007-09-18 Thread Grish

Hi,

Thanks for the reply! I was out of the office so I was only able to try it
out now. It works so I guess I'll use this approach for now. I applied some
CSS using "display: none". Again not the most elegant approaches but I guess
it will do. 

Is this really some bug? If anyone has other ways to address this feel free
to share :)

Thanks again for the input!


Meteora wrote:
> 
> Hi, i had exactly the same problem but i noticed it just happens when you
> have a single textfield. If you have 2 or more textfields... it works for
> me. Did you try with more textfields? I solved in this way: where i just
> have a single textfield, i add another invisible textfield (with border =
> 0) so it works in IE also (when you hit enter button).
> I know it could not be the correct way to do it but if it is really a
> bug at least this "solution" works.  :)
> Let me know if it works for you too, i hope so. Bye.
> 
> 
> 
> 
> Grish wrote:
>> 
>> 
>> But in IE, when I hit enter button instead of clicking on my submit
>> button the whole jsp for that ajax call is displayed instead of returning
>> the output in the DIV area. With Firefox there is no issue. I've noticed
>> this in IE 6 and 7.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Issues-with-AJAX-in-IE-tf4210453.html#a12770357
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Issues with AJAX in IE

2007-09-12 Thread Grish

Well I checked out the samples in the struts 2 showcase and I get the same
problem.

It seems that when I submit a form using the enter key instead of clicking
the button my results displayed in a new page still. Again this only occurs
in IE 6, 7 (haven't tested with lower versions). I figured I could add a
javascript where I check if the user hits the enter key and then just submit
the form, but then I'll have to do that for every ajax form. 

Has anyone encountered this issue before or is there something wrong with my
code. It works fine though in firefox.


Grish wrote:
> 
> I'm not so sure if this is some bug, but I noticed an odd behaviour with
> my AJAX forms in IE.
> 
> For Firefox, if I hit the submit button for my form, my output is
> displayed in my DIV area as exepcted. Same for IE. But in IE, when I hit
> enter button instead of clicking on my submit button the whole jsp for
> that ajax call is displayed instead of returning the output in the DIV
> area. With Firefox there is no issue. I've noticed this in IE 6 and 7.
> 
> I'm actually modifying the Struts 2 + Spring 2 + JPA + AJAX tutorial.
> Here's my code:
> 
> 
>name="searchCriteria" />
>   
> 
> 
> 
> 
>loadingText="Loading..." />
> 
> 
> I don't know if this is some bug or there's something wrong with my setup.
> Has anyone encountered a similar problem?
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Issues-with-AJAX-in-IE-tf4210453.html#a12631120
Sent from the Struts - User mailing list archive at Nabble.com.


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



RE: [S2] using the AJAX theme

2007-09-11 Thread Grish

Thanks for the suggestion. What I did was made a simple_ajax theme where I
excluded the additional HTML wrapping. I'll just continue to edit this theme
to meet my needs as I go along. 

If anyone had other approaches I'm curious to see what they've done. 

Thanks again for the help Jason!


jjoz wrote:
> 
> Hi Grish,
> 
> We faced the similar problem... we wanted to use ajax tabbedPanels, which
> needed ajax-themed struts2 submit buttons. The submit buttons were
> producing
> additional html wrapping for the 2 columns.
> 
> We just extracted the submit.ftl template code into a web\template\ajax
> directory and removed the additional html wrapping from the top and
> bottom.
> 
> I think this was the only tag that was causing us problems, as it was the
> only one that needed to be ajax-themed for our tabbedPanels to work... All
> other fields in the tabs are default (non-ajax) theme. 
> 
> I presume you could do this to each of the tags you want to use, or as you
> suggested, you could try create a whole new theme if time permits.
> 
> Regards
> Jason
> 
> 
> -
> Falun Dafa  Truth - Compassion - Forbearance
> 
> A mind & body practice under persecution in China
> 
> http://www.faluninfo.net
> 
> 
> 
> -Original Message-
> From: Grish [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, 11 September 2007 2:38 PM
> To: user@struts.apache.org
> Subject: [S2] using the AJAX theme
> 
> 
> I've been trying out ajax with s2 and I like how the ajax theme and the s2
> tags allow me to do more with less code. 
> 
> Usually the 2 column table layout works for most of my needs but there are
> some forms that I rather not have the additional code (like a form with
> one
> field and I want the submit button beside that field) so I either use the
> simple theme or just produce the html code. 
> 
> But some of my submit buttons use the ajax theme and produce some html
> code
> since, based on what i read, is based on the xhtml theme. Is there a
> simple
> ajax theme? where it produces the neccessary ajax code but not the html
> tags?
> 
> I take it I either have to make the html tags for my ajax buttons or just
> use css to force my style. I'm just curious what others have done. I was
> hoping to get the best of both worlds with using the tags for less code
> and
> have an elegant way of arranging things.
> 
> Thanks & regards!
> --
> View this message in context:
> http://www.nabble.com/-S2--using-the-AJAX-theme-tf4420235.html#a12607918
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--using-the-AJAX-theme-tf4420235.html#a12627809
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] using the AJAX theme

2007-09-10 Thread Grish

I've been trying out ajax with s2 and I like how the ajax theme and the s2
tags allow me to do more with less code. 

Usually the 2 column table layout works for most of my needs but there are
some forms that I rather not have the additional code (like a form with one
field and I want the submit button beside that field) so I either use the
simple theme or just produce the html code. 

But some of my submit buttons use the ajax theme and produce some html code
since, based on what i read, is based on the xhtml theme. Is there a simple
ajax theme? where it produces the neccessary ajax code but not the html
tags?

I take it I either have to make the html tags for my ajax buttons or just
use css to force my style. I'm just curious what others have done. I was
hoping to get the best of both worlds with using the tags for less code and
have an elegant way of arranging things.

Thanks & regards!
-- 
View this message in context: 
http://www.nabble.com/-S2--using-the-AJAX-theme-tf4420235.html#a12607918
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Issues with AJAX in IE

2007-08-02 Thread Grish

I'm not so sure if this is some bug, but I noticed an odd behaviour with my
AJAX forms in IE.

For Firefox, if I hit the submit button for my form, my output is displayed
in my DIV area as exepcted. Same for IE. But in IE, when I hit enter button
instead of clicking on my submit button the whole jsp for that ajax call is
displayed instead of returning the output in the DIV area. With Firefox
there is no issue. I've noticed this in IE 6 and 7.

I'm actually modifying the Struts 2 + Spring 2 + JPA + AJAX tutorial. Here's
my code:


  
  




  


I don't know if this is some bug or there's something wrong with my setup.
Has anyone encountered a similar problem?
-- 
View this message in context: 
http://www.nabble.com/-S2--Issues-with-AJAX-in-IE-tf4210453.html#a11977018
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Parameterized File Downloading

2007-08-02 Thread Grish

Ok, I finally see the error of my ways:

I originally defined my parameter like this:


when it should be like this:



now the proper string is passed.
Thanks so much for the help!


DNewfield wrote:
> 
> Grish wrote:
>> 
>>   
>> 
>> Get image
> 
> So does this generate a link relative to your webapp of 
> filedownload/download.action?inputPath=/images/test.gif
> 
> ?
> 
> ( note, ".action" could be ".do", ".html" or whatever you have that 
> extension set to, apparently even "".  (I may have to try that in my 
> app...) )
> 
> If so, then the problem is somewhere between the receipt of the request 
> and the handoff after the execute() method is run from the bean defined 
> as fileDownloadAction.  I leave it to you to trace through the process.
> Is the setter being called?  In the execute method is there a value?  Is 
> it using the class you think it's using?  You can specify a method 
> (other than the default execute) if you'd like to put your checks there.
> 
> -Dale
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Parameterized-File-Downloading-tf4191759.html#a11976775
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Parameterized File Downloading

2007-08-01 Thread Grish

Good ideas! I try them out, my only problem now is that if i try to pass the
parameter via the link, I still get the following error:

Can not find a java.io.InputStream with the name [inputStream] in the
invocation stack. Check the  tag specified for this action.

this is my action:






image/gif
inputStream
filename="test.gif"
4096





Same as in the struts 2 showcase example but I removed the set parameter for
the action.

Then I defined my link like so:


  

Get image

I check the logs and I notice my inputPath parameter in my
fileDownloadAction is null. I have a setter for my inputPath parameter so I
don't understand why it's null or why I get this error.

Is there something wrong with my setup? If I do put a parameter for the
inputPath in my action definition like in the Struts 2 showcase example, it
works fine. Any ideas?



DNewfield wrote:
> 
> Grish wrote:
>> Hmmm good point. So does this mean that the only secure way of having
>> downloads is to have specific actions for each download? Or is there a
>> better approach?
> 
> I don't claim to know what the best approach is.  As long as your action 
> does sufficient validation of the specified input path (like checking 
> against a whitelist, or only allowing from certain directories (check 
> for ".." path segments!)), your approach may be OK.  I tend to have a 
> separate action for each "category" of stuff downloaded from my app 
> (along with category-specific validation).  Since I don't know your 
> requirements, I cannot know that that is applicable for you.
> 
> -Dale
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Parameterized-File-Downloading-tf4191759.html#a11957463
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Parameterized File Downloading

2007-07-31 Thread Grish

Isn't it closed with the /> in the end?



I just copied the examples in the tutorials and url examples:
http://struts.apache.org/2.x/docs/url.html


nuwan chandrasoma-2 wrote:
> 
> Hi,
> 
> Is it a typo, I dont see a  tag in ur code?
> 
> Thanks,
> 
> Nuwan
> 
> Grish wrote:
>> I studied the struts showcase sample of file downloading. I wanted to do
>> something similar but instead of setting the inputPath paremeter in
>> struts.xml I wanted to pass it in the url. I was thinking of using the
>> same
>> action for several downloads and I would just pass the inputPath. But
>> when I
>> tried using the following:
>>
>> 
>>  
>> download file
>>
>> and I took out the inputPath param in the struts.xml:
>>
>> 
>>   
>> image/gif
>> inputStream
>> filename="test.gif"
>> 4096
>>   
>> 
>>
>> I noticed that my inputPath would be null and I would get the following
>> error:
>>
>> java.lang.IllegalArgumentException: Can not find a java.io.InputStream
>> with
>> the name [inputStream] in the invocation stack
>>
>> Is there another way i should be setting my inputPath parameter for my
>> File
>> or do I just have to make a lot of actions for each of my download?
>>
>>
>>   
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Parameterized-File-Downloading-tf4191759.html#a11938302
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Parameterized File Downloading

2007-07-31 Thread Grish

Hmmm good point. So does this mean that the only secure way of having
downloads is to have specific actions for each download? Or is there a
better approach?


DNewfield wrote:
> 
> Grish wrote:
>> I studied the struts showcase sample of file downloading. I wanted to do
>> something similar but instead of setting the inputPath paremeter in
>> struts.xml I wanted to pass it in the url.
> 
> Sounds like you're opening a very large security hole here...
> 
> -Dale
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Parameterized-File-Downloading-tf4191759.html#a11938299
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Parameterized File Downloading

2007-07-31 Thread Grish

I studied the struts showcase sample of file downloading. I wanted to do
something similar but instead of setting the inputPath paremeter in
struts.xml I wanted to pass it in the url. I was thinking of using the same
action for several downloads and I would just pass the inputPath. But when I
tried using the following:



download file

and I took out the inputPath param in the struts.xml:


  
image/gif
inputStream
filename="test.gif"
4096
  


I noticed that my inputPath would be null and I would get the following
error:

java.lang.IllegalArgumentException: Can not find a java.io.InputStream with
the name [inputStream] in the invocation stack

Is there another way i should be setting my inputPath parameter for my File
or do I just have to make a lot of actions for each of my download?


-- 
View this message in context: 
http://www.nabble.com/-S2--Parameterized-File-Downloading-tf4191759.html#a11920666
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] AJAX with Sitemesh

2007-07-30 Thread Grish

Thanks for the suggestion! I tried both methods so I can learn. I can see
myself using both approaches in the future.

Although I noticed one thing, I had a page with 2 forms and whenever I have
one of the forms submit my ajax call, a "TypeError: elements has no
properties" message is returned. This only occurs when I put the sitemesh
filter on. Most of the form elements were just generated using the struts
tags. I tried disabling the validate parameter and I didn't get the error
anymore. Could this error be part of the js code generated for validations?

Is it alright (or proper practice) to have 2 forms in one page calling
different actions?

Thanks again for the help!


Musachy Barroso wrote:
> 
> Another way (I like the pattern exclusion better) is to set a request
> attribute "decorator" to "none"
> 
> musachy
> 
> On 7/30/07, Mark Menard <[EMAIL PROTECTED]> wrote:
>> On 7/30/07 2:06 AM, "Grish" <[EMAIL PROTECTED]> wrote:
>>
>> >
>> > I tried taking a modified version of the Struts 2 + Spring 2 + JPA +
>> AJAX
>> > tutorial that I've done and integrated it with Sitemesh.
>> >
>> > I realized that if i have div tags with the ajax theme, Sitemesh will
>> > decorate that area so I will end up with and embedded decorator in the
>> main
>> > page. I need to exclude my AJAX calls from being decorated. I
>> understand
>> > that Sitemesh has a decorators.xml where you can specify which urls are
>> not
>> > to be decorated:
>> >
>> >   
>> >   
>> > /styles/*
>> > /scripts/*
>> > /images/*
>> > /ajax/*
>> > /dojo/*
>> > /struts/*
>> > /nodecorate/*
>> >   
>> >
>> > I first thought I simply had to move my jsps to a folder that was part
>> of
>> > the sitemesh excludes, like the ajax folder or the nodecorate folder. I
>> have
>> > a page called person.jsp and when I list the results of my search using
>> ajax
>> > I use the personList.jsp. I moved the personList.jsp to an excluded
>> folder
>> > but Sitemesh still decorated my personList.jsp.
>>
>> The exclusion is based on the requested URL, not where the file is in
>> your
>> project.
>>
>> This is what I did. I have two action definitions,
>>
>>
>> 
>> 
>>
>>
>> Requests to createPO.action should be decorated, calls to
>> createPOAjax.action shouldn't.
>>
>>
>> 
>> *Ajax.action*
>> 
>>
>> I'm not sure if the second * is necessary, but it works. I also use one
>> class with two action definitions. I have methods that handle the Ajax
>> stuff
>> in the same class file so everything is nicely contained and I use the
>> method argument to the request to call the specific method I want.
>>
>> Take care,
>> Mark
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--AJAX-with-Sitemesh-tf4168148.html#a11912793
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] AJAX with Sitemesh

2007-07-29 Thread Grish

I tried taking a modified version of the Struts 2 + Spring 2 + JPA + AJAX
tutorial that I've done and integrated it with Sitemesh.

I realized that if i have div tags with the ajax theme, Sitemesh will
decorate that area so I will end up with and embedded decorator in the main
page. I need to exclude my AJAX calls from being decorated. I understand
that Sitemesh has a decorators.xml where you can specify which urls are not
to be decorated:

  
  
/styles/*
/scripts/*
/images/*
/ajax/*
/dojo/*
/struts/*
/nodecorate/*
  

I first thought I simply had to move my jsps to a folder that was part of
the sitemesh excludes, like the ajax folder or the nodecorate folder. I have
a page called person.jsp and when I list the results of my search using ajax
I use the personList.jsp. I moved the personList.jsp to an excluded folder
but Sitemesh still decorated my personList.jsp.

I tried adding the namepspace to the excludes and it turned out that any
actions in that namesspace wasn't decorated, includeing person.jsp. I don't
want to seperate all my actions that are ajax calls into one namespace, so
is there a better way in implementing this? I have a feeling i'm approaching
this all wrong.

-- 
View this message in context: 
http://www.nabble.com/-S2--AJAX-with-Sitemesh-tf4168148.html#a11858517
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Multiple Submits with different actions in a Form

2007-07-25 Thread Grish

Yeah this should work, If i can't find an alternative I most likely will take
this approach. But I was hoping to find a solution that didn't require me to
code a lot of logic using js in the client side. It seems a lot easier if I
can just specifiy the actions with a few controls and the rest is processed
at the server side.


Richard Sayre wrote:
> 
> I'm not sure if this is what your are looking for, it is doing the
> control logic on the client side. Instead of using s:submit to submit
> the form you could make 3 input buttons:
> 
> 
> 
> 
> 
> and the write the following javascript:
> 
> function doAction1() {
> 
>document.getElementById("formId").action = ' action="myAction1"'/>;
>document.getElementById("formId").submit();
> 
> }
> 
> function doAction2() {
> 
>document.getElementById("formId").action = ' action="myAction2"'/>;
>document.getElementById("formId").submit();
> 
> }
> 
> function doAction3() {
> 
>document.getElementById("formId").action = ' action="myAction3"'/>;
>document.getElementById("formId").submit();
> 
> }
> 
> then in your struts.xml:
> 
> 
> .
> .
> .
> 
> 
> 
> 
> .
> .
> .
> 
> 
> 
> 
> .
> .
> .
> 
> 
> You don't have to use the Ajax theme on your form, you can write the
> Javascript using the DOJO library your self.  All the nessary files
> are included when you use the s:head tag
> 
> On 7/25/07, Grish <[EMAIL PROTECTED]> wrote:
>>
>> I'm still in the process of learning S2 and I was curious on what's the
>> best
>> practice in implementing a form with multiple submit buttons
>>
>> I've read that there are multiple way to implement this.
>> One way is here:
>> http://struts.apache.org/2.0.8/docs/multiple-submit-buttons.html
>> Although I was thinking I had to redo my setup of my action class and
>> have
>> all the actions point to one method - execute() and from there i would
>> check
>> a parameter to determine what my next step would be:
>>
>> public String execute() {
>>   if (method.equals(searchMethod)) {
>>  doSearch();
>>  return SUCCESS;
>>   }
>>   if (method.equals(addMethod)) {
>>  doAdd();
>>  return SUCCESS;
>>   }
>>}
>>
>> something to that effect.
>>
>> But I also wanted to try having an action class with different methods
>> and
>> in my struts.xml the different actions would point to the different
>> methods
>> of my action class.
>>
>> My problem though is I have a form with multiple submit buttons. I tried
>> specifying the action on each submit button but the action in my form
>> overrides the action specified in the buttons. I tried removing the
>> action
>> parameter in my form but it would take the current action and still
>> override
>> the actions specified in the buttons. How do I have a form with multiple
>> submit buttons with different actions? What would be the best practice in
>> implementing this? Would implementation be any different if my submit
>> buttons are ajax themed?
>>
>> Thanks
>> --
>> View this message in context:
>> http://www.nabble.com/-S2--Multiple-Submits-with-different-actions-in-a-Form-tf4140299.html#a11776889
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Multiple-Submits-with-different-actions-in-a-Form-tf4140299.html#a11803845
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Multiple Submits with different actions in a Form

2007-07-25 Thread Grish

no, what happens is the action specified in the form is what's executed. I'm
using firefox as well.

here's my button:



I tried having the form specify one action and one button have to submit the
form, and another button (like the one above) to have the form submit to
another action. But it seems the action in the form overrides my button.



David Durham, Jr. wrote:
> 
> On 7/25/07, Grish <[EMAIL PROTECTED]> wrote:
>> My problem though is I have a form with multiple submit buttons. I tried
>> specifying the action on each submit button but the action in my form
>> overrides the action specified in the buttons.
> 
> I have success with this technique in Firefox, but I think it's broken
> in IE.  Is this what you're seeing?
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Multiple-Submits-with-different-actions-in-a-Form-tf4140299.html#a1178
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: [S2] Validation error messages pile up

2007-07-25 Thread Grish

I have the same problem. Error messages on one form are piling up. Were you
able to resolve this probelm? It only occurs in Firefox as well.

I notice it occurs when you have multiple forms.



Rafael Dittberner wrote:
> 
> The first one.
> 
> Rafael Dittberner
> 
> 
> Musachy Barroso escreveu:
>> On which field are they piling up?
>> 
>> musachy
>> 
>> On 6/14/07, Rafael Dittberner <[EMAIL PROTECTED]> wrote:
>>>
>>> In one of my forms the validation error messages are piling up every
>>> time the submit button is pressed. This only occurs in Firefox and only
>>> with this form. I have other form working well both in IE and FF.
>>>
>>> Anyone can help me?
>>>
>>> The form:
>>> <%@ page language="java" contentType="text/html; charset=UTF-8"
>>> pageEncoding="UTF-8"%>
>>> <%@ taglib prefix="s" uri="/struts-tags"%>
>>>
>>> 
>>> 
>>> " rel="stylesheet"
>>> type="text/css" />
>>> 
>>> 
>>>
>>> 
>>> 
>>> 
>>>
>>> Cadastro de órgãos
>>>
>>> >> validate="true" namespace="/restrita">
>>> >> cssStyle="display:none" theme="simple" />
>>> >> value="%{orgao.nome}"
>>> required="true" size="70" maxlength="70" theme="xhtml" />
>>> >> listKey="codObjeto" listValue="nome" value="%{orgao.tipo.codObjeto}"
>>> required="true" />
>>> >> value="%{orgao.endereco}" size="70" maxlength="70" />
>>> >> size="30" maxlength="50" />
>>> >> size="2"
>>> maxlength="2" />
>>> >> required="false" size="10" maxlength="8" />
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>>
>>> 
>>> 
>>>
>>> The validation.xml file:
>>> >> "-//OpenSymphony Group//XWork Validator 1.0//EN"
>>> "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>
>>> 
>>> 
>>> 
>>> O campo nome é obrigatório.
>>> 
>>> 
>>> 70
>>> O campo nome deve ter no máximo 70
>>> caracteres.
>>> 
>>> 
>>> 
>>> 
>>> 70
>>> O campo endereço deve ter no máximo 70
>>> caracteres.
>>> 
>>> 
>>> 
>>> 
>>> 50
>>> O campo cidade deve ter no máximo 50
>>> caracteres.
>>> 
>>> 
>>> 
>>> 
>>> 2
>>> O campo UF deve ter no máximo 2
>>> caracteres.
>>> 
>>> 
>>> 
>>> 
>>> 8
>>> O campo CEP deve ter no máximo 8
>>> caracteres.
>>> 
>>> 
>>> 
>>>
>>> FF version 2.0.0.4
>>> IE version 6.0.2900
>>> Struts version 2.0.6
>>>
>>> -- 
>>> Rafael Dittberner
>>>
>>>
>>> -
>>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>> 
>> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-S2--Validation-error-messages-pile-up-tf3923602.html#a11779091
Sent from the Struts - User mailing list archive at Nabble.com.


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



[S2] Multiple Submits with different actions in a Form

2007-07-24 Thread Grish

I'm still in the process of learning S2 and I was curious on what's the best
practice in implementing a form with multiple submit buttons

I've read that there are multiple way to implement this. 
One way is here:
http://struts.apache.org/2.0.8/docs/multiple-submit-buttons.html
Although I was thinking I had to redo my setup of my action class and have
all the actions point to one method - execute() and from there i would check
a parameter to determine what my next step would be:

public String execute() {
  if (method.equals(searchMethod)) {
 doSearch();
 return SUCCESS;
  }
  if (method.equals(addMethod)) {
 doAdd();
 return SUCCESS;
  }
   }

something to that effect.

But I also wanted to try having an action class with different methods and
in my struts.xml the different actions would point to the different methods
of my action class.

My problem though is I have a form with multiple submit buttons. I tried
specifying the action on each submit button but the action in my form
overrides the action specified in the buttons. I tried removing the action
parameter in my form but it would take the current action and still override
the actions specified in the buttons. How do I have a form with multiple
submit buttons with different actions? What would be the best practice in
implementing this? Would implementation be any different if my submit
buttons are ajax themed?

Thanks
-- 
View this message in context: 
http://www.nabble.com/-S2--Multiple-Submits-with-different-actions-in-a-Form-tf4140299.html#a11776889
Sent from the Struts - User mailing list archive at Nabble.com.


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