Well, I'm glad to hear it.... But now you're making me work... See
below...

> -----Original Message-----
> From: Erik Hatcher [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, July 01, 2003 12:39 PM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] WebWork2, here I come!
> 
> 
> I just wanted to drop a note that I'm almost a switcher to WW2.  I've 
> gotten my demo app that I use for all of my Ant, XDoclet, Lucene, and 
> Struts presentations working just fine in WW2.  Thanks to all that 
> contributed to the wiki and sample app. where I learned 
> enough to make 
> it work.
> 
> I'm on the process of plugging in validation, so I cannot comment on 
> that yet.  My app is a simple single-form and action with a simple 
> String setter (think of a Google page, &q=...).
> 
> I do have a few initial questions to get myself rolling even further 
> along to being a complete switcher:
> 
>    - How do I get to my application context attributes?  I 
> set some in 
> an initialization servlet from its init-param's.

Check out ServletActionContext.getServletContext(). This should let you
do what you want to do (at the expense of not being able to use your
Action outside a Servlet container, but you're used to Struts, so we
forgive you :-))


> 
>    - I plan on refactoring my infamous <custom:label> taglib 
> in Struts 
> to the comparable piece in WW2.  Can someone point me in the right 
> direction to grab the validation metadata so I can tell if a field is 
> required or not, as well as getting at the errors from the validation 
> so I can turn the label red?   Or is there already infrastructure in 
> place to make this unneeded or easier?

It's very easy to check for errors. If your Action implements
ValidationAware (or extends ActionSupport or BaseActionSupport) then
this is built in, as errors will be added to your action and you can use
hasErrors(), hasActionErrors(), hasFieldErrors(), getActionErrors(), and
getFieldErrors() depending on what you need.

For the validation metadata.... You can use
ActionValidatorManager.getValidators(ActionInvocation invocation) to get
them... You can get the ActionInvocation from the ActionContext.
Unfortunately, this will return you a list of validators. You can check
if they're FieldValidators and get the field name to compare... I
realize this is not ideal for what I think you're trying to do. I'm open
to changing / adding to make this easier, if you've got some ideas. 

The other challenge that you might face is if you want these tags to
work when the page is rendered without coming through an Action... We've
had some challenges there as far as not having an ActionInvocation yet.
You'll probably also want to know not the validators on THIS alias, but
the alias you're going to send the request TO. Yeah. Challenges. :-)
Maybe we could work to make them work inside the Form tag, and have that
have the ability to set the namespace and action alias for the sub-tags
to access, then add another access method for looking up the validators
using the namespace and alias to ActionValidatorManager.

> 
> Great work, everyone!  WW2 passed the 15-minute rule of being able to 
> pull it down and immediately be effective with it.  There is still a 
> way to go for me to fully implement all the pieces our 
> current app can 
> do (the main additional piece has to do with custom resource 
> handling, 
> not from a properties file but a DB instead).  

This sounds cool... We could make resource loading pluggable, like we
have for configuration, so message bundles can be pulled from other
sources than just properties files. 

> Perhaps at the next 
> TheServerSide Symposium I'll do an "Advanced WebWork" presentation 
> instead!  :)  (oops... Jason said he wanted that one, so its 
> all his!).
> 

Heh :-) I think there's going to be lots to talk about....

>       Erik
> 
> p.s. I'm current on the list in digest mode, but will likely 
> switch to 
> individual messages as my WW2 usage cranks up.
> 


We're just glad to have you... Next we'll convert Matt Raible, then
we'll teach Craig McClanahan the error of his ways... LOL

Jason



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to