Re: [S2] populating user roles

2007-05-01 Thread Josh Vickery
The easiest way I've found to do this is to write a ServletFilter that wraps the HttpServletRequest with a class that implements the isUserInRole method based on your database roles from an object you populated and placed in the Session. Josh On 5/1/07, Flemming Seerup [EMAIL PROTECTED] wrote:

Re: [S2] populating user roles

2007-05-05 Thread Josh Vickery
Josh Vickery [EMAIL PROTECTED]: Flemming, if you are not using JAAS, and don't want to interact with it, you can fake it by wrapping the HttpServletRequest in a servlet filter. This is the method used by SecurityFilter (http://securityfilter.sourceforge.net/) and is very easy to implement

Re: moving on to Hibernate with S2...

2007-05-11 Thread Josh Vickery
Spring has several components, but the one I use (and the one I think is the most popular) is the Inversion of Control (IOC) framework. Struts 2 (when it was Web Work) had some IOC support, but it wasn't as full featured as what Spring offers. Spring also has an MVC, which is a direct competitor

Re: moving on to Hibernate with S2...

2007-05-12 Thread Josh Vickery
If you like RoR (and I do) you might like some of the magic that Struts 2 and Spring can provide. It isn't quite perfect yet (at least not the Struts 2 part), but I'm pretty happy with it. By magic I mean convention based configuration, which cuts down on the number of places you have to enter

Re: checkboxlist formatted vertically?

2007-05-17 Thread Josh Vickery
I agree! I would use checkboxes instead of a checkboxlist rather than write my own theme. I did something like that recently: ul s:iterator value=questions li s:checkbox name=assignedQuestionIdMap[%{id}]/jsp:include page=/web/includes/question.jsp/ /li /s:iterator /ul On

Re: [S2] How to get an object from Spring inside an interceptor

2007-05-23 Thread Josh Vickery
Not the most elegant solution, but you can pull the ApplicationContext from the ServletContext: ServletContext sc = ServletActionContext.getServletContext(); (ApplicationContext)sc.getAttribute(org.springframework.web.context.WebApplicationContext.ROOT); Josh On 5/23/07, CĂ©lio Cidral Junior

[S2] s:include and jsp:include of Struts actions blank page

2007-05-25 Thread Josh Vickery
I'm running into some strange behavior when using s:include and jsp:include with Struts actions as the include target. If I put s:include value=someActionName.do/ or jsp:include page=someActionName.do/ I get a completely blank page with no error messages. It works fine if I include a jsp

Re: [S2] s:include and jsp:include of Struts actions blank page

2007-05-25 Thread Josh Vickery
Well, I couldn't figure out why the include tags don't work, but I did find: s:action name=actionName executeResult=true/ which seems to do the trick. Josh On 5/25/07, Josh Vickery [EMAIL PROTECTED] wrote: I'm running into some strange behavior when using s:include and jsp:include with Struts

Re: Exception when tying to display a 404 error page.

2007-11-07 Thread Josh Vickery
Why not redirect to the struts 2 action you want? This is the jsp I use for error pages in tomcat: %response.sendRedirect(error.do);% where error.do points to a struts 2 action Josh On Nov 7, 2007 5:15 PM, matihost [EMAIL PROTECTED] wrote: This error page is defined in my web.xml:

Re: Struts 2 Application Approach.

2007-06-04 Thread Josh Vickery
Where do your domain classes fit into your structure? I suggest thinking about whether you need those helper classes (I'm assuming this is something like a Service Layer) or whether the logic that you are planning on putting in the helper classes would be better placed in your domain classes.

Re: How to format the decimal

2007-06-09 Thread Josh Vickery
Or, you can use the s:text tag (assuming you are using struts 2) and: s:text name=format.decimal s:param name=value value=decimalValue/ /s:text where format.decimal is defined in a resource bundle somewhere (see http://cwiki.apache.org/confluence/display/WW/Localization for details) as:

Re: Dao subclass

2007-06-29 Thread Josh Vickery
I would argue against making interfaces for all your DAOs unless you know up front that you will be creating multiple implementations. So long as you don't make any of the methods on your DAOs static, it is an easy matter to extract interfaces from them at a later point, when and if you need to

Re: How to display the ' character from a .properties file

2007-07-12 Thread Josh Vickery
Actually, I think this is a bug in the handling of MessageResources in Struts 2. Not only do ' characters in properties files fail to display, they cause parameter substitution to fail. For example, if you have a properties file: foo=Message's for {0} and you attempt to display it in a jsp

Re: How to display the ' character from a .properties file

2007-07-12 Thread Josh Vickery
On 7/12/07, Niall Pemberton [EMAIL PROTECTED] wrote: I don't use Struts2 - but my guess is that this is down to a single quote being an escape character in MessageFormat: http://java.sun.com/j2se/1.4.2/docs/api/java/text/MessageFormat.html So its probably not a bug - just need to escape single

Re: Struts2 and images from database

2007-07-18 Thread Josh Vickery
If you return null from your Action you can write directly to the response: HttpServletResponse response = ServletActionContext.getResponse(); response.setContentType(image/jpg); out = response.getOutputStream(); write image here return null; On 7/18/07, Roberto Nunnari [EMAIL PROTECTED] wrote:

Re: using ${ , # and %{

2007-08-14 Thread Josh Vickery
${} is for writing JSP EL, while %{} is for writing OGNL. Both serve similar purposes, and if you have a servlet container that supports JSP EL and are running Struts 2, they can be used almost interchangeably. For more details you can read up on the JSP EL:

Re: How format a string when it is Displayed?

2007-08-29 Thread Josh Vickery
http://cwiki.apache.org/confluence/display/WW/text will do what you need. Take look at the example with resource property format.money and note the link to http://java.sun.com/j2se/1.4.2/docs/api/java/text/MessageFormat.html which has the info you need to build a format pattern. You could also

Re: How format a string when it is Displayed?

2007-08-30 Thread Josh Vickery
Oops, I missed that you are using Struts 1. I believe that you can use the format attribute of the bean:write tag: http://struts.apache.org/1.1/userGuide/struts-bean.html#write to specify a format string as described on: http://java.sun.com/j2se/1.4.2/docs/api/java/text/MessageFormat.html Josh

Re: Iterate Hashmap with s:iterate

2007-09-12 Thread Josh Vickery
Looking through some code here, this is what I have: s:iterator value=map.entrySet() s:property value=%{key}/ s:property value=%{value}/ /s:iterator The above seems to work OK, though I'm a little curious about the inclusion of the double parentheses at the end of entrySet -- OGNL, as far as

Re: GridView - save multiple items at the same time

2007-10-15 Thread Josh Vickery
You can do this with Struts 2, but I've found that it can be a bit hairy when it comes to type conversion. The general idea is to use an action property which is a Map of objects that you want to save keyed by a unique identifier for each one. The two problems that I run into when doing this