Re: [S2] Tooltip and simple theme
You can use the "title" property, which generates a title attribute in the HTML. Most browsers will render this like a tool tip when the user hovers over the element. On Nov 20, 2007, at 4:21 PM, Jiang, Jane (NIH/NCI) [C] wrote: Hi, I have an application developed ready for test. Now I have added requirement for tooltips for a few components. I just noticed that tooltip is only available in xhmtl theme. How should I implement tooltips in simple theme? Thanks a lot for your help, Jane -Original Message- From: Stefano Greco [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 9:55 AM To: Struts Users Mailing List Subject: Re: [S2] autocompler + ajax in 2.0.11 I think in the URL http://struts.apache.org/2.x/docs/ajax-tags.html say how work in 2.1 but I suppose Ajax should work since 2.0 Stefano - Original Message - From: "Dave Newton" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" Sent: Friday, November 16, 2007 3:43 PM Subject: RE: [S2] autocompler + ajax in 2.0.11 Ajax has been working for quite awhile in S2.0, it's just better in 2.1. d. --- "Hernandez, David" <[EMAIL PROTECTED]> wrote: Does it work at all? I thought no ajax tags would work until version 2.1 . . . -Original Message- From: Stefano Greco [mailto:[EMAIL PROTECTED] Sent: Friday, November 16, 2007 9:08 AM To: user@struts.apache.org Subject: [S2] autocompler + ajax in 2.0.11 Hi, I'm using autocompler with ajax theme as in this example: ... .. If I put theme="ajax" as attribute of autocompleter tag as the example the label is not visible in HTML rendered. I I dont use the attribute theme in the tag autocomplet it doesnt work very well especially for the attribute loadOnTextChange="true" loadMinimumCount="3" showDownArrow="false" that aren't rendered in HTML result. I think it's a BUG? Or it's a my mystake? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This message is intended only for the personal and confidential use of the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers. Email transmission cannot be guaranteed to be secure or error-free. Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. IRS Circular 230 Disclosure: Please be advised that any discussion of U.S. tax matters contained within this communication (including any attachments) is not intended or written to be used and cannot be used for the purpose of (i) avoiding U.S. tax related penalties or (ii) promoting, marketing or recommending to another party any transaction or matter addressed herein. - 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] - 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: S2 best location of application init params
If you're using Spring (and if you're not, now might be the time to consider it), I'd say make that a property of your application object that needs to configuration. That is, using your example, say you've got a class, TransactionLogger that needs "the home directory of the file system to which the application will write." Give it a property, loggingDirectory, and configure it with Spring, giving it a bean id of "transactionLogger". Then, add Struts 2's Spring plugin to your project (just include the JAR), define a method setTransactionLogger(), and Spring/Struts will automatically inject the TransactionLogger instance into your object. In your action, just call transactionLogger.logTransaction(foo), and there you go! Among the benefit of this approach are: 1.You can unit test your business object (TransactionLogger) without involving Struts at all 2. The business object could be re-used outside your Struts application 3. The configuration is only where it needs to be; in the business object itself. So you don't have to come up with some naming convention for your init-params, nor do you have to write tedious code to make the business object aware of the configuration. That is, TranscationLogger doesn't have to be tied to the Servlet API, nor do you have to write an initialization servlet that creates a TransactionLogger. This ventures off-topic from Struts 2, which should probably be your goal: your business objects should not be tied to Struts or the Servlet API. On Friday, November 09, 2007, at 12:41PM, "tom` frost" <[EMAIL PROTECTED]> wrote: >I'm looking for the best place to put application init stuff. I'm thinking >of something like the home directory of the file system to which the >application will write to. What's the best way of apssing such information >in. In the past I have used servlet api init params, but with all the >effort made in S2 to separate your code from Servlet api, surely there's a >better way. > >Thanks, >Tom > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Need Help Struts 2.0.8
It's not necessary to do declare 10 variables. Here's an example: http://struts.apache.org/2.x/docs/tabular-inputs.html By the way, Struts 2.0.11 is out, so Raguveer, you might want to upgrade. The answer to your particular question doesn't change, but there are some bug and security fixes you should have. On Nov 1, 2007, at 7:14 AM, John Doe wrote: The simplest way (if I'have understood your problem right) is to create 10 variables in your action class (with getters and setters of course) and on the form. So it'll be private String firstName1; private String firstName2; private String firstName3; ... private String firstName10; in the action class and : ... Struts fills action variables values automatically using reflection. On 11/1/07, Raghuveer Rawat <[EMAIL PROTECTED]> wrote: Hi, still looking for help. On 10/31/07, Raghuveer Rawat <[EMAIL PROTECTED]> wrote: Hi, I have form which allows user to invite other users. A user can invite a max of 10 users at a time. A row contain First Name, Last Name, and Email Address. How should I name these textfields (OGNL expression) and how should I retrieve these values in Action Class? < tr> First Name Last Name Email Address similarly 9 more rows like this. -- Best regards, Bashmaкov Anton - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 version 2.1
It's been on the main Maven repository since Tuesday: http://repo1.maven.org/maven2/org/apache/struts/struts2-core/2.0.11/ So, Maven 2 users should be able to update to it without problem. And if you're not using Maven, you should be! (Just kidding! I don't mean to start a build tool war). On Oct 26, 2007, at 9:11 AM, Dave Newton wrote: The release has been submitted for mirroring (Tue) although I didn't see it anywhere except apache servers as of last night, but I didn't look around on all the mirrors, either. --- David Harland <[EMAIL PROTECTED]> wrote: Do you know what has happened to 2.0.11? It seems to have stalled. --- Ted Husted <[EMAIL PROTECTED]> wrote: On 10/25/07, someone> wrote: Hi, Having been a long time developer with Struts, I love working with Struts 2x. So far it has been a pleasure and you guys have done a great job. It seems like all the things I did not like about Struts have been address in Struts2. Do you know when 2.1 will be released? There are many features in 2.1 that I am looking for and the documentation I am using on the Web is geared towards 2.1, so that is causing some confusion. We never know when something will actually be released, since it's a group decision and feedback from the wider community of users is very important to the group. We will be running the first official test-build this weekend. Usually, it takes four to six betas for us to get a new minor or major release up to General Availability quality. The best way to help the process along is to watch the dev@ list, try the test-builds against your own application, and provide your best feedback. It also helps for everyone who has tried the build to participate in the quality vote, regardless of whether you are a "committer". Some people have been using the 2.1 development code in production, so there many not be too many glitches to fix. When we document new features, we should be citing "since 2.x.x" in the documentation. This is not only true for 2.1.x but 2.0.x as well. If there are places where "since" is not being done, please feel free to leave a comment on the page. Or, file a CLA so that you can update the documentation directly. * http://struts.apache.org/2.x/docs/editing-the-documentation.html HTH, Ted http://husted.com/ted/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts 2 action messages / action errors
Struts 2 allows you to style them, but using themes. Themes are both more powerful and more complicated than what Struts 1 offered. Before you dive into customizing a theme, see if you can style it entirely with CSS. You're best better is probably to "View source" in your browser to see the rendered HTML, noting the classes that the built-in themes use. Then, override these styles with your own stylesheet. Using the built-in css_xhtml theme (add struts.ui.theme=css_xhtml to struts.properties) will give you more flexibility, compared to the default theme (xhtml). If that doesn't give you the look you want, it's time to dive into themes. Themes are documented here: http://struts.apache.org/2.x/docs/themes-and-templates.html http://struts.apache.org/2.x/docs/extending-themes.html Mark Menard has provided an excellent tutorial on creating custom themes here: http://www.vitarara.org/cms/struts_2_cookbook/creating_a_theme On Oct 24, 2007, at 11:58 AM, Brian Relph wrote: Does struts2 handle the css-styling of action errors and messages the same as struts1? In struts 1, i defined some keys in the message bundle errors.prefix and errors.suffix that were automatically used to style the html generated by the actionerrors. Is this enabled in struts2? Thanks, Brian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Struts2 Tags and HTML Encoding
Add escape="false" to your tag: On Oct 17, 2007, at 2:00 PM, Tom Holmes Jr. wrote: This is probably a very easy question ... and I'm probably just having one of those "brain-fart" moments. I'm using struts2 and that works fine ... I've got a bean created and in session, so I can use the:prefix="s" uri="/struts- tags"taglib defined. This all works great! I'm showing some data on my jsp page, for example: Body: This property contains HTML code, but yet it is showing the tags as > & < etc so, I'm trying to remember the flag, property, value that renders the HTML as real HTML on my JSP page. I've done it before with Struts1 ... just can't remember how to do it now ... I must be getting old any help with this would be much appreciated. Thanks! Tom - 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: validator shortcuts idea
Despite the redundancy, having separate validators is nice since it allows you to customize the error message. For example, you might want to say, "Please enter your age," "Age must be a valid number," and, "You must be at least 13 years old to ride this ride." On Oct 16, 2007, at 3:44 PM, stanlick wrote: I am discovering that duplicate field validators in S2 are a royal pain in the tucas! Remember the good old days when we could say age field depends="required,int" Now we need to specify two entirely separate field validators! I realize a field input may not *necessarily* be required, but once entered needs to be validated. What about having validators like intRequired instead of two different validators? This way we could pick from a smarter validator crop and let the magic happen there. Scott -- View this message in context: http://www.nabble.com/validator- shortcuts-idea-tf4636405.html#a13241115 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]
Re: Bookmarking functionality in struts
It's been a while since I've used Struts 1.x, but back in the day, I did implement this type of functionality. Basically, the app would redirect to the login action, with the destination what the user tried to access) as an encoded parameter in the URL. Something like "/ login.do?destination=http://...";. The login action would look for the "destination" parameter, and send a redirect to that URL if present. I don't have specific code for you (again, it's been a while since I've used Struts 1.x), but that gives you an outline of what you'd need to do. On Oct 15, 2007, at 12:47 PM, Viplav Kallepu wrote: Hi all, I am using struts 1.3.8. I was trying bookmarking functionality out of curiosity.(User will bookmark a page then if he clicks that link he should be informed to login which is the entry point into application and then he should be forwarded to the page he bookmarked) . I wish to do it even when session is expired. Any one who achieved this functionality before please help me in knowing the solution. I did google but I wasn't able to find any thing useful. If you can give me any tutorial kind of thing that would be a great help. -- Regards Viplav Kallepu - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Where is struts-*.tld
It is very different, but I'd still encourage you to play with it. I've been using it for a few months (though I had played with WebWork before), and I love it. I've found it light years ahead of Struts 1.x, and not nearly as frustrating as Spring MVC. It's got a learning curve, like any framework, and some of the concepts (such as the interceptor) seem esoteric at first, but they grow on you, and begin to look more and more like a brilliant architecture the more I work with them. So, if you've got the time, it's worthwhile to learn. Good luck! On Oct 5, 2007, at 5:55 PM, mjparme wrote: Yeah, I have done more reading about Struts 2 vs 1. Didn't realize it was that different. I will probably just kick back down to the most recent Struts 1 release so I am in known territory. Jim Cushing wrote: Approach Struts 2 as if you're learning a new web framework, which you really are. As I see it, what Struts 2 inherits from Struts 1 is the brand name, and a lot of the development and documentation talent that worked on that project (and, of course, the same talent that created WebWork). But, expect to find many difference in the framework itself. On Oct 5, 2007, at 5:21 PM, mjparme wrote: I downloaded Struts 2.0.9 (binary release) and the files struts- bean.tld, struts-html.tld, and struts-logic.tld is nowhere to be found. All the documentation I have read said it should be in the lib directory. This documentation appears to be geared to Struts 1.x though. I have scoured google and docs on struts.apache.org and can't find where these files are!! It has been very frustrating. All the getting started guides say to put these files in WEB-INF but then don't tell you where to get these files from! Could anyone tell me where to get these tld files from? -- View this message in context: http://www.nabble.com/Where-is-struts- *.tld-tf4577651.html#a13067542 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/Where-is-struts- *.tld-tf4577651.html#a13068048 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]
Re: Where is struts-*.tld
Those files don't exist in Struts 2. Struts 2 is very different than Struts 1, and is based off of WebWork, so many of the files and JSP you're used to don't exist, struts-*.tld among them. All the JSP tags included with S2 start with (e.g., ), instead of , , etc. Approach Struts 2 as if you're learning a new web framework, which you really are. As I see it, what Struts 2 inherits from Struts 1 is the brand name, and a lot of the development and documentation talent that worked on that project (and, of course, the same talent that created WebWork). But, expect to find many difference in the framework itself. On Oct 5, 2007, at 5:21 PM, mjparme wrote: I downloaded Struts 2.0.9 (binary release) and the files struts- bean.tld, struts-html.tld, and struts-logic.tld is nowhere to be found. All the documentation I have read said it should be in the lib directory. This documentation appears to be geared to Struts 1.x though. I have scoured google and docs on struts.apache.org and can't find where these files are!! It has been very frustrating. All the getting started guides say to put these files in WEB-INF but then don't tell you where to get these files from! Could anyone tell me where to get these tld files from? -- View this message in context: http://www.nabble.com/Where-is-struts- *.tld-tf4577651.html#a13067542 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]
[S2] Can a custom component have a body? or, using with themes
Is something like this legal in a Struts 2 custom component: Some text to be wrapped in my component. In other words, can act like, for example, ...s.form>? I'd like to create a HTML fieldset component that plays well with themes. But this doesn't result in valid HTML with the xhtml theme, for example: Form test If anyone's had luck using with a theme other than simple, I'm interested in how you accomplished that. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Struts 2] Read request attribute in struts.xml
Mark Menard's excellent Struts 2 Cookbook shows you how to do this. http://www.vitarara.org/cms/struts_2_cookbook/post_and_redirect If you've never seen his Cookbook, I definitely recommend taking a look. It's got some great tips. On Sep 24, 2007, at 11:02 AM, Xibin Liu wrote: Hi, I set an attribute in the request in the action code, and I want to use it in the struts.xml (see below). How can I reference it at the place marked by ***? *** true I tried #request.attname, it did not work. Thanks! - 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: More tutorial questions
That class was built for JDK 1.5/Java 5, and you're running JDK 1.4. Is running Java 5 an option for you? If not, you might be able to re- compile XWork for 1.4. On Sep 18, 2007, at 2:50 PM, Slattery, Tim - BLS wrote: What's with com.opensymphony.xwork2.ActionSupport? I don't see anything like that in the Struts 2.0.9 package I downloaded. Did I miss something? OK, I found that in the xwork-2.0.4.jar library, not in the struts2- core library, where I expected it. Now I get this message when I try to compile "HelloWorld": Cannot access class com.opensymphony.xwork2.ActionSupport; class file has wrong version 49.0, should be 45.3 or 46.0 or 48.0. Now what's going on? -- Tim Slattery [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [FRIDAY] JPA War Stories?
I've been using JPA annotations with Hibernate for a while, but still using the Hibernate API (SessionFactory, etc.). Those are great, and I felt right at home with them after using XDoclet to set up Hibernate mappings for about two years before that. I'm just getting started using the Persistence API (with Hibernate, naturally), so it's too early for me to share war stories. So far, so good, though. While it may sound trivial, that I don't have to specify the individual annotated classes (or .hbm.xml) is a nice touch. Venturing slightly (more) off-topic, I recently switched from having my DAOs extend from Spring's HibernateDaoSupport, and using HibernateTemplate, to just going directly to the Hibernate API. Or, now, to the JPA API. I don't benefit from Spring's exception translation that way, but you know what? I don't think that really matters (in Hibernate 2, it was helpful, but the exceptions have are now unchecked). If the applications relied on Spring's DAO exceptions, this could make it harder to switch from Hibernate to JPA. Any JPA war stories related to such a switch? On Sep 14, 2007, at 2:50 PM, Ted Husted wrote: Since we've had the Struts2 Spring-JPA tutorial up for a while, I was wondering if many Struts developers were using a Java Persistence API implementation nowadays, whether the experience has been positive, and which implementation folks are using (Hibernate, TopLink, OpenJPA). So, any JPA war stories to tell? -Ted. - 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: creating a dummy session object for unit testing
The session object is a simple Map, so creating it is easy. First, you have to define an instance variable in which to store the session, and second, you need to implement the setSession() method. public class MyAction implements SessionAware { private Map session; public void setSession(Map session) { this.session = session; } } If most/all of your actions need access to the session, you may want to define a BaseAction that implements SessionAware, and add a protected method, getSession(). Or, you could make the session variable protected (instead of private), but I prefer getSession(). In your unit test: Map session = new HashMap(); session.put("key", value); action.setSession(session); String result = action.execute(); assertEquals(SUCCESS, result); What the map contains are the keys and values your action expects. These are the same things you'd pass to HttpSession.setAttribute (String name, Object value). So, say you want to store a shopping cart object in the session, you'd do: session.put("shoppingCart", shoppingCart); action.setSession(session); On Sep 13, 2007, at 7:04 PM, Session A Mwamufiya wrote: Thanks for the tip, but I'll need an actual code snippet, because when I make my action implement SessionAware, I need to also implement the setSession() method, and I'm back to square 1, trying to figure out how to create a session object. I can send a HashMap to the method, but what does it have to contain? What is the actual setting that needs to go in it, since I need to implement it? If your Action implements SessionAware, you don't need to make a mock HttpSession at all. You just make a new HashMap, stuff it with the values you want, and call action.setSession(). Just one more of the things I love about Struts 2. :) But there are libraries around that do allow mock HttpSessions. Spring was mentioned; MockObjects and Mockrunner each have it, and a quick google search for "MockHttpSession" reveals plenty of others. Still, I'd recommend the SessionAware. http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/ struts2/interceptor/SessionAware.html "Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult." In my experience, however, that's not the case at all. Using SessionAware, from a unit testing perspective, makes your Action less dependent on the servlet API, and makes unit testing easier. On Sep 13, 2007, at 3:47 PM, Session A Mwamufiya wrote: Hi, How do I go about creating a dummy HttpSession object for unit testing a struts 2 app? I have created a dummy HttpServletRequest object, but I can't instanciate an HttpSession in teh Request.getSession() method, because HttpSession is an abstract interface and I can't create an instance of it. Any ideas? Thanks - 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]
Re: creating a dummy session object for unit testing
If your Action implements SessionAware, you don't need to make a mock HttpSession at all. You just make a new HashMap, stuff it with the values you want, and call action.setSession(). Just one more of the things I love about Struts 2. :) But there are libraries around that do allow mock HttpSessions. Spring was mentioned; MockObjects and Mockrunner each have it, and a quick google search for "MockHttpSession" reveals plenty of others. Still, I'd recommend the SessionAware. http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/ struts2/interceptor/SessionAware.html "Note that using this interface makes the Action tied to a servlet environment, so it should be avoided if possible since things like unit testing will become more difficult." In my experience, however, that's not the case at all. Using SessionAware, from a unit testing perspective, makes your Action less dependent on the servlet API, and makes unit testing easier. On Sep 13, 2007, at 3:47 PM, Session A Mwamufiya wrote: Hi, How do I go about creating a dummy HttpSession object for unit testing a struts 2 app? I have created a dummy HttpServletRequest object, but I can't instanciate an HttpSession in teh Request.getSession() method, because HttpSession is an abstract interface and I can't create an instance of it. Any ideas? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Simple Question about FreeMarker + Struts 2
Some other things you can use: ${myActionProperty.subProperty!} Prints nothing if subProperty doesn't exist or is null ${myActionProperty.subProperty?default("default value") Prints "default value" if subProperty doesn't exist or is null The first expression (ending with !) is most similar in behavior to the <@s.property /> tag. On Sep 6, 2007, at 4:55 PM, Kenton wrote: I'm a newbie trying learn how to use FreeMarker for Struts result pages. This code works: <@s.property value="myActionProperty.subProperty" /> This code triggers a FreeMarker error (expression undefined): ${myActionProperty.subProperty} Obviously, I'm missing something very simple. But what is it? Is there any way to dump the tree of EL variables so that I can undertand better? Is there any good documentation on using FreeMarker in Struts? I can find great documentation on FreeMarker by itself and Struts by itself, but I can't find any docs or tutorials on using the two together. Any suggestions? -- View this message in context: http://www.nabble.com/Simple-Question- about-FreeMarker-%2B-Struts-2-tf4394620.html#a12531237 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]
Re: ant, maven and creating war's
Have you checked out the Bootstrap Tutorial yet? It gives you a great intro to Struts 2, and a bit of Maven 2 at the same time. http://struts.apache.org/2.x/docs/bootstrap.html Ian Roughley has put out a book, which you can download for free (though I'm sure he'd love it if you purchased a printed copy), called Starting Struts 2. http://www.infoq.com/minibooks/starting-struts2 On Aug 29, 2007, at 2:34 PM, sp4rc wrote: Thanks for the input. I think I will have to start with the total basics before moving on to struts. Anyhow I googled for any tutorials, sources I just got more and more frustrated, as I just dont know where to start. Has anyone a got starting point, link, etc. for me? On Wed, 2007-08-29 at 13:20 -0400, Jim Cushing wrote: I haven't touched Ant in years, so I can't help you much there, but with Maven 2, it's as simple as running 'mvn package'. The POM itself says whether the project produces a JAR, WAR, or some other artifact, so package always builds the appropriate artifact for the project. For a web app, that is of course a WAR, for something else, it may be a JAR. For development, you might want to try using Jetty instead of Tomcat, because Maven 2 has a plugin that makes this really simple. Add the following to your POM: org.mortbay.jetty maven-jetty-plugin 6.1.5 10 7171 You can set the port to whatever you want (7171 in this example), just make sure it doesn't conflict with anything else you have running. Then, run 'mvn jetty:run', and a Jetty server will fire up. Nothing to install. Go to http://localhost:7171/ in a browser, and you'll see a link to your application. Now, the really fun part begins: Make changes to your application. Edit your pages, your actions, and your configuration, and Jetty will pick up those changes without you having to rebuild. Changes to your Java code or configuration will cause Jetty to restart your web app, automatically, though it may take several seconds. Page changes, of course, are picked up without a restart. Sometimes, I'll find that Jetty does hang on me and ctrl-c won't kill the maven/jetty process. If that's the case, just hit ctrl-z to put it in the background, 'ps' to get the PID, and 'kill -9 ' to force it to quit. Run 'mvn jetty:run' again. But even if you find that happening to you 2-4 times a day, it's so much faster than WARing it up and pushing it to Tomcat. Plus, anyone on your team can use this same command, as they don't have to install or configure Tomcat. On Aug 29, 2007, at 12:07 PM, sp4rc wrote: Hello listmembers, I am new to all this java webapplication stuff, but I hope you can help me to get into this great technologies. So far I have got my tomcat server (5.5.23-r6) up and runnig, struts-2.0.9 is on my system (gentoo-linux) and I was able to deploy the sample war "blank" ([1] tree output). Now I would like to follow the struts tutorial [2] and create my own war file from scratch... But the problem is, that simply don't know how to create a war file using ant or even maven. Can you point me to the right direction? What is this MANIFEST.MF about? Does ant or maven compile any sourcecode, or is it just packin the files and the servlet-container compiles the first time it gets run? How does the filestructure of my sources have to look like befor using [ant|maven]? Regs /sp4rc [1] /var/lib/tomcat-5.5/webapps/struts2-blank-2.0.9 |-- META-INF | |-- MANIFEST.MF | `-- maven | `-- org.apache.struts | `-- struts2-blank | |-- pom.properties | `-- pom.xml |-- WEB-INF | |-- classes | | |-- LICENSE.txt | | |-- NOTICE.txt | | |-- example | | | |-- ExampleSupport.class | | | |-- HelloWorld.class | | | |-- Login-validation.xml | | | |-- Login.class | | | |-- package.properties | | | `-- package_es.properties | | |-- example.xml | | `-- struts.xml | |-- lib | | |-- commons-logging-1.0.4.jar | | |-- freemarker-2.3.8.jar | | |-- ognl-2.6.11.jar | | |-- struts2-core-2.0.9.jar | | `-- xwork-2.0.4.jar | |-- src | | `-- java | | |-- LICENSE.txt | | |-- NOTICE.txt | | |-- example | | | |-- ExampleSupport.java | | | |-- HelloWorld.java | | | |-- Login-validation.xml | | | |-- Login.java | | | |-- build.bat | | | |-- package.properties | | | `-- package_es.properties | | |-- example.xml | |
Re: ant, maven and creating war's
I haven't touched Ant in years, so I can't help you much there, but with Maven 2, it's as simple as running 'mvn package'. The POM itself says whether the project produces a JAR, WAR, or some other artifact, so package always builds the appropriate artifact for the project. For a web app, that is of course a WAR, for something else, it may be a JAR. For development, you might want to try using Jetty instead of Tomcat, because Maven 2 has a plugin that makes this really simple. Add the following to your POM: org.mortbay.jetty maven-jetty-plugin 6.1.5 10 implementation="org.mortbay.jetty.nio.SelectChannelConnector"> 7171 You can set the port to whatever you want (7171 in this example), just make sure it doesn't conflict with anything else you have running. Then, run 'mvn jetty:run', and a Jetty server will fire up. Nothing to install. Go to http://localhost:7171/ in a browser, and you'll see a link to your application. Now, the really fun part begins: Make changes to your application. Edit your pages, your actions, and your configuration, and Jetty will pick up those changes without you having to rebuild. Changes to your Java code or configuration will cause Jetty to restart your web app, automatically, though it may take several seconds. Page changes, of course, are picked up without a restart. Sometimes, I'll find that Jetty does hang on me and ctrl-c won't kill the maven/jetty process. If that's the case, just hit ctrl-z to put it in the background, 'ps' to get the PID, and 'kill -9 ' to force it to quit. Run 'mvn jetty:run' again. But even if you find that happening to you 2-4 times a day, it's so much faster than WARing it up and pushing it to Tomcat. Plus, anyone on your team can use this same command, as they don't have to install or configure Tomcat. On Aug 29, 2007, at 12:07 PM, sp4rc wrote: Hello listmembers, I am new to all this java webapplication stuff, but I hope you can help me to get into this great technologies. So far I have got my tomcat server (5.5.23-r6) up and runnig, struts-2.0.9 is on my system (gentoo-linux) and I was able to deploy the sample war "blank" ([1] tree output). Now I would like to follow the struts tutorial [2] and create my own war file from scratch... But the problem is, that simply don't know how to create a war file using ant or even maven. Can you point me to the right direction? What is this MANIFEST.MF about? Does ant or maven compile any sourcecode, or is it just packin the files and the servlet-container compiles the first time it gets run? How does the filestructure of my sources have to look like befor using [ant|maven]? Regs /sp4rc [1] /var/lib/tomcat-5.5/webapps/struts2-blank-2.0.9 |-- META-INF | |-- MANIFEST.MF | `-- maven | `-- org.apache.struts | `-- struts2-blank | |-- pom.properties | `-- pom.xml |-- WEB-INF | |-- classes | | |-- LICENSE.txt | | |-- NOTICE.txt | | |-- example | | | |-- ExampleSupport.class | | | |-- HelloWorld.class | | | |-- Login-validation.xml | | | |-- Login.class | | | |-- package.properties | | | `-- package_es.properties | | |-- example.xml | | `-- struts.xml | |-- lib | | |-- commons-logging-1.0.4.jar | | |-- freemarker-2.3.8.jar | | |-- ognl-2.6.11.jar | | |-- struts2-core-2.0.9.jar | | `-- xwork-2.0.4.jar | |-- src | | `-- java | | |-- LICENSE.txt | | |-- NOTICE.txt | | |-- example | | | |-- ExampleSupport.java | | | |-- HelloWorld.java | | | |-- Login-validation.xml | | | |-- Login.java | | | |-- build.bat | | | |-- package.properties | | | `-- package_es.properties | | |-- example.xml | | `-- struts.xml | `-- web.xml |-- example | |-- HelloWorld.jsp | |-- Login.jsp | |-- Menu.jsp | |-- Missing.jsp | |-- Register.jsp | `-- Welcome.jsp `-- index.html [2] http://struts.apache.org/2.x/docs/simple-setup.html - 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]