RE: How to improve dojo performance in Struts 2.0.9
You can open up the struts 2.0.9 jar and pull out the template folder from . Copy that into your project, then modify template/xhtml/head.ftl and template/simple/head.ftl to refer to the dojo.js file in your directory instead of the one imbedded with struts. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Juan Carlos Serrano [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 09, 2007 1:20 PM To: user@struts.apache.org Subject: Re: How to improve dojo performance in Struts 2.0.9 I am newbie in struts 2. How do you do that resources are loaded from the directory rather than the jar? I mean, in which configuration file the directory of dojo and template is written? thanks a lot regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: file upload exception
Yeah, I read back and saw that. I must have been so out of it after staying up so long on this issue that I missed it. Thanks a million for the help and for bearing with me. Thanks! Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Saturday, September 15, 2007 8:56 PM To: Struts Users Mailing List Subject: Re: file upload exception --- Session A Mwamufiya wrote: Eureka!!! That's it, it works finally. Thanks so much!!! Just for the record, that's why I asked yesterday (Friday) if you copied it and if the file info was correct. d. - 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: file upload exception
Hi Dave, I don't copy the file at all. The FileUploadInterceptor gets called before I can do anything with the file. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Friday, September 14, 2007 7:21 PM To: Struts Users Mailing List Subject: Re: file upload exception --- Session A Mwamufiya wrote: I check whether the uploaded file exists (also it's name and size) in my getters and setters. Is it the *correct* size? Have you looked at the FileUploadInterceptor code to see how it behaves or looked at the log file to see what information it might provide? The following is from 2.0.8, and provides a hint as to why I was asking about the file being copied etc. // invoke action String result = invocation.invoke(); // cleanup fileParameterNames = multiWrapper.getFileParameterNames(); while (fileParameterNames != null fileParameterNames.hasMoreElements()) { String inputValue = (String) fileParameterNames.nextElement(); File[] file = multiWrapper.getFiles(inputValue); for (int index = 0; index file.length; index++) { File currentFile = file[index]; log.info(getTextMessage(struts.messages.removing.file, new Object[] {inputValue, currentFile}, ActionContext.getContext().getLocale())); if ((currentFile != null) currentFile.isFile()) { currentFile.delete(); } } } d. - 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: Running Dojo on a struts project
To follow up on this; I used firebug to try to figure out what was going on, and this is the error message I get in the console: djConfig.baseScriptUri has no properties getBaseScriptUri()dojo.js (line 155) loadPath(src/lang/__package__.js, dojo.lang, undefined)dojo.js (line 187) loadModule(dojo.lang, undefined, undefined)dojo.js (line 341) require(dojo.lang.*)dojo.js (line 419) [Break on this error] if(djConfig.baseScriptUri.length){ There seems to be an error in the dojo.js file. I'm using version 0.4.3 with ajax. Can someone send me the link to a working version of the file? Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Session A Mwamufiya [mailto:[EMAIL PROTECTED] Sent: Monday, September 03, 2007 9:08 AM To: user@struts.apache.org Subject: Running Dojo on a struts project Hi, I'm attempting to follow a Dojo tree widget tutorial, http://willcode4beer.com/ware.jsp?set=dojoTreeWidget, where Dojo is used to define a tree. Unfortunately nothing comes up on the page, even though the page source shows the tree definition. The tree page is set as the result page for a dummy action (which executes), but that's the only connection I have between Dojo and struts. Is there anything in particular I need to do to get Dojo to run within a struts app? Thanks, Session - 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]
setting the result pages to open in particular frames
Hi, Would anyone know how to get struts actions to set the frame in which the result pages should be displayed? I have a frame of buttons and I want different pages to be displayed in the other frame when each button is pressed. Is there a way to set this in the struts.xml file where the result pages are associated to the actions? Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED]
Struts 2 Login example using a session
Hi, I tried to follow the simple login example at http://struts.apache.org/2.x/docs/simplelogin-with-session.html, but there are many things that I don't get: - first, it's written for webworks, not struts 2, are there any compatibility issues between the two? - second, the session is never set with a timeout attribute, how do we actually enforce a timeout? - third, do we need to include a line like jsp:include page=WEB-INF/inc/loginCheck.jsp / at the beginning of every jsp file in our web app to check whether the user is still logged in; or is there a more general way of ensuring that. Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Struts 2 and using frames
This was great help Wes, thanks a million. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Wesley Wannemacher [mailto:[EMAIL PROTECTED] Sent: Monday, June 25, 2007 3:05 PM To: Struts Users Mailing List Subject: RE: Struts 2 and using frames I'm going to guess that your web-app is not called '/pages' and that URL is relative to your context root. Here is how this page should probably look - %@ taglib prefix=s uri=/struts-tags % html head titleZen Server Main View/title /head frameset cols=200,* frame src=s:url value=/pages/smart_member/FeatureOptions.jsp/ name=Options noresize frame src=s:url value=/pages/smart_member/Welcome.jsp/ name=Display noresize /frameset /html But, I think the general consensus is that you should make your JSPs actions. This way you could use other struts features in them later... In that case, your page would probably look like this - %@ taglib prefix=s uri=/struts-tags % html head titleZen Server Main View/title /head frameset cols=200,* frame src=s:url action=FeatureOptions namespace=/pages/smart_member / name=Options noresize frame src=s:url action=Welcome namespace=/pages/smart_member / name=Display noresize /frameset /html Of course, I did not test a lick of that code, so hopefully you get the idea (even if there are errors). -Wes -Original Message- From: Session A Mwamufiya [mailto:[EMAIL PROTECTED] Sent: Monday, June 25, 2007 1:51 PM To: Struts Users Mailing List Subject: Struts 2 and using frames Hello, Has anyone experienced using HTML frames with a struts 2 app? I'm trying to do just that, but my result page after a successful login doesn't find the pages for the frames. Here's the result page code: %@ taglib prefix=s uri=/struts-tags % html head titleZen Server Main View/title /head frameset cols=200,* frame src=/pages/smart_member/FeatureOptions.jsp name=Options noresize frame src=/pages/smart_member/Welcome.jsp name=Display noresize /frameset /html It's pretty straight forward, but I'm not sure whether I'm missing something here. Also, given that struts 2 actions use result pages to display the content of the action, how could I go about sending action properties to a page within a frame when the result page is one that sets the frameset? Thanks, Session - 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]
Fixing the roseindia tutorial
Hi, Has anyone used the helloworld tutorial at http://www.roseindia.net/struts/struts2/struts-2-hello-world.shtml? I like the fact that it uses a build.xml file to compile the whole thing, but the tutorial doesn't work as such: - the index.html file is never changed from the original that comes with the blank struts 2 war file; so when it comes time to testing the tutorial we are left with a void. - also the build file builds the classes folder and moves struts.xml under the WEB-INF/src folder, whereas I thought that the classes folder had to be under WEB-INF in order for the struts 2 framework to find it. Please help me fix this if you can, so that I can get my project started with a single build file that can be used with ant. Or, if you know of another link that has a working tutorial that uses a build.xml file. Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
build.xml file for struts 2
Hello, Could someone point me to a working build.xml file that I could use for a simple struts 2 application (helloworld)? I tried the tutorial from roseindia, and that build file doesn't result in a working web app, though ant says that the build was successful. I don't see all of the lib/*.jar files included in the classpath, and it puts the compiled class files in WEB-INF/src/classes instead of WEB-INF/classes; there must be other issues too that I haven't figured out. Could someone point me to a simple working build.xml for struts 2 applications, or a good tutorial that I could use? Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED]
RE: build.xml file for struts 2
Thanks for the file, but I would really need to see a working example, because all of these files and directories here and there are too confusing. I wish someone could point me to a helloworld tutorial that actually has a working version. Thanks Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Carroll, Samuel Nicholas [mailto:[EMAIL PROTECTED] Sent: Monday, June 11, 2007 3:11 PM To: Struts Users Mailing List Subject: RE: build.xml file for struts 2 Here is the basic layout for a build.xml for the struts appilcations I develop: ?xml version=1.0? project name=PROJECT NAME default=PICK_A_TARGET basedir=./ descriptionFULL PROJECT NAME/description !-- ** -- !-- Application Properties -- !-- ** -- property name=SOME.PROPERTY.NAME value=COMMONLYUSED/ .. !-- -- !-- Jar Directory Properties -- !-- -- property name=log4j.version value=1.2.9 / property name=log4j.dir location=${lib.dir}/log4j-${log4j.version} / !-- ** -- !-- Set Classpaths -- !-- ** -- path id=sourcepath.compile pathelement location=${src.dir} / /path !-- * -- !-- Clean All -- !-- * -- target name=clean delete dir=${out.dir} / /target !-- *** -- !-- Compile -- !-- *** -- target name=compile depends=init javac destdir=${out.dir}\app\WEB-INF\classes sourcepathref=sourcepath.compile classpathref=classpath.compile deprecation=${compile.deprecation} debug=${compile.debug} listfiles=${compile.listfiles} src refid=sourcepath.compile / /javac /target !-- -- !-- COPY OVER ALL OTHER FILES/LIBS INTO THE PROPER WEB-INF STRUCTURE -- !-- -- !-- Copy JSP Pages Over -- copy todir=${out.dir}\app\WEB-INF\pages fileset dir=${jspPages.dir} excludes=**/*.keep /fileset /copy etc... !-- ** -- !-- Distribute -- !-- ** -- target name=dist jar jarfile=${warfile.name}.war basedir=${out.dir}\app / /target /project Something along those lines should suffice google and the ant page should suffice To fill in all the blanks, but to review basically set all the properties (dirs, Files, libs, etc.) then move them to the appropriate folders for the WEB-INF, Then compile and make a war file and distribute accordingly. -Original Message- From: Session Mwamufiya [mailto:[EMAIL PROTECTED] Sent: Monday, June 11, 2007 2:59 PM To: 'Struts Users Mailing List' Subject: build.xml file for struts 2 Hello, Could someone point me to a working build.xml file that I could use for a simple struts 2 application (helloworld)? I tried the tutorial from roseindia, and that build file doesn't result in a working web app, though ant says that the build was successful. I don't see all of the lib/*.jar files included in the classpath, and it puts the compiled class files in WEB-INF/src/classes instead of WEB-INF/classes; there must be other issues too that I haven't figured out. Could someone point me to a simple working build.xml for struts 2 applications, or a good tutorial that I could use? Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [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]
running the test in the HelloWorld tutorial
Hello, I've been able to set up struts 2 after a long review of everything needed, and am now looking to run the test that was given in the HelloWorld tutorial to test the HelloWorld action. I understand what the code does, but what do I need to do to run the test and get its results from within a web page or command line? Could someone give me a simple step by step method that I could reproduce? Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED]
RE: running the test in the HelloWorld tutorial
That's already over my head Wendy, I've never used Maven, and it seems complicated. I currently build my java files with a .bat files that simply calls on javac and places the class files where I want them. I would prefer to keep things as simple as this, because trying to understand Maven would be adding yet another layer of complexity. Let me know if there's any simple way to do this with just using a bat file that will compile and run the test file, otherwise I'd rather use Eclipse than deal with Maven. Thanks Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 2:19 PM To: Struts Users Mailing List Subject: Re: running the test in the HelloWorld tutorial On 6/9/07, Session A Mwamufiya [EMAIL PROTECTED] wrote: That's exactly the one Wendy! I wasn't using an IDE to code the java pages for the HelloWorld tutorial, but my IDE of choice, if one is needed for the test, is Eclipse 3.2. An IDE is not required. The tutorial assumes you have some favorite development environment already, and are just adding the files to it. What are you using to compile and build the application? Maven? Ant? Eclipse? I would start with the Maven [1] webapp archetype: mvn archetype:create -DarchetypeArtifactId=maven-archetype-webapp -DgroupId=com.example -DartifactId=hello-world That will set up most of the directory structure I need. Then I'd add the src/main/java and src/main/test directory, and proceed from there, following the tutorial and using 'mvn install' to compile the code, run the tests, package the webapp and install it into my local maven repository. [1] http://maven.apache.org -- Wendy - 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: running the test in the HelloWorld tutorial
Yes, Dave is right, it's the test that I'm interested in. Thanks, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 2:19 PM To: Struts Users Mailing List Subject: RE: running the test in the HelloWorld tutorial --- Deepak Kumar [EMAIL PROTECTED] wrote: Please chekck http://www.roseindia.net/struts/struts2/struts-2-hello-world.shtml Hmm, I didn't see anything there regarding the tests, which I think is what the OP was asking about? d. Get the Yahoo! toolbar and be alerted to new email wherever you're surfing. http://new.toolbar.yahoo.com/toolbar/features/mail/index.php - 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: running the test in the HelloWorld tutorial
Thanks for the info; however, though the test compiles with no issues and creates a HelloWorldTest.class file in the same directory as the HelloWorldTest.java file, I keep getting an error when I try to run the test, which states that if can't find the class HelloWorldTest (though it is there in the same directory). Here is my HelloWorldTest.java file: package helloworld; import junit.framework.TestCase; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; public class HelloWorldTest extends TestCase { public void testHelloWorld() throws Exception { HelloWorld hello_world = new HelloWorld(); String result = hello_world.execute(); assertTrue(Expected a success result!, ActionSupport.SUCCESS.equals(result)); assertTrue(Expected the default message!, HelloWorld.MESSAGE.equals(hello_world.getMessage())); } } I just changed the package name from tutorial to helloworld for my own purposes, and compiled the file by putting the JUnit 4 jar in the classpath, which built fine. I'm not sure what could be wrong with the test? Here's the output from the command line: JUnit version 4.3.1 Could not find class: helloworld.HelloWorldTest Time: 0 OK (0 tests) Any ideas? Thanks a million. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 2:54 PM To: Struts Users Mailing List Subject: Re: running the test in the HelloWorld tutorial On 6/9/07, Session Mwamufiya [EMAIL PROTECTED] wrote: I currently build my java files with a .bat files that simply calls on javac and places the class files where I want them. That's the info I was looking for. :) Are you already able to compile the test? (That will tell me you've already downloaded JUnit and put it on the classpath, because the test says 'import junit.framework.TestCase;') To run the test from the command line (or batch file) take a look at this JUnit FAQ: http://junit.sourceforge.net/doc/faq/faq.htm#tests_1 I've never done this, but (with the appropriate things on the classpath,) try: java org.junit.runner.JUnitCore tutorial.HelloWorldTest I would prefer to keep things as simple as this, because trying to understand Maven would be adding yet another layer of complexity. Agreed. -- Wendy - 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: running the test in the HelloWorld tutorial
Here's my classpath: set CLASSPATH=..\..\lib\xwork-2.0.1.jar;..\..\lib\junit-4.3.1.jar;..\..\classes I add the last path item in order to access the HelloWorld.class class file. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 3:50 PM To: Struts Users Mailing List Subject: RE: running the test in the HelloWorld tutorial What is your CLASSPATH? --- Session Mwamufiya [EMAIL PROTECTED] wrote: Thanks for the info; however, though the test compiles with no issues and creates a HelloWorldTest.class file in the same directory as the HelloWorldTest.java file, I keep getting an error when I try to run the test, which states that if can't find the class HelloWorldTest (though it is there in the same directory). Here is my HelloWorldTest.java file: package helloworld; import junit.framework.TestCase; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; public class HelloWorldTest extends TestCase { public void testHelloWorld() throws Exception { HelloWorld hello_world = new HelloWorld(); String result = hello_world.execute(); assertTrue(Expected a success result!, ActionSupport.SUCCESS.equals(result)); assertTrue(Expected the default message!, HelloWorld.MESSAGE.equals(hello_world.getMessage())); } } I just changed the package name from tutorial to helloworld for my own purposes, and compiled the file by putting the JUnit 4 jar in the classpath, which built fine. I'm not sure what could be wrong with the test? Here's the output from the command line: JUnit version 4.3.1 Could not find class: helloworld.HelloWorldTest Time: 0 OK (0 tests) Any ideas? Thanks a million. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 2:54 PM To: Struts Users Mailing List Subject: Re: running the test in the HelloWorld tutorial On 6/9/07, Session Mwamufiya [EMAIL PROTECTED] wrote: I currently build my java files with a .bat files that simply calls on javac and places the class files where I want them. That's the info I was looking for. :) Are you already able to compile the test? (That will tell me you've already downloaded JUnit and put it on the classpath, because the test says 'import junit.framework.TestCase;') To run the test from the command line (or batch file) take a look at this JUnit FAQ: http://junit.sourceforge.net/doc/faq/faq.htm#tests_1 I've never done this, but (with the appropriate things on the classpath,) try: java org.junit.runner.JUnitCore tutorial.HelloWorldTest I would prefer to keep things as simple as this, because trying to understand Maven would be adding yet another layer of complexity. Agreed. -- Wendy - 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] Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos more. http://mobile.yahoo.com/go?refer=1GNXIC - 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: running the test in the HelloWorld tutorial
Hi Dave, I followed the clean setup from the struts 2 tutorial page to set up my directory. It looks like this from my app root folder in Tomcat's webapps folder: - jsp pages are in the root directory - META-INF - WEB-INF: contains web.xml - WEB-INF/lib: the 5 jars required to run struts 2 + JUnit 4.3.1 jar - WEB-INF/scr/java: my java files, including HelloWorld.java - WEB-INF/scr/Test: my test java files, including HelloWorldTest.java; as well as the compiled class files for test java files - WEB-INF/classes: contains struts.xml - WEB-INF/classes/helloworld: the compiled class files for the regular java files I'm running the test from WEB-INF/scr/Test where both HelloWorldTest.java and HelloWorldTest.class are located. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 4:11 PM To: Struts Users Mailing List Subject: RE: running the test in the HelloWorld tutorial Okay, what is your directory structure? Are both .java / .class files in the same directory? What directory are you running the tests from? (That doesn't seem like enough .jar files for a working CLASSPATH, either, but I don't know what dependencies XWork has.) --- Session Mwamufiya [EMAIL PROTECTED] wrote: Here's my classpath: set CLASSPATH=..\..\lib\xwork-2.0.1.jar;..\..\lib\junit-4.3.1.jar;..\..\classes I add the last path item in order to access the HelloWorld.class class file. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 3:50 PM To: Struts Users Mailing List Subject: RE: running the test in the HelloWorld tutorial What is your CLASSPATH? --- Session Mwamufiya [EMAIL PROTECTED] wrote: Thanks for the info; however, though the test compiles with no issues and creates a HelloWorldTest.class file in the same directory as the HelloWorldTest.java file, I keep getting an error when I try to run the test, which states that if can't find the class HelloWorldTest (though it is there in the same directory). Here is my HelloWorldTest.java file: package helloworld; import junit.framework.TestCase; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; public class HelloWorldTest extends TestCase { public void testHelloWorld() throws Exception { HelloWorld hello_world = new HelloWorld(); String result = hello_world.execute(); assertTrue(Expected a success result!, ActionSupport.SUCCESS.equals(result)); assertTrue(Expected the default message!, HelloWorld.MESSAGE.equals(hello_world.getMessage())); } } I just changed the package name from tutorial to helloworld for my own purposes, and compiled the file by putting the JUnit 4 jar in the classpath, which built fine. I'm not sure what could be wrong with the test? Here's the output from the command line: JUnit version 4.3.1 Could not find class: helloworld.HelloWorldTest Time: 0 OK (0 tests) Any ideas? Thanks a million. Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 2:54 PM To: Struts Users Mailing List Subject: Re: running the test in the HelloWorld tutorial On 6/9/07, Session Mwamufiya [EMAIL PROTECTED] wrote: I currently build my java files with a .bat files that simply calls on javac and places the class files where I want them. That's the info I was looking for. :) Are you already able to compile the test? (That will tell me you've already downloaded JUnit and put it on the classpath, because the test says 'import junit.framework.TestCase;') To run the test from the command line (or batch file) take a look at this JUnit FAQ: http://junit.sourceforge.net/doc/faq/faq.htm#tests_1 I've never done this, but (with the appropriate things on the classpath,) try: java org.junit.runner.JUnitCore tutorial.HelloWorldTest I would prefer to keep things as simple as this, because trying to understand Maven would be adding yet another layer of complexity. Agreed. -- Wendy - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: running the test in the HelloWorld tutorial
I'm sorry to be dense about this, but it's not working for me. Here is what I've done: I moved my build.bat file to the root level, and am only using one file to build the code, the test, and run the test. This is the content of build.bat: @echo off set CLASSPATH=WEB-INF\lib\xwork-2.0.1.jar;WEB-INF\lib\junit-4.3.1.jar;WEB-INF\cl asses;WEB-INF\src\test javac WEB-INF\src\java\*.java -d WEB-INF\classes javac WEB-INF\src\test\*.java -d WEB-INF\classes java helloworld.HelloWorldTest I modified my HelloWorldTest.java file as follows according to JUnit.org: package helloworld; import junit.framework.TestCase; import com.opensymphony.xwork2.Action; import com.opensymphony.xwork2.ActionSupport; import org.junit.*; public class HelloWorldTest extends TestCase { @Test public void testHelloWorld() throws Exception { HelloWorld hello_world = new HelloWorld(); String result = hello_world.execute(); assertTrue(Expected a success result!, ActionSupport.SUCCESS.equals(result)); assertTrue(Expected the default message!, HelloWorld.MESSAGE.equals(hello_world.getMessage())); } public static void main(String args[]) { org.junit.runner.JUnitCore.main(helloworld.HelloWorldTest); } } The output I get is: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at com.opensymphony.xwork2.ActionSupport.clinit(ActionSupport.java:22) at helloworld.HelloWorldTest.testHelloWorld(HelloWorldTest.java:13) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at junit.framework.TestCase.runTest(TestCase.java:168) at junit.framework.TestCase.runBare(TestCase.java:134) at junit.framework.TestResult$1.protect(TestResult.java:110) at junit.framework.TestResult.runProtected(TestResult.java:128) at junit.framework.TestResult.run(TestResult.java:113) at junit.framework.TestCase.run(TestCase.java:124) at junit.framework.TestSuite.runTest(TestSuite.java:232) at junit.framework.TestSuite.run(TestSuite.java:227) at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner. java:76) at org.junit.internal.runners.CompositeRunner.run(CompositeRunner.java:2 9) at org.junit.runner.JUnitCore.run(JUnitCore.java:130) at org.junit.runner.JUnitCore.run(JUnitCore.java:109) at org.junit.runner.JUnitCore.run(JUnitCore.java:100) at org.junit.runner.JUnitCore.runMain(JUnitCore.java:81) at org.junit.runner.JUnitCore.main(JUnitCore.java:44) at helloworld.HelloWorldTest.main(HelloWorldTest.java:24) FAILURES!!! Tests run: 1, Failures: 1 Anything apparently wrong in what I'm doing? Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Dave Newton [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 4:29 PM To: Struts Users Mailing List Subject: RE: running the test in the HelloWorld tutorial --- Session Mwamufiya [EMAIL PROTECTED] wrote: - WEB-INF/scr/Test: my test java files, including HelloWorldTest.java; as well as the compiled class files for test java files - WEB-INF/classes: contains struts.xml - WEB-INF/classes/helloworld: the compiled class files for the regular java files I'm running the test from WEB-INF/scr/Test where both HelloWorldTest.java and HelloWorldTest.class are located. You still need to add the directory containing the test classes to your CLASSPATH. I would also recommend running all that kind of stuff from the root directory of the project; that may better prepare you for using Ant or Maven in the future. I'm assuming the repetition of scr above (as opposed to src) is just an... oddly repetitive typo. I'd also name the Test directory test (all lower-case). d. Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow - 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: running the test in the HelloWorld tutorial
GREAT!!! It works! You guys are awesome. Special thanks to Dave and Wendy for not giving up on me :). Thanks again, Session A. Mwamufiya Carnegie Mellon University MBA | Tepper School of Business MSE (software eng.) | School of Computer Science T: (412) 508-5455 | [EMAIL PROTECTED] -Original Message- From: Wendy Smoak [mailto:[EMAIL PROTECTED] Sent: Saturday, June 09, 2007 5:57 PM To: Struts Users Mailing List Subject: Re: running the test in the HelloWorld tutorial On 6/9/07, Session Mwamufiya [EMAIL PROTECTED] wrote: I moved my build.bat file to the root level, and am only using one file to build the code, the test, and run the test. This is the content of build.bat: @echo off set CLASSPATH=WEB-INF\lib\xwork-2.0.1.jar;WEB-INF\lib\junit-4.3.1.jar;WEB-INF\cl asses;WEB-INF\src\test Echoing Dave, you need to put all of the dependencies on the classpath. Look at the list of jars at the bottom of my last message. You probably don't need all of those for this simple example, but you need more than you have listed above. javac WEB-INF\src\java\*.java -d WEB-INF\classes javac WEB-INF\src\test\*.java -d WEB-INF\classes So far, so good... I modified my HelloWorldTest.java file as follows according to JUnit.org: Unnecessary, but JUnit 4 with annotations is more fun. :) The output I get is: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory Add the commons-logging jar to the classpath. If you get another NoClassDefFoundError, then look at the list of jars and see if there is a likely suspect. -- Wendy - 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]
Architecture of Struts from a server application's point of view
Hello, I'm new to Struts 2 and have to design an architecture in which my server applications would be included in Struts, which would be responsible for providing a web interface for the apps. However, I also need to communicate with these server apps via a client that will use VPN access into the server. Are apps placed in Struts accessible from APIs other than those of Struts' web interface? I may not be clear enough in my question, but please feel free to ask for clarification, and any attempt to answer it would be greatly appreciated. Thanks, Session A. Mwamufiya MBA | Tepper School of Business MSE (Software Engineering) | School of Computer Science Carnegie Mellon University T: (412) 508-5455 | Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]