I really try hard to keep servlet specific code out of my Actions. But, sometimes you do want to have access to Servlet stuff in your JSP View. That's allowable. You still don't want to use scriptlets tho. So I code an Action that is only used in the View. This Action will grab the necessary Servlet Specific code from ServletActionContext.

I'll call this action PageServices and here's how to use it:

<webwork:action value="PageServices">
<webwork:if test="isUserInRole('admin')">
Show admin options
</webwork:if>
</webwork:action>

There's probably some syntactical errors there, but I hope it conveys the general idea.

-Maurice

Hani Suleiman wrote:

You could have all your actions extend a base class, which has a getContextPath
() method, or use request/contextPath

Quoting Justen Stepka <[EMAIL PROTECTED]>:


Morning,

Currently I have the following in my JSP code...

<link rel="stylesheet" type="text/css" media="screen"
href="<%=request.getContextPath()%>/css/generic.css" />

It would be nice to have something like the following...

<link rel="stylesheet" type="text/css" media="screen" href="<ww:contextPath
/>/css/generic.css" />

If there was such a tag I could pretty much remove all of my scriptlet code
from my JSP pages...

Thougths?

Justen Stepka







-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork




-------------------------------------------------------
This sf.net email is sponsored by: See the NEW Palm Tungsten T handheld. Power & Color in a compact size!
http://ads.sourceforge.net/cgi-bin/redirect.pl?palm0001en
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to