Re: Handling wildcard action names with dot.
Coincidentally, I've been working on this same issue. I needed struts actions to handle PDFs. My solution was to add pdf to the action extensions, as in: constant name=struts.action.extension value=pdf, / Note the critical trailing comma which allows for blank extensions in addition to pdf. I'm not sure exactly how struts, by default, knows to ignore anything with an extension. Mostly this is a good thing, as it allows you to serve images, static resources, etc., without going through struts. There's this interesting comment in the default.properties file inside the struts core jar: ### The blank extension allows you to match directory listings as well as pure action names ### without interfering with static resources. struts.action.extension=action,, Sounds like what you need is to handle ALL urls, with any possible extension? I don't know how to do that, but I bet there's a way. Of course this would mean that you would have to handle all static resources through struts which could be painful. But maybe you don't have any. Thanks, Fred On 3/1/2011 8:59 AM, GF wrote: I configured struts to handle url mapping with no extensions this way constant name=struts.action.extension value=,, / With this action mapping action name=* class=myAction method=myMethod param name=myId{1}/param result type=tilesmyTile/result /action I can handle urls like: /aaa/bbb/ccc /aaa/bbb/ddd /aaa/bbb/eee But i wish to handle this kind of urls too: /aaa/bbb/fff.xyz /aaa/bbb/fff.jkw /aaa/bbb/fff.anykindofextension But when i insert a DOT in the action name (mapped by a wildcard) I get a 404 error. Any idea? Thank you - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Can I access current freemarker configuration from an action?
Hi, We use freemarker results. I'd also like to use freemarker templates to build an email message. Can I access the current freemarker configuration object inside my action? I've seen examples of how to create a NEW configuration object, but that's not as good. In particular, I'd like to store the email templates in the same location as the rest of the freemarker templates (which the current configuration knows about from standard struts config.). Is there a proper (or improper) way to do this? Thanks, Fred - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
select tag in freemarker
Hi, Can anyone tell me the freemarker equivalent of this (in particular the list with map literal syntax): s:select name=months list=#{'01':'Jan', '02':'Feb'} / I've tried many, many different variations and I'm getting nowhere. I do NOT understand the difference in attribute syntax in the UI tags between jsp and freemarker. Here are a few variations that DON'T work: list=#{'01':'Jan', '02':'Feb'} - same as above list=%{#{'01':'Jan', '02':'Feb'}} - force OGNL? list={'01':'Jan', '02':'Feb'} - pure freemarker Thanks, Fred Toth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do I make a checkbox initially checked?
Hi, Yes, it works fine if I use prepare() and create my own object. However, my understanding from the docs was that struts would create my object for me, based on hitting a null pointer. But that does not seem to be the case. Also, if I use the value=true method, then my box is checked always, regardless of user input. Thanks, Fred Nuwan Chandrasoma wrote: Hi, If you want the check box to be checked initially you can use the tag like this: s:checkbox name=user.sendEmail value=true/ are you calling the prepare method to initialized you backing object?, according to my understanding the backing object will not be created and initiallized if you havent done in the prepare method, the form well be render on the page and when you click the submit buttion. a backing objected will be created and the values entered on the form will be set the object. Thanks, Nuwan. - Original Message - From: Fred Toth [EMAIL PROTECTED] To: Struts Users Mailing List user@struts.apache.org Sent: Saturday, July 07, 2007 9:11 PM Subject: How do I make a checkbox initially checked? Hi again, I'm working on a form where a particular checkbox should be initially checked when the form first comes up. None of the options in s:checkbox seem to support this. I tried to have my backing object initialized with the particular Boolean set to true, but struts doesn't seem to actually create my object (counter to the docs), until submission time. If I have: s:checkbox name=user.sendEmail/ The docs say that if user doesn't exist (which is the case on initial display of the form), OGNL will get a null value, and struts will create a user object. This doesn't seem to be happening. Is there a way to do this using the UI tags? Thanks, Fred - 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]
Can freemarker use OGNL null value handling?
Hi, I'm a big fan of struts2 and freemarker, but I'm just now getting around to using the struts2 UI tags in freemarker. It appears that automatic null value handling feature of struts2 is not available from freemarker? To be more specific: In jsp, you can do this: s:textfield name=user.firstName value=${user.firstName}/ This works even when user doesn't exist because of the OGNL null value handling. OGNL discovers that user is null and creates a new user. Likewise for firstName. However, the same tag in freemarker does not work: @s:textfield name=user.firstName value=${user.firstName}/ We get an exception user is undefined. This is presumably because the freemarker expression language is being used, and not OGNL? So I'm amazed that I have not been able to find a single mention of this very important issue! Am I missing a simple work-around? Can anyone comment? Thanks, Fred Toth - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can freemarker use OGNL null value handling?
Thanks. That was it! I must have been through the doc a dozen times, but I missed the '$' vs '%' issue. Thanks again. Fred Dale Newfield wrote: Fred Toth wrote: To be more specific: In jsp, you can do this: s:textfield name=user.firstName value=${user.firstName}/ This works even when user doesn't exist because of the OGNL null value handling. If you use ${}, you're not using ognl, but rather el. Try replacing your $'s with %'s. -Dale - 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]
How do I make a checkbox initially checked?
Hi again, I'm working on a form where a particular checkbox should be initially checked when the form first comes up. None of the options in s:checkbox seem to support this. I tried to have my backing object initialized with the particular Boolean set to true, but struts doesn't seem to actually create my object (counter to the docs), until submission time. If I have: s:checkbox name=user.sendEmail/ The docs say that if user doesn't exist (which is the case on initial display of the form), OGNL will get a null value, and struts will create a user object. This doesn't seem to be happening. Is there a way to do this using the UI tags? Thanks, Fred - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]