Author Login
Post Reply
user Digest 22 Mar 2008 15:10:28 -0000 Issue 7940
Topics (messages 184518 through 184538):
Re: s2 : assigning a variable to jsp
184518 by: Deepak Kumar
184519 by: niels
184520 by: Nils-Helge Garli Hegvik
184532 by: niels
184534 by: Nils-Helge Garli Hegvik
Re: struts 2 jsf plugin problem
184521 by: Daniel
184527 by: Nils-Helge Garli Hegvik
Re: Exception in running application
184522 by: Laurie Harper
184523 by: manjunathmn
184531 by: aum strut
Re: authentication question
184524 by: mojoRising
Struts 2.06 to 2.10 Upgrade Problem
184525 by: cree
184526 by: Dave Newton
184528 by: cree
Execute method is not called
184529 by: mojoRising
Setting default @ParentPackage value
184530 by: Guillaume Bilodeau
Exception while uploading a .jpg file from ValidatorForm through struts action
184533 by: Ashima Beri
Running a prepare method before the assigned action method
184535 by: meeboo
184537 by: meeboo
184538 by: meeboo
use continue in <s:iterator>
184536 by: Kibo
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_184518.ezm (zipped)Hi,
In Struts 2 you can use <s:set tag.
Check the example at
http://www.roseindia.net/struts/struts2/struts2controltags/set-tag.shtml
Thanks
-----Original Message-----
From: niels [mailto:nielssiem@(protected)]
Sent: Friday, March 21, 2008 4:35 PM
To: user@(protected)
Subject: s2 : assigning a variable to jsp
Hello,
I want to assign a property to a value in jsp.
in struts 1.3 i could do it like:
<bean:define id="assign" name="somename" property="userName"
type="
java.lang.String" />
Now I can access the variable via: <%=assign%>
How can i accomplish this in struts2 for a property:
<s:property value="userName"/>
thanks
in advance.
Niels

Attachment:
user_184519.ezm (zipped)Hm,
want the otherway around.
something like:
<s:set name="technologyName" value="%{'Java'}"/>
<%= technologyName %>
On Mar 21, 2008, at 12:11 PM, Deepak Kumar wrote:
> Hi,
>
> In Struts 2 you can use <s:set tag.
>
> Check the example at
> http://www.roseindia.net/struts/struts2/struts2controltags/set-tag.shtml
>
> Thanks
>
>
> -----Original Message-----
> From: niels [mailto:nielssiem@(protected)]
> Sent: Friday, March 21, 2008 4:35 PM
> To: user@(protected)
> Subject: s2 : assigning a variable to jsp
>
>
> Hello,
>
> I want to assign a property to a value in jsp.
>
> in struts 1.3 i could do it like:
>
> <bean:define id="assign" name="somename" property="userName"
> type="
java.lang.String" />
>
> Now I can access the variable via: <%=assign%>
>
> How can i accomplish this in struts2 for a property:
> <s:property value="userName"/>
>
>
> thanks
> in advance.
>
> Niels
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_184520.ezm (zipped)Check out the set [1] and property [2] tags. It might also be useful
to read about the tag syntax [3]
[1] - http://struts.apache.org/2.x/docs/set.html
[2] - http://struts.apache.org/2.x/docs/property.html
[3] - http://struts.apache.org/2.x/docs/tag-syntax.html
Nils-H
On Fri, Mar 21, 2008 at 12:05 PM, niels <nielssiem@(protected):
> Hello,
>
> I want to assign a property to a value in jsp.
>
> in struts 1.3 i could do it like:
>
> <bean:define id="assign" name="somename" property="userName"
> type="
java.lang.String" />
>
> Now I can access the variable via: <%=assign%>
>
> How can i accomplish this in struts2 for a property:
> <s:property value="userName"/>
>
>
> thanks
> in advance.
>
> Niels

Attachment:
user_184532.ezm (zipped)Hi Nils,
If looks at the docs, but can't find an example where I can set a jsp
variable. I have this situation, I use oscache like:
<cache:cache key="<%=cacheKey%>" time="120">
Where I want to set the jsp string 'cacheKey' with a property from the
value stack..
like (what of course doesn't work):
String cacheKey = "pre_"+<s:property value="pageAlias" />;
Thanks
Niels
On Mar 21, 2008, at 12:59 PM, Nils-Helge Garli Hegvik wrote:
> Check out the set [1] and property [2] tags. It might also be useful
> to read about the tag syntax [3]
>
> [1] - http://struts.apache.org/2.x/docs/set.html
> [2] - http://struts.apache.org/2.x/docs/property.html
> [3] - http://struts.apache.org/2.x/docs/tag-syntax.html
>
> Nils-H
>
> On Fri, Mar 21, 2008 at 12:05 PM, niels <nielssiem@(protected):
>> Hello,
>>
>> I want to assign a property to a value in jsp.
>>
>> in struts 1.3 i could do it like:
>>
>> <bean:define id="assign" name="somename" property="userName"
>> type="
java.lang.String" />
>>
>> Now I can access the variable via: <%=assign%>
>>
>> How can i accomplish this in struts2 for a property:
>> <s:property value="userName"/>
>>
>>
>> thanks
>> in advance.
>>
>> Niels
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment:
user_184534.ezm (zipped)Ok, that's a bit different... I'm not sure that the S2 tags expose
things as scripting variables (please correct me if I'm wrong)...
I guess you could set the variable to the request scope (or expose it
as a property on your action), and since the FilterDispatcher wraps
the servlet request to look for request attributes on the value stack,
you should be able to look up the attribute in the request, using
regular JSP expressions or JSP EL. This of course assumes that you
don't access the JSP directly, but through an action (which you should
be doing anyway).
Nils-H
On Fri, Mar 21, 2008 at 8:54 PM, niels <nielssiem@(protected):
> Hi Nils,
>
> If looks at the docs, but can't find an example where I can set a jsp
> variable. I have this situation, I use oscache like:
>
> <cache:cache key="<%=cacheKey%>" time="120">
>
> Where I want to set the jsp string 'cacheKey' with a property from the
> value stack..
>
> like (what of course doesn't work):
>
> String cacheKey = "pre_"+<s:property value="pageAlias" />;
>
>
> Thanks
> Niels
>
>
>
> On Mar 21, 2008, at 12:59 PM, Nils-Helge Garli Hegvik wrote:
>
> > Check out the set [1] and property [2] tags. It might also be useful
> > to read about the tag syntax [3]
> >
> > [1] - http://struts.apache.org/2.x/docs/set.html
> > [2] - http://struts.apache.org/2.x/docs/property.html
> > [3] - http://struts.apache.org/2.x/docs/tag-syntax.html
> >
> > Nils-H
> >
> > On Fri, Mar 21, 2008 at 12:05 PM, niels <nielssiem@(protected):
> >> Hello,
> >>
> >> I want to assign a property to a value in jsp.
> >>
> >> in struts 1.3 i could do it like:
> >>
> >> <bean:define id="assign" name="somename" property="userName"
> >> type="
java.lang.String" />
> >>
> >> Now I can access the variable via: <%=assign%>
> >>
> >> How can i accomplish this in struts2 for a property:
> >> <s:property value="userName"/>
> >>
> >>
> >> thanks
> >> in advance.
> >>
> >> Niels
> >
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
>
>

Attachment:
user_184521.ezm (zipped)I've done what you have said, unfortunately without results. I still
receive index.jsp:16:26: No property editor found for the bean "
javax.el.ValueExpression".
Any other ideas?
On Thu, Mar 20, 2008 at 12:43 PM, Nils-Helge Garli Hegvik <nilsga@(protected)>
wrote:
> First of all, I'm not even sure if it's possible to use the portlet
> and the jsf plugin at the same time. I have not tried, but there might
> be issues with it if they try to do conflicting things in the
> interceptors and the results.
>
> > struts.xml
> >
> > <package name="default" extends="portlet-jsf-default"
> namespace="/view">
> >
> > <action name="index" class="com.mycompany.HelloAction">
> > <interceptor-ref name="basicStack"/>
> > <interceptor-ref name="jsfStack"/>
> > <result name="success" type="jsf"/>
> > <result>/WEB-INF/jsp/view/index.jsp</result>
> > </action>
> > </package>
> >
>
> A couple of things here. You're extending portlet-jsf-default, which
> still has the jsfStack as the default interceptor ref. Since you have
> defined a "jsf" package that extends "portlet-jsf-default", you should
> probably extend the "jsf" package instead. However, it's probably just
> as easy configuring the correct interceptor stack and default
> interceptor ref right there in the "portlet-jsf-default" package. In
> addition, you're overriding the default interceptor stack in your
> action definition, so it's not really using the portletDefaultStack,
> even if you had configured your default interceptor stack correctly.
> Unless you need to use different interceptors in your action, there's
> no need configuring those interceptor-refs there.
>
> You could also try swapping the order of the portletDefaultStack and
> the jsfStack and see if that makes a difference.
>
> Nils-H
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184527.ezm (zipped)Sorry, no clue. As I said, I have no idea if this combination will
work at all. Maybe someone with JSF experience can point out what's
wrong. At least it looks like the portlet dispatcher has been able to
execute the action, but it's failing with the JSF result.
You might want to consider creating your portlet with either JSF or
Struts 2 instead of combining them both.
Nils-H
On Fri, Mar 21, 2008 at 1:55 PM, Daniel <pdaniel2005@(protected):
> I've done what you have said, unfortunately without results. I still
> receive index.jsp:16:26: No property editor found for the bean "
>
javax.el.ValueExpression".
>
> Any other ideas?
>
>
> On Thu, Mar 20, 2008 at 12:43 PM, Nils-Helge Garli Hegvik <nilsga@(protected)>
> wrote:
>
>
>
> > First of all, I'm not even sure if it's possible to use the portlet
> > and the jsf plugin at the same time. I have not tried, but there might
> > be issues with it if they try to do conflicting things in the
> > interceptors and the results.
> >
> > > struts.xml
> > >
> > > <package name="default" extends="portlet-jsf-default"
> > namespace="/view">
> > >
> > > <action name="index" class="com.mycompany.HelloAction">
> > > <interceptor-ref name="basicStack"/>
> > > <interceptor-ref name="jsfStack"/>
> > > <result name="success" type="jsf"/>
> > > <result>/WEB-INF/jsp/view/index.jsp</result>
> > > </action>
> > > </package>
> > >
> >
> > A couple of things here. You're extending portlet-jsf-default, which
> > still has the jsfStack as the default interceptor ref. Since you have
> > defined a "jsf" package that extends "portlet-jsf-default", you should
> > probably extend the "jsf" package instead. However, it's probably just
> > as easy configuring the correct interceptor stack and default
> > interceptor ref right there in the "portlet-jsf-default" package. In
> > addition, you're overriding the default interceptor stack in your
> > action definition, so it's not really using the portletDefaultStack,
> > even if you had configured your default interceptor stack correctly.
> > Unless you need to use different interceptors in your action, there's
> > no need configuring those interceptor-refs there.
> >
> > You could also try swapping the order of the portletDefaultStack and
> > the jsfStack and see if that makes a difference.
> >
> > Nils-H
> >
>
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>

Attachment:
user_184522.ezm (zipped)
Attachment:
user_184523.ezm (zipped)
Attachment:
user_184531.ezm (zipped)
Attachment:
user_184524.ezm (zipped)
I have moved all JSP's under WEB-INF directory (e.g.
/WEB-INF/pages/login.jsp), and this solution seems to work perfectly on my
local environment with exploded directory structure. However, Struts seems
to not be working at all when we package and deploy an ear file (before I
moved the jsp's it had been working with ear deployment)...I am still
troubleshooting, but any ideas what could be the issue here?
Thanks
John
Jeromy Evans - Blue Sky Minds wrote:
>
> I've been told that some older containers don't allow you to forward to
> JSP's behind /WEB-INF. It wouldn't surprise me.
> Other than that I've found Ian's suggestion to be the most effective way
> to ensure users can't access JSPs directly, IMO a must for Tiles, html
> fragments and any page using struts tags.
>
> The only issue I've experienced is when (bad) scriptets within the JSP
> manipulate the request object directly, which is assumed to use the
> /xxx.jsp URI but is actually /WEB-INF/results/xxx.jsp.
>
> Many would argue that best practice is to not use JSPs at all. Another
> group would argue that Acegi should be used rather than rolling your own
> filter.
>
> Hope that helps.
>
> mojoRising wrote:
>> Is this considered the Best Practice: Keeping all JSP's under the WEB-INF
>> directory? We have not done that on my project, I am curious if there are
>> plus' and minus' to this?
>>
>> Thanks,
>> John
>>
>>
>> The easiest way is to always have the user call an action to get a JSP,
>> even if it is a simple page. You then also ensure that all data
>> necessary for that page has been obtained. The, by placing the JSP's in
>> the WEB-INF directory you will prevent access directly from a browser
>> (only from the s2 dispatcher).
>>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184525.ezm (zipped)
Attachment:
user_184526.ezm (zipped)--- cree <vint@(protected):
> I have been running an earlier version of struts 2 and from my reading
> to gain struts-dojo-tags support I need to run on struts 2.1. I have
> downloaded the struts 2.1 zip file and have replaced all old struts 2.06
> with struts 2.1 jar files.
>
> This is apparently the only error I have recieved thus far. From more
> reading others suggest missing jar files. I have all minimum required, at
> this point I am not really sure why it says it cannot find this jar file.
It doesn't say it can't find the jar file; it says it's unable to load the
bean.
> Unable to load bean: type:
com.opensymphony.xwork2.util.ValueStackFactory> class:
com.opensymphony.xwork2.ognl.OgnlValueStackFactory - bean -
> [...]
> Caused by:
java.lang.IncompatibleClassChangeError: Implementing class
You can't just stop reading a stack trace at the top line :)
That said:
- If you want the *new* Dojo tags, yes, you need 2.1. If the tags from 2.0
are adequate, then you don't.
- S2.1 isn't released, so there can always be unexpected issues.
Personally I'd try creating a "sanity check" 2.1.0 (if you're dead-set on
using that; personally I'd use trunk) which is nothing more than a "hello,
world" app to make sure it works rather than blindly replacing your current
app with 2.1 jars. If you're not interested in doing that, I'd try doing a
complete clean and redeploy and make sure that the old libraries are not
being deployed or are still there; without really thinking about it it sounds
like there could be two versions of a library on the classpath etc.
I haven't had any startup issues with 2.1.0 or 2.1.1 (trunk), so I'd suspect
environmental issues first.
Dave

Attachment:
user_184528.ezm (zipped)Thanks for the response, my final thought was what you mentioned that there
are two (or more) sets of jars competing causing an environment issue. I
guess this was one of those "I hope there is an unresolved problem before I
go through all the jars that need to be replaced" =).
I will consider what you have mentioned and see if I can resolve this
problem.
Thanks again,
John
newton.dave wrote:
>
> --- cree <vint@(protected):
>> I have been running an earlier version of struts 2 and from my reading
>> to gain struts-dojo-tags support I need to run on struts 2.1. I have
>> downloaded the struts 2.1 zip file and have replaced all old struts 2.06
>> with struts 2.1 jar files.
>>
>> This is apparently the only error I have recieved thus far. From more
>> reading others suggest missing jar files. I have all minimum required,
>> at
>> this point I am not really sure why it says it cannot find this jar file.
>
> It doesn't say it can't find the jar file; it says it's unable to load the
> bean.
>
>> Unable to load bean: type:
com.opensymphony.xwork2.util.ValueStackFactory>> class:
com.opensymphony.xwork2.ognl.OgnlValueStackFactory - bean -
>> [...]
>> Caused by:
java.lang.IncompatibleClassChangeError: Implementing class
>
> You can't just stop reading a stack trace at the top line :)
>
> That said:
>
> - If you want the *new* Dojo tags, yes, you need 2.1. If the tags from 2.0
> are adequate, then you don't.
> - S2.1 isn't released, so there can always be unexpected issues.
>
> Personally I'd try creating a "sanity check" 2.1.0 (if you're dead-set on
> using that; personally I'd use trunk) which is nothing more than a "hello,
> world" app to make sure it works rather than blindly replacing your
> current
> app with 2.1 jars. If you're not interested in doing that, I'd try doing a
> complete clean and redeploy and make sure that the old libraries are not
> being deployed or are still there; without really thinking about it it
> sounds
> like there could be two versions of a library on the classpath etc.
>
> I haven't had any startup issues with 2.1.0 or 2.1.1 (trunk), so I'd
> suspect
> environmental issues first.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184529.ezm (zipped)
I apologize for the vague nature of this question. To clarify, I have a login
page that works for the input method, but will not call the execute method.
I have logging comments that show that when I call the action for my form,
the prepare method fires, then the validate method completes(without
errors), and then it just stops...it never calls the execute method. Any
idea what could cause that?
My form tag:
<s:form validate="true" cssClass="goLoginTable" action="login_execute"
method="post" namespace="/pages" theme="goForm" >
My struts.xml file:
<package name="pages" namespace="/pages" extends="AveroSecure">
<action name="login_*" method="{1}" class="pages.Login">
<interceptor-ref name="paramsPrepareParamsStack"/>
<result name="execute">/WEB-INF/pages/login.jsp</result>
<result name="input">/WEB-INF/pages/login.jsp</result>
<result name="error">/WEB-INF/pages/login.jsp</result>
<result name="success" type="redirect-action">
terms_input
/userMgmt
true
true
login
</result>
</action>
<action name="*" class="pages.Support">
<result>/WEB-INF/pages/{1}.jsp</result>
</action>
<action name="logout" class="pages.Logout">
<result>/WEB-INF/pages/logout.jsp</result>
</action>
</package>
mojoRising wrote:
>
> I have moved all JSP's under WEB-INF directory (e.g.
> /WEB-INF/pages/login.jsp), and this solution seems to work perfectly on my
> local environment with exploded directory structure. However, Struts seems
> to not be working at all when we package and deploy an ear file (before I
> moved the jsp's it had been working with ear deployment)...I am still
> troubleshooting, but any ideas what could be the issue here?
>
> Thanks
>
> John
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184530.ezm (zipped)
Hi guys,
I've spent some time migrating my Struts2 app configuration from struts.xml
to annotations. So far so good, it's nice having configuration next to
actual code.
One thing that's bothering me is the fact that I need to put a
@ParentPackage annotation on each action class for it to pick up my custom
package (with custom interceptors). I have tried doing this with the
CodeBehind plugin but the class doesn't seem to be bound to the package in
the end.
Isn't there a constant in ZeroConfig that would do exactly this?
Thanks,
GB
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184533.ezm (zipped)
Attachment:
user_184535.ezm (zipped)
Hi all
I have a class for several actions and each action is mapped to a method,
like this:
<action name="update/modelObject"
class="net.myapp.web.modelObjectActions"
method="update">
<result>/index.jsp</result>
</action>
The above action will fire when a form is submitted and the modelObject
properties are populated via the form fields. Now that I want is to invoke a
prepare method before the update method so that I first can read the model
object from the database and then populate its fields. I did implement
preparable in modelObjectActions but then the prepare method will be invoked
before all actions in that class, I want it to be invoked just for this
specific action.
Any ideas?
Thanks
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184537.ezm (zipped)
Ahh nevermind the first mail, I managed to work around it.
I still have a problem of not being able to access parameters via my prepare
method though. Here's my action class:
public class UserActions extends StrutsSupport implements Preparable {
public void prepare()
{
if(id != null) //property is located in superclass StrutsSupport
user= appManager.readUser(Long.valueOf(id));
}
}
and the struts mapping:
<action name="update/user/*"
class="net.myapp.web.UserActions">
<interceptor-ref name="paramsPrepareParamsStack"/>
{1}
<result>/models/user/update.jsp</result>
</action>
The whole flow is that when you access the above action the user object is
read and its values populate the form in update.jsp. But the id property is
never set so the form is never populated. I even tried setting
paramsPrepareParamsStack as the default stack but with no luck.
meeboo wrote:
>
> Hi all
>
> I have a class for several actions and each action is mapped to a method,
> like this:
>
> <action name="update/modelObject"
> class="net.myapp.web.modelObjectActions"
> method="update">
> <result>/index.jsp</result>
> </action>
>
> The above action will fire when a form is submitted and the modelObject
> properties are populated via the form fields. Now that I want is to invoke
> a prepare method before the update method so that I first can read the
> model object from the database and then populate its fields. I did
> implement preparable in modelObjectActions but then the prepare method
> will be invoked before all actions in that class, I want it to be invoked
> just for this specific action.
>
> Any ideas?
>
> Thanks
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184538.ezm (zipped)
It seems as if the preparable method can't parse parameters if they are in
the following format
update/modelObject/10.action (where 10.action is the primary key)
where as it works fine when using action urls like this
update/modelObject?10.action
Is this expected behavior?
meeboo wrote:
>
> Hi all
>
> I have a class for several actions and each action is mapped to a method,
> like this:
>
> <action name="update/modelObject"
> class="net.myapp.web.modelObjectActions"
> method="update">
> <result>/index.jsp</result>
> </action>
>
> The above action will fire when a form is submitted and the modelObject
> properties are populated via the form fields. Now that I want is to invoke
> a prepare method before the update method so that I first can read the
> model object from the database and then populate its fields. I did
> implement preparable in modelObjectActions but then the prepare method
> will be invoked before all actions in that class, I want it to be invoked
> just for this specific action.
>
> Any ideas?
>
> Thanks
>
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184536.ezm (zipped)
Hi conference
Can I use "continue" in struts tag <s:iterator> ?
----------------------------------------------------------
from:
for (Category cat : category){
if (cat.getId() == 1)
continue;
System.out.println(cat.getName());
}
-----------------------------------------------------------------------------
to:
<s:iterator value="category" status="rowstatus" >
<s:if test="id == 1"> ????????????? </s:if>
<li><s:property value="name"/></li>
</s:iterator>
-------------------------------------------------
Thaks for help
Tomas Jurman
Czech Republic
--
Sent from the Struts - User mailing list archive at Nabble.com.