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:
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
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
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
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
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
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
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
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:
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.
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:
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
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
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
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:
${} 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:
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
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
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
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
20 matches
Mail list logo