Re: Struts 2.1 Tree Problem

2008-09-12 Thread Narayana S
i found solution to the parent node item.

here is the code snippet ..
*tree construction *

-
-

*java Script code *

dojo.event.topic.subscribe("treeExpand", function treeNodeExpanded(message)
{
 alert(message.node.widgetId);
});


while constructing the tree expandedNotifyTopics attribute can be used to
specify the function to be executed while expanding the tree, when a node is
expanded i am taking that root node and preserve in a variable... so when a
node is selected what is there in the parent variable is the parent node.

still i didn't find a way to show tree extended default... any help is
greatly appreciated.

Thanks in advance

On Fri, Sep 12, 2008 at 12:06 PM, Jukka Välimaa <[EMAIL PROTECTED]>wrote:

> As far as I know, there is no way to set some nodes already extended
> server-side. You can open the nodes you want client-side using javascript,
> however.
> On Fri, Sep 12, 2008 at 6:48 AM, Narayana S <[EMAIL PROTECTED]>
> wrote:
>
> > Hi Jim,
> >
> >Thanks for your reply, tree control default shows only root
> > node, but
> > 1. i want it to be shown extended by default to show the specified active
> > node.
> > 2. if i pass any node i want to find out the parent node of that node in
> > the
> > jsp page itself (in DOJO)
> >
> > i am kind of stuck in my process...  help me.
> >
> >
> >
> >
> > On Thu, Sep 11, 2008 at 6:23 PM, Jim Kiley <[EMAIL PROTECTED]>
> wrote:
> >
> > > We aren't deliberately ignoring you... many readers of this list are in
> > the
> > > Americas, and you sent your first message after most of us went to bed
> > and
> > > your followup before most of us woke up. :-)
> > > (I have no idea what the answer to your question is, I have not used
> the
> > > tree control at all -- but what have you tried? Can you share your code
> > > with
> > > us so that we can help point you in the right direction?)
> > >
> > > jk
> > >
> > > On Thu, Sep 11, 2008 at 5:08 AM, Narayana S <[EMAIL PROTECTED]>
> > > wrote:
> > >
> > > > did any one see this email please help me
> > > >
> > > > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <[EMAIL PROTECTED]
> >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > >now i am working with tree control, when i load the tree i want
> to
> > > > load
> > > > > it default extended and what ever the node id i pass that should be
> > > > > activated. how i can achieve this using struts 2.1 version. and one
> > > more
> > > > > thing is when i select a node in the jsp page itself i have to find
> > out
> > > > the
> > > > > parent of the node selected.
> > > > >
> > > > > please help me to solve this issue, i am kind of stuck..
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Jim Kiley
> > > Technical Consultant | Summa
> > > [p] 412.258.3346 [m] 412.445.1729
> > > http://www.summa-tech.com
> > >
> >
>


Re: Struts2 + Dojo 0.4 + unbeforeunload problem

2008-09-12 Thread Pablo Vázquez Blázquez

dojo.connect does not exist in dojo 0.4 :(

And separateScritpts attribute neither does in struts 2.0.9.

Jeromy Evans escribió:

Pablo Vázquez Blázquez wrote:
Using dojo.addOnUnload(function) neither works. Besides that, I would 
need sht like dojo.addOnBeforeUnload, but it does not exist.


I don´t think I should subscribe for an ajax-request-completion 
event, but for the beforeunload one, don´t I?


Thanks.


Use the dojo.connect function to listen to an arbitrary event.  See 
the comments to this related post: 
http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/when-does-unload-event-get-fired 



I don't use it myself. Just pointing you in the right direction.

Also, if the script is inline within your ajax response, see the 
recently updated notes on Handling AJAX Responses here:

http://struts.apache.org/2.x/docs/ajax-tags.html
(its written for 2.1 but mostly applies)
I'd consider turning on separateScritpts as well.





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





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



Re: Struts2 + Dojo 0.4 + unbeforeunload problem

2008-09-12 Thread Pablo Vázquez Blázquez


   var form = document.forms[0];
   if ((form) && (formIsDirty(form))) {
var a = confirm("There are unsaved changes. Do you want to continue?");
   if (!a) {
   dojo.event.topic.publish("/cancelNavigation");
  //HOW TO CANCEL NAVIGATION??
   }
   }
onbeforeunload = function(e) {
   if (formIsDirty(document.forms[0])) {
   e.returnValue = "There are unsaved changes.";
   }
   }


When calling topic "/cancelNavigation" the event paremeter is 
undefined... Do you know any way to cancel navigation? I mean, cancel 
rendering the served page.



Jeromy Evans escribió:

Pablo Vázquez Blázquez wrote:
Using dojo.addOnUnload(function) neither works. Besides that, I would 
need sht like dojo.addOnBeforeUnload, but it does not exist.


I don´t think I should subscribe for an ajax-request-completion 
event, but for the beforeunload one, don´t I?


Thanks.


Use the dojo.connect function to listen to an arbitrary event.  See 
the comments to this related post: 
http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/when-does-unload-event-get-fired 



I don't use it myself. Just pointing you in the right direction.

Also, if the script is inline within your ajax response, see the 
recently updated notes on Handling AJAX Responses here:

http://struts.apache.org/2.x/docs/ajax-tags.html
(its written for 2.1 but mostly applies)
I'd consider turning on separateScritpts as well.





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





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



Re: Struts2 + Dojo 0.4 + unbeforeunload problem

2008-09-12 Thread Jeromy Evans
I don't really know as i don't use dojo or the ajax tags for any more 
for all the same reasons you're experiencing.


Dojo's event model is based on AOP concepts; which allows you to bind 
functions to the event, before the event or after the event.
So you need a listener attached to before the unload event and tell it 
to not proceed with the default operation...somehow...


If this was native javascript you'd simply call event.preventDefault()

Related example:
ie. So, if you were doing a confirm for a submit, the submit button 
would publish a topic (/submit)

You attach a listener to the before /submit topic
It prompts "Are you sure?"
If they say no, you cancel the event by setting the event.cancel flag.

In the case of a beforeunload event caught via dojo...not sure.  But if 
you can get the listener invoked by dojo, then either the scope (this) 
or the argument (event) will reference an event object that probably has 
the cancel flag.


Otherwise you could try a e.preventDefault using plain old javascript if 
you have a reference to the native event object.


The recipes below are for Dojo 0.4.x; so even though they use 2.1.x 
tags, the javascript itself also works in Struts 2.0.x; you just have to 
write the javascript yourself thats included by within the new tag widgets.


http://struts.apache.org/2.x/docs/ajax-and-javascript-recipes.html

Pablo Vázquez Blázquez wrote:


   var form = document.forms[0];
   if ((form) && (formIsDirty(form))) {
var a = confirm("There are unsaved changes. Do you want to continue?");
   if (!a) {
   dojo.event.topic.publish("/cancelNavigation");
  //HOW TO CANCEL NAVIGATION??
   }
   }
 onbeforeunload = function(e) {
   if (formIsDirty(document.forms[0])) {
   e.returnValue = "There are unsaved changes.";
   }
   }


When calling topic "/cancelNavigation" the event paremeter is 
undefined... Do you know any way to cancel navigation? I mean, cancel 
rendering the served page.



Jeromy Evans escribió:

Pablo Vázquez Blázquez wrote:
Using dojo.addOnUnload(function) neither works. Besides that, I 
would need sht like dojo.addOnBeforeUnload, but it does not exist.


I don´t think I should subscribe for an ajax-request-completion 
event, but for the beforeunload one, don´t I?


Thanks.


Use the dojo.connect function to listen to an arbitrary event.  See 
the comments to this related post: 
http://dojotoolkit.org/forum/dojo-core-dojo-0-9/dojo-core-support/when-does-unload-event-get-fired 



I don't use it myself. Just pointing you in the right direction.

Also, if the script is inline within your ajax response, see the 
recently updated notes on Handling AJAX Responses here:

http://struts.apache.org/2.x/docs/ajax-tags.html
(its written for 2.1 but mostly applies)
I'd consider turning on separateScritpts as well.





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





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





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



Struts 1.2.9 +Ajax Error -- java.lang.IllegalStateException

2008-09-12 Thread Raghuveer
Hello,

I am using Ajax in my struts application.

 

>From JavaScript in JSP page I call "employee.do?method=employee"

 

 

I get following error

java.lang.IllegalStateException: Cannot forward after response has been
committed

 

 

For Ajax calls I am using struts execute method.

But Action Forward may not be used.

 

Any suggestion for this to resolve.

I assume I get this error because of "return
mapping.findForward(strResult)";

Actual my response is already done for Ajax requests through
response.getWriter,

So struts actionforward may not be used in this scenarios.

 

 

 

 

 

public ActionForward employee(final ActionMapping mapping, final ActionForm
form, final HttpServletRequest request, final HttpServletResponse response)
{

 

  

  

  try {

 

 

sb.append("");

sb.append("100");

sb.append("john");

sb.append("[EMAIL PROTECTED]");

sb.append("123123");

sb.append("");

  

response.setHeader("Cache-Control", "no-cache");

 

out = response.getWriter();

out.println(sb);

out.flush();

out.close();

  } catch (IOException e) {

logger.error("IOException - "+e);

handleException(e, CLASS_NAME, request);

strResult=CActionPageForwards.GLOBAL_FORWARD_ACTIONERROR;   

  }finally{

//if (out != null) {

//out.close();

  //out = null;

//}

  }

 

strResult=CActionPageForwards.FORWARD_EMPLOYEE_REQUEST;

logger.info("Result - "+strResult);

return mapping.findForward(strResult);

 

}//end execute

 



Re: Unit Testing Struts 2

2008-09-12 Thread Greg Lindholm

Here is a blog writeup of what I'm using. It allows you to test interceptors.

http://glindholm.wordpress.com/2008/06/30/unit-testing-struts-2-actions/


Mark-413 wrote:
> 
> Hi all:
> 
> Does anyone have a working example of unit testing a Struts 2 app?   
> I've been looking around for awhile know and found the following  
> resources.  However, I've not been able to get any of them to work.
> 
> http://depressedprogrammer.wordpress.com/2007/06/18/unit-testing- 
> struts-2-actions-spring-junit/
> http://www.soft-gems.net/index.php? 
> option=com_content&task=view&id=47&Itemid=33
> http://struts.apache.org/2.0.8/docs/how-can-we-test-actions.html
> 
> I'm using Struts 2.1.3 and want to test Interceptors and result  
> types, not just the Action POJO's.
> 
> Any help or resources are greatly appreciated!
> Mark
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Unit-Testing-Struts-2-tp19428146p19451533.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]



AW: Struts 2.1 Tree Problem

2008-09-12 Thread Jan Froehlich
Hi...

just try to add this short script to the page that contains your tree...
Might possibly be not the most beautiful solution, but works for me!

dojo.event.topic.subscribe("tree/treeCreate", function 
treeCreated(node) {
// get all treenodes and iterate through
var nodes = dojo.widget.getWidgetsByType("StrutsTreeNode");
var i;
for(i=0; i< nodes.length; i++) {
nodes[i].expand();
}
//Just another thing you might find useful - preselect another 
node
var node = dojo.widget.getWidgetById("<%= 
request.getSession().getAttribute("PreselectedCategory") %>");
node.expand();
node.markSelected();

// Thats how I use the treecontrol to refresh a list...
document.DocumentListSelection.NodeID.value = <%= 
request.getSession().getAttribute("PreselectedCategory") %>;
dojo.event.topic.publish('ListSelectionFilled');
});

Hope that helps!

Regards Jan

-Ursprüngliche Nachricht-
Von: Narayana S [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 12. September 2008 09:16
An: Struts Users Mailing List
Betreff: Re: Struts 2.1 Tree Problem

i found solution to the parent node item.

here is the code snippet ..
*tree construction *

-
-

*java Script code *

dojo.event.topic.subscribe("treeExpand", function treeNodeExpanded(message)
{
 alert(message.node.widgetId);
});


while constructing the tree expandedNotifyTopics attribute can be used to
specify the function to be executed while expanding the tree, when a node is
expanded i am taking that root node and preserve in a variable... so when a
node is selected what is there in the parent variable is the parent node.

still i didn't find a way to show tree extended default... any help is
greatly appreciated.

Thanks in advance

On Fri, Sep 12, 2008 at 12:06 PM, Jukka Välimaa <[EMAIL PROTECTED]>wrote:

> As far as I know, there is no way to set some nodes already extended
> server-side. You can open the nodes you want client-side using javascript,
> however.
> On Fri, Sep 12, 2008 at 6:48 AM, Narayana S <[EMAIL PROTECTED]>
> wrote:
>
> > Hi Jim,
> >
> >Thanks for your reply, tree control default shows only root
> > node, but
> > 1. i want it to be shown extended by default to show the specified active
> > node.
> > 2. if i pass any node i want to find out the parent node of that node in
> > the
> > jsp page itself (in DOJO)
> >
> > i am kind of stuck in my process...  help me.
> >
> >
> >
> >
> > On Thu, Sep 11, 2008 at 6:23 PM, Jim Kiley <[EMAIL PROTECTED]>
> wrote:
> >
> > > We aren't deliberately ignoring you... many readers of this list are in
> > the
> > > Americas, and you sent your first message after most of us went to bed
> > and
> > > your followup before most of us woke up. :-)
> > > (I have no idea what the answer to your question is, I have not used
> the
> > > tree control at all -- but what have you tried? Can you share your code
> > > with
> > > us so that we can help point you in the right direction?)
> > >
> > > jk
> > >
> > > On Thu, Sep 11, 2008 at 5:08 AM, Narayana S <[EMAIL PROTECTED]>
> > > wrote:
> > >
> > > > did any one see this email please help me
> > > >
> > > > On Thu, Sep 11, 2008 at 10:17 AM, Narayana S <[EMAIL PROTECTED]
> >
> > > > wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > >now i am working with tree control, when i load the tree i want
> to
> > > > load
> > > > > it default extended and what ever the node id i pass that should be
> > > > > activated. how i can achieve this using struts 2.1 version. and one
> > > more
> > > > > thing is when i select a node in the jsp page itself i have to find
> > out
> > > > the
> > > > > parent of the node selected.
> > > > >
> > > > > please help me to solve this issue, i am kind of stuck..
> > > > >
> > > > > Thanks in advance.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Jim Kiley
> > > Technical Consultant | Summa
> > > [p] 412.258.3346 [m] 412.445.1729
> > > http://www.summa-tech.com
> > >
> >
>

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



Newbie question about Struts HelloWorld example

2008-09-12 Thread UseTheFork

Hi, 

I am a newbie to Struts and I am trying to make the HelloWord example work
in Netbeans 6.1 (http://struts.apache.org/2.x/docs/hello-world.html). I have
implemented all files in a web project and it compiles fine. I have then
used the undeploy deploy functionality and got no error message. 

Next, I tried to browse: http://localhost:8080/tutorial/HelloWorld.action
and got a HTTP Status 404 description: The requested resource () is not
available. I am using GlassFish.

I have no idea why it does not work. Can anybody help? Give tips? Pointers?
Could it be a config issue?

Thank you,

J.
-- 
View this message in context: 
http://www.nabble.com/Newbie-question-about-Struts-HelloWorld-example-tp19451760p19451760.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: Sorting with displaytag issue due to theme="ajax"

2008-09-12 Thread Francisco Exposito

This is not the issue because I've tried deleting optiontransferselect and 
stuHover... I think I only need to execute javascript in result page, but I 
don't know how. I don't know if executeScripts and separateScripts attributes 
in struts ajax tags could be a solution, but I can't implement because this 
tags will be on next release of struts2.

Also, could it be a solution to change this ajax functionality by tiles plugin 
(then the javascript will be loaded in the page I need, I guess...)? Or anybody 
has a better solution? 



> Date: Thu, 11 Sep 2008 14:13:30 +1000
> Subject: Re: Sorting with displaytag issue due to theme="ajax"
> From: [EMAIL PROTECTED]
> To: user@struts.apache.org; [EMAIL PROTECTED]
> 
> I¹m not certain, but could this be a conflict between jquery and whatever
> new js libraries you¹ve added:
> 
>  type="text/javascript"/>
> 
>