Author Login
Post Reply
user Digest 11 Aug 2008 17:39:57 -0000 Issue 8188
Topics (messages 189893 through 189917):
Re: [S2] LookupDispatchAction Equivalent in Struts 2
189893 by: Dave Newton
Re: [OT] Re: [S2] general question about cookies and namespace
189894 by: Randy Burgess
Re: [S2] general question about cookies and namespace
189895 by: Randy Burgess
Re: Simple validation does not work
189896 by: Anton Bashmakov
Re: not displaying Action errors
189897 by: Richard Yee
189898 by: Narasimha Raju Naidu
189900 by: Umar Bilal
value-stack data lost when using dynamic result.
189899 by: Dwipin C
189903 by: stanlick.gmail.com
189905 by: Dwipin C
Struts Validation framework
189901 by: Pappula Jagan
Re: action-param
189902 by: Lukasz Lenart
Re: <s:action/> redirect does not work with Tiles.
189904 by: Jeromy Evans
Redirect-Action Problem with struts 2.0.11 and multiple packages
189906 by: DavidCAIT
189907 by: Lukasz Lenart
Remotely passing parameters to struts
189908 by: jaki
189915 by: Felipe Lorenz
[Struts 2] NetBeans can't find my ResourceBundle properties file (localization issue)
189909 by: Ylva Degerfeldt
189911 by: Dave Newton
189916 by: Ylva Degerfeldt
How to resolve list property for ModelDriven Action?
189910 by: Haulyn R. Jason
189912 by: Dave Newton
189913 by: Haulyn R. Jason
189914 by: Dave Newton
Re: Simplified usage of:@(protected)
189917 by: Ramanathan RV
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_189893.ezm (zipped)--- On Sat, 8/9/08, Lalchandra Rampersaud wrote:
> Thanks for the quick reply. Mapping is exacty the solution I need,
> but I don't know how to implement mapping in struts 2. It would be
> helpful if you can indicate where I can start looking.
The action configuration documentation [1] describes how to configure (via XML) the action method called for a particular action mapping.
The <s:submit.../> tag documentation [2] includes the "method" attribute, which defines the action method called on submission.
The documentation is your friend; I'd spend some time poking around the guide links [3].
Dave
[1] http://struts.apache.org/2.x/docs/action-configuration.html
[2] http://struts.apache.org/2.x/docs/submit.html
[3] http://struts.apache.org/2.x/docs/guides.html

Attachment:
user_189894.ezm (zipped)I believe so.
Regards,
Randy Burgess
Sr. Software Architect
D5 Systems, LLC
> From: Dave Newton <newton.dave@(protected)>
> Reply-To: Struts Users Mailing List <user@(protected)>
> Date: Sat, 9 Aug 2008 10:54:59 -0700 (PDT)
> To: Struts Users Mailing List <user@(protected)>
> Subject: [OT] Re: [S2] general question about cookies and namespace
>
> --- On Sat, 8/9/08, Pierre Thibaudeau wrote:
>> [...] I wish to remember the current surfing language of a user
>> and set that in a cookie with path "/", who's to say that, on
>> the next session that the user will start, she won't enter the site
>> through a different logical path?
>>
>> Is there such a thing as site-wide cookies?
>
> Isn't a path of "/" a "site-wide" cookie?
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_189895.ezm (zipped)Yep absolutely. Just my $.02. I used to use cookies all the time but found
they're more trouble than they are worth compared to the session. I only use
them now when they are the only good solution. :)
Regards,
Randy Burgess
Sr. Software Architect
D5 Systems, LLC
> From: Pierre Thibaudeau <pierre.thibaudeau@(protected)>
> Reply-To: Struts Users Mailing List <user@(protected)>
> Date: Sat, 9 Aug 2008 16:19:08 -0400
> To: Struts Users Mailing List <user@(protected)>
> Subject: Re: [S2] general question about cookies and namespace
>
> 2008/8/9 Randy Burgess <randyb@(protected)>
>
>> As long as you set the cookie path and stick to that path it
>> doesn't matter where the user enters the site.
>
>
> Well, not entirely, it seems to me. Say, for example, that I were to set
> the path to "/something/very/complex/and/unwieldy", the browser would make
> those cookies available with the request only when the namespace of the
> request were to be the same (or a child) of that long path.
>
> Which is why, as you point out, the only practical options are "/" or
> "contextPath()". (In which case, indeed, it doesn't matter where the user
> enters.)

Attachment:
user_189896.ezm (zipped)Actually I can't find xwork 2.0.6, it's only 2.1 after 2.5 on the official
xwork site. I've downloaded strats 2.0.11.2 (i was using 2.0.11.1 before)
and tried it, but result is till the same.
On Sat, Aug 9, 2008 at 9:50 PM, Struts Two <strutstwo@(protected):
> xwork2.0.5 is missing a patch for websphere users, use xwork2.0.6. I am
> also using RAD 7.5 and Was 6.1.0.17 and EJB3 feature pack. When I upgraged
> to struts 2.0.12, I had problems in running my validations and some more
> issues, I downgraded to 2.0.11.1 and everything is fine. However, the
> struts 2 folks in their release note mentioned that xwork 2.0.5 is missing a
> patch for WAS users and the patch is included in xwork 2.0.6. So you can
> either use 2.0.11.1 or use xwork 2.0.6 instead of xwork 2.0.5
>
>
>
> ----- Original Message ----
> From: holod <serega.sheypak@(protected)>
> To: user@(protected)
> Sent: Saturday, August 9, 2008 6:39:42 AM
> Subject: Re: Simple validation does not work
>
>
> http://www.mvnrepository.com/artifact/com.opensymphony/xwork/2.0.5
>
> Scroll down page and see Source Control paragraph.
> Use some svn client and checkout branch.
> Using command mvn package you can compile and package the project.
> Then use your new jar instead of official-released.
> It helped for me, but I'm using WebSphere AppServer 6.1 + EJB3 feature
> pack.
> The problem was in difference between IBM JDK and Sun JDK.
> Good luck, Anton.
>
>
> __________________________________________________________________
> Ask a question on any topic and get answers from real people. Go to Yahoo!
> Answers and share what you know at http://ca.answers.yahoo.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Best regards,
Bashmaкov Anton

Attachment:
user_189897.ezm (zipped)You are using == to test string equality instead of equals()
-R
Sent from my iPhone
On Aug 8, 2008, at 11:52 PM, "Narasimha Raju Naidu"
<feel2work@(protected):
> hi to all,
>
>
> im sending my code please check where i am doing mistake
>
> form.jsp
> ---------------
> <%@(protected)"%>
> <html:errors/>
> <div style="background-color:#fcc;border: 1px dashed
> blue;width:280px;margin:2px;">
> <html:form action="/login.do">
> <table cellpadding=2 align=center style="font-family:verdana;font-
> size:15;">
>
> <tr><td><b>User Name</b></td>
> <td><html:text property="userName"/></td></tr>
> <tr>
> <td><b>Password</b></td>
> <td><html:password property="pwd"/></td></tr>
> <tr><td>
> <html:submit property="submit" value="Connect"/></td><td>
> <html:reset property="reset" value="Re-Try"/></td></tr>
> </table>
> </html:form>
> </div>
>
> ---
> ----------------------------------------------------------------------
> formbean
> ---------------------------
> import javax.servlet.http.*;
> import org.apache.struts.action.*;
>
> public class LoginBean extends ActionForm
> {
> private String userName;
> private String pwd;
>
> public void setUserName(String userName)
> {
> this.userName=userName;
> }
> public String getUserName()
> {
> return userName;
> }
> public void setPwd(String pwd)
> {
> this.pwd=pwd;
> }
> public String getPwd()
> {
> return pwd;
> }
>
> public void reset(ActionMapping mapping,HttpServletRequest request)
> {
> System.out.println("--reset LoginForm--");
> this.userName="";
> this.pwd="";
> }
>
> public ActionErrors validate(ActionMapping
> mapping,HttpServletRequest
> request)
> {
> ActionErrors aes=new ActionErrors();
> if(userName==null||userName=="")
> {
> aes.add("userName",new ActionError("UserName is Required"));
> }
> if(pwd==null||pwd=="")
> {
> aes.add("pwd",new ActionError("Password is Required"));
> }
> return aes;
> }
> }
>
> --------------------------------------------------------------
> action class
> ----------------------
>
> import javax.servlet.http.*;
> import org.apache.struts.action.*;
>
>
> public class LoginAction extends Action
> {
> public ActionForward execute(ActionMapping mapping,ActionForm
> form,HttpServletRequest request,HttpServletResponse response) throws
> Exception
> {
> LoginBean login= (LoginBean)form;
> return mapping.findForward("succ");
> }
> }
>
> -------------------------------------------------------------------
> struts-config.xml code
> ------------------------------
> <form-beans>
> <form-bean name="LBBean" type="LoginBean"/>
> </form-beans>
>
>
> <action path="/login" type="LoginAction" name="LBBean" scope="request"
> input="/pages/login.jsp" validate="true">
> <forward name="succ" path="/pages/succ.jsp"/>
> </action>
>
>
> while compiling im not getting any errors while running if i did not
> give
> any input i am getting bullet not the exact error what i gave.
> waiting for
> you people's valuable replys.
>
> Regards,
>
> Narasimha Raju
>
>
>
>
> uni...

Attachment:
user_189898.ezm (zipped)thanks for your reply. but itz not working. im getting the same output. for
reference im sending screen shot of that output please check once.
Regards,
-------------
On Sun, Aug 10, 2008 at 9:55 PM, Richard Yee <ryee@(protected):
> You are using == to test string equality instead of equals()
> -R
>
> Sent from my iPhone
>
>
> On Aug 8, 2008, at 11:52 PM, "Narasimha Raju Naidu" <feel2work@(protected)>
> wrote:
>
> hi to all,
>>
>>
>> im sending my code please check where i am doing mistake
>>
>> form.jsp
>> ---------------
>> <%@(protected)"%>
>> <html:errors/>
>> <div style="background-color:#fcc;border: 1px dashed
>> blue;width:280px;margin:2px;">
>> <html:form action="/login.do">
>> <table cellpadding=2 align=center
>> style="font-family:verdana;font-size:15;">
>>
>> <tr><td><b>User Name</b></td>
>> <td><html:text property="userName"/></td></tr>
>> <tr>
>> <td><b>Password</b></td>
>> <td><html:password property="pwd"/></td></tr>
>> <tr><td>
>> <html:submit property="submit" value="Connect"/></td><td>
>> <html:reset property="reset" value="Re-Try"/></td></tr>
>> </table>
>> </html:form>
>> </div>
>>
>> -------------------------------------------------------------------------
>> formbean
>> ---------------------------
>> import javax.servlet.http.*;
>> import org.apache.struts.action.*;
>>
>> public class LoginBean extends ActionForm
>> {
>> private String userName;
>> private String pwd;
>>
>> public void setUserName(String userName)
>> {
>> this.userName=userName;
>> }
>> public String getUserName()
>> {
>> return userName;
>> }
>> public void setPwd(String pwd)
>> {
>> this.pwd=pwd;
>> }
>> public String getPwd()
>> {
>> return pwd;
>> }
>>
>> public void reset(ActionMapping mapping,HttpServletRequest request)
>> {
>> System.out.println("--reset LoginForm--");
>> this.userName="";
>> this.pwd="";
>> }
>>
>> public ActionErrors validate(ActionMapping mapping,HttpServletRequest
>> request)
>> {
>> ActionErrors aes=new ActionErrors();
>> if(userName==null||userName=="")
>> {
>> aes.add("userName",new ActionError("UserName is Required"));
>> }
>> if(pwd==null||pwd=="")
>> {
>> aes.add("pwd",new ActionError("Password is Required"));
>> }
>> return aes;
>> }
>> }
>>
>> --------------------------------------------------------------
>> action class
>> ----------------------
>>
>> import javax.servlet.http.*;
>> import org.apache.struts.action.*;
>>
>>
>> public class LoginAction extends Action
>> {
>> public ActionForward execute(ActionMapping mapping,ActionForm
>> form,HttpServletRequest request,HttpServletResponse response) throws
>> Exception
>> {
>> LoginBean login= (LoginBean)form;
>> return mapping.findForward("succ");
>> }
>> }
>>
>> -------------------------------------------------------------------
>> struts-config.xml code
>> ------------------------------
>> <form-beans>
>> <form-bean name="LBBean" type="LoginBean"/>
>> </form-beans>
>>
>>
>> <action path="/login" type="LoginAction" name="LBBean" scope="request"
>> input="/pages/login.jsp" validate="true">
>> <forward name="succ" path="/pages/succ.jsp"/>
>> </action>
>>
>>
>> while compiling im not getting any errors while running if i did not give
>> any input i am getting bullet not the exact error what i gave. waiting for
>> you people's valuable replys.
>>
>> Regards,
>>
>> Narasimha Raju
>>
>>
>>
>>
>> uni...
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
uni...

Attachment:
user_189900.ezm (zipped)
Hi I went through your code it looks absolutely fine except that
ActionError is obsolute now use ActionMessage instead. That could be a
reason since your error is on validation. Try this and if you couldn't
get the desired result is suggest you do the validation using
ResourceBundle.
Take care
bye
-----Original Message-----
From: Narasimha Raju Naidu [mailto:feel2work@(protected)]
Sent: Saturday, August 09, 2008 12:22 PM
To: user@(protected)
Subject: not displaying Action errors
hi to all,
im sending my code please check where i am doing mistake
form.jsp
---------------
<%@(protected)
style="background-color:#fcc;border: 1px dashed
blue;width:280px;margin:2px;"> <html:form action="/login.do"> <table
cellpadding=2 align=center style="font-family:verdana;font-size:15;">
<tr><td><b>User Name</b></td>
<td><html:text property="userName"/></td></tr> <tr>
<td><b>Password</b></td> <td><html:password property="pwd"/></td></tr>
<tr><td> <html:submit property="submit" value="Connect"/></td><td>
<html:reset property="reset" value="Re-Try"/></td></tr> </table>
</html:form> </div>
------------------------------------------------------------------------
-
formbean
---------------------------
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class LoginBean extends ActionForm {
private String userName;
private String pwd;
public void setUserName(String userName)
{
this.userName=userName;
}
public String getUserName()
{
return userName;
}
public void setPwd(String pwd)
{
this.pwd=pwd;
}
public String getPwd()
{
return pwd;
}
public void reset(ActionMapping mapping,HttpServletRequest request)
{
System.out.println("--reset LoginForm--");
this.userName="";
this.pwd="";
}
public ActionErrors validate(ActionMapping
mapping,HttpServletRequest
request)
{
ActionErrors aes=new ActionErrors();
if(userName==null||userName=="")
{
aes.add("userName",new ActionError("UserName is Required"));
}
if(pwd==null||pwd=="")
{
aes.add("pwd",new ActionError("Password is Required"));
}
return aes;
}
}
--------------------------------------------------------------
action class
----------------------
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class LoginAction extends Action
{
public ActionForward execute(ActionMapping mapping,ActionForm
form,HttpServletRequest request,HttpServletResponse response) throws
Exception
{
LoginBean login= (LoginBean)form;
return mapping.findForward("succ");
}
}
-------------------------------------------------------------------
struts-config.xml code
------------------------------
<form-beans>
<form-bean name="LBBean" type="LoginBean"/> </form-beans>
<action path="/login" type="LoginAction" name="LBBean" scope="request"
input="/pages/login.jsp" validate="true">
<forward name="succ" path="/pages/succ.jsp"/>
</action>
while compiling im not getting any errors while running if i did not
give any input i am getting bullet not the exact error what i gave.
waiting for you people's valuable replys.
Regards,
Narasimha Raju
uni...

Attachment:
user_189899.ezm (zipped)Hi,
I have this requirement to have a dynamic result dispatch. I am
accomplishing this the following way -
<action name="MyAction_*" method="{1}"
class="com.action.MyAction">
<result name="success">${loginPage}</result>
<result name="input">${loginPage}</result>
</action>
The page dynamically shows up, no problems there. However when
there's a validation error on this page, the framework returns a result
"input" and I guess its not able to find the value for ${loginPage} then.
My action class has the field loginPage with a getter method and thats how
it works for "success". What can I do to make the value of loginPage
available for result type "input" ?
Thanks,
Dwipin Chandran
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you

Attachment:
user_189903.ezm (zipped)I have a base domain with a currentPage property on it for this sort of
requirement. My action maintains this currentPage on the model which is
kept populated. Remember to set an initial value on the property in case
there are validation errors from the start.
Scott
On Sun, Aug 10, 2008 at 11:57 PM, Dwipin C <dwipin.c@(protected):
> Hi,
> I have this requirement to have a dynamic result dispatch. I am
> accomplishing this the following way -
> <action name="MyAction_*" method="{1}"
> class="com.action.MyAction">
> <result name="success">${loginPage}</result>
> <result name="input">${loginPage}</result>
> </action>
>
> The page dynamically shows up, no problems there. However when
> there's a validation error on this page, the framework returns a result
> "input" and I guess its not able to find the value for ${loginPage} then.
> My action class has the field loginPage with a getter method and thats how
> it works for "success". What can I do to make the value of loginPage
> available for result type "input" ?
>
> Thanks,
> Dwipin Chandran
>
>
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>

Attachment:
user_189905.ezm (zipped)Thanks for your reply, but is that the scenario when we use a model driven
action classes ?
I am directly using javabeans in my action class and have
actionClass-validation.xml for validations.
What do I do in such scenario?
Dwipin Chandran
____________________________________________
Experience certainty. IT Services
Business Solutions
Outsourcing
____________________________________________
stanlick@(protected)
08/11/2008 04:58 PM
Please respond to
"Struts Users Mailing List" <user@(protected)>
To
"Struts Users Mailing List" <user@(protected)>
cc
Subject
Re: value-stack data lost when using dynamic result.
I have a base domain with a currentPage property on it for this sort of
requirement. My action maintains this currentPage on the model which is
kept populated. Remember to set an initial value on the property in case
there are validation errors from the start.
Scott
On Sun, Aug 10, 2008 at 11:57 PM, Dwipin C <dwipin.c@(protected):
> Hi,
> I have this requirement to have a dynamic result dispatch. I am
> accomplishing this the following way -
> <action name="MyAction_*" method="{1}"
> class="com.action.MyAction">
> <result name="success">${loginPage}</result>
> <result name="input">${loginPage}</result>
> </action>
>
> The page dynamically shows up, no problems there. However when
> there's a validation error on this page, the framework returns a result
> "input" and I guess its not able to find the value for ${loginPage}
then.
> My action class has the field loginPage with a getter method and thats
how
> it works for "success". What can I do to make the value of loginPage
> available for result type "input" ?
>
> Thanks,
> Dwipin Chandran
>
>
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
ForwardSourceID:NT0001B72E
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you

Attachment:
user_189901.ezm (zipped)
I have a check box and a text field in my webpage. If check box is checked
then textfield MAY have valid ip address, its not a mandatory field.
Textfiled value is optional and it shuld be validated for IP address, only
if check box is cheked. Pls. let me know how to do this in struts validator
frame work.
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_189902.ezm (zipped)Hi,
Could you post also your configuration? Did you add [1] to your stack?
[1] http://struts.apache.org/2.0.11.2/docs/static-parameters-interceptor.html
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_189904.ezm (zipped)Griffith, Michael * wrote:
> Jeromy,
>
> Thanks for the replies.
>
>
>>> In cases where I've needed this behaviour I've referenced the JSP
>>> instead of a Tile.
>>>
>
> Do you mean your result redirects to a JSP instead of a struts action?
>
> MG
>
Not Redirect, DISPATCH to a JSP.
http://struts.apache.org/2.0.11.2/docs/dispatcher-result.html
Meaning the JSP output is included in the current output stream (rather
than attempting to returning a 30x result to the browser with a new
location to GET)

Attachment:
user_189906.ezm (zipped)
Hi,
I am having trouble getting the redirect-action syntax to work in struts
2.0.11. Here is the relevant portion of my struts.xml file:
struts.xml:
<package name="default" namespace="/" extends="struts-default">
<action name="results" class="org.project.ResultsAction">
<result name="success">greeting.jsp</result>
</action>
</package>
<package name="administration" namespace="admin">
<action name="search" class="org.project.SearchAction">
<result name="success" type="redirectAction">
results
/
</result>
</action>
</package>
When I start my web server, I receive the following error:
>> There is no result type defined for class 'redirectAction' mapped with
>> name 'success'
I tried changing the type from "redirectAction" to "redirect-action" but it
did not fix the problem.
Does anyone have any suggestions?
Thanks,
David
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_189907.ezm (zipped)> <package name="default" namespace="/" extends="struts-default">
> <action name="results" class="org.project.ResultsAction">
> <result name="success">greeting.jsp</result>
> </action>
> </package>
>
> <package name="administration" namespace="admin">
> <action name="search" class="org.project.SearchAction">
> <result name="success" type="redirectAction">
> results
> /
> </result>
> </action>
> </package>
You forgot to extends package administration from struts-default. Or
you have to define such result for this package.
Regards
--
Lukasz
http://www.lenart.org.pl/

Attachment:
user_189908.ezm (zipped)
Hi all,
I have a web application which needs to pass parameters to a struts app
which resides on another machine. I will not be calling the struts class
using a jsp but from a normal java method. So, is there a way to pass
arguements without using a request/response object?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_189915.ezm (zipped)hi...
i dont think so...
On Mon, Aug 11, 2008 at 8:45 AM, jaki <jackie_james@(protected):
>
> Hi all,
>
> I have a web application which needs to pass parameters to a struts app
> which resides on another machine. I will not be calling the struts class
> using a jsp but from a normal java method. So, is there a way to pass
> arguements without using a request/response object?
> --
> View this message in context: http://www.nabble.com/Remotely-passing-parameters-to-struts-tp18928369p18928369.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_189909.ezm (zipped)Hi,
I'm trying to use the localization method of having property files
that define all the visible text using keys and values (e.g.
"nameAndCv.title = Namn och cv"), but the problem is that NetBeans
(5.5.1) can't seem to find my properties file (I only have one).
I've read in "Struts 2 in Action" that all you should have to do to
make this work is to define some property files and put them in a
place where Struts 2 can find them (Then ResourceBundles should be
automatically created). There should be many options for this place
but I've already tried two and it didn't work.
One try: Have all the message strings in the same package as the
action class, and call the file "package.properties". This is supposed
to work but didn't. (It shouldn't matter that I have several action
classes in the same package, right?)
Another try: I kept the file from above but tried to explicitly define
where Struts 2 should find it, both in struts.properties, like this:
struts.custom.i18n.resources = Web.StrutsActions.package
and in struts.xml, like this:
<constant name="struts.custom.i18n.resources" value =
"Web.StrutsActions.package"/>
The Web package is directly underneath \src\java, but I shouldn't have
to specify that, or should I?
The problem is (just to be clear) that when I try to execute, for
instance this tag:
<s:text name = "nameAndCv.title"/>
..the properties file can't be found so what is printed is literally
"nameAndCv.title"
Does anyone have a solution to this problem? That would be great!
Thanks in advance!
/Ylva

Attachment:
user_189911.ezm (zipped)Does the action being executed extend ActionSupport?
Dave
--- On Mon, 8/11/08, Ylva Degerfeldt <ylva.degerfeldt@(protected):
> From: Ylva Degerfeldt <ylva.degerfeldt@(protected)>
> Subject: [Struts 2] NetBeans can't find my ResourceBundle properties file (localization issue)
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Monday, August 11, 2008, 12:18 PM
> Hi,
>
> I'm trying to use the localization method of having
> property files
> that define all the visible text using keys and values
> (e.g.
> "nameAndCv.title = Namn och cv"), but the problem
> is that NetBeans
> (5.5.1) can't seem to find my properties file (I only
> have one).
>
> I've read in "Struts 2 in Action" that all
> you should have to do to
> make this work is to define some property files and put
> them in a
> place where Struts 2 can find them (Then ResourceBundles
> should be
> automatically created). There should be many options for
> this place
> but I've already tried two and it didn't work.
>
> One try: Have all the message strings in the same package
> as the
> action class, and call the file
> "package.properties". This is supposed
> to work but didn't. (It shouldn't matter that I
> have several action
> classes in the same package, right?)
>
> Another try: I kept the file from above but tried to
> explicitly define
> where Struts 2 should find it, both in struts.properties,
> like this:
>
> struts.custom.i18n.resources = Web.StrutsActions.package
>
> and in struts.xml, like this:
>
> <constant name="struts.custom.i18n.resources"
> value =
> "Web.StrutsActions.package"/>
>
> The Web package is directly underneath \src\java,
> but I shouldn't have
> to specify that, or should I?
>
>
> The problem is (just to be clear) that when I try to
> execute, for
> instance this tag:
> <s:text name = "nameAndCv.title"/>
> ..the properties file can't be found so what is printed
> is literally
> "nameAndCv.title"
>
> Does anyone have a solution to this problem? That would be
> great!
>
> Thanks in advance!
>
> /Ylva
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment:
user_189916.ezm (zipped)Thanks Dave, for answering!
Well the action that should be executed after a submit from the first
page (called "NameAndCv.jsp") extends ActionSupport.
But maybe this problem is due to another thing I'm insecure about...
I run my application just by the Run command of NetBeans, having set
the welcome-file tag to "NameAndCv.jsp" in web.xml. Your question
reminded me that I'm unsure about how to actually start the
application (yes, I'm a complete newbie about Struts 2). Do I have to
start by calling an action (and not by calling a JSP), and how do I do
that? Is there some standard, already defined action that I can call
(since this action only has to return "success" and nothing else)? And
how do I tell NetBeans that it should start by running an action?
I will search for the answers myself too..
/Ylva
On Mon, Aug 11, 2008 at 6:26 PM, Dave Newton <newton.dave@(protected):
> Does the action being executed extend ActionSupport?
>
> Dave
>
>
> --- On Mon, 8/11/08, Ylva Degerfeldt <ylva.degerfeldt@(protected):
>
>> From: Ylva Degerfeldt <ylva.degerfeldt@(protected)>
>> Subject: [Struts 2] NetBeans can't find my ResourceBundle properties file (localization issue)
>> To: "Struts Users Mailing List" <user@(protected)>
>> Date: Monday, August 11, 2008, 12:18 PM
>> Hi,
>>
>> I'm trying to use the localization method of having
>> property files
>> that define all the visible text using keys and values
>> (e.g.
>> "nameAndCv.title = Namn och cv"), but the problem
>> is that NetBeans
>> (5.5.1) can't seem to find my properties file (I only
>> have one).
>>
>> I've read in "Struts 2 in Action" that all
>> you should have to do to
>> make this work is to define some property files and put
>> them in a
>> place where Struts 2 can find them (Then ResourceBundles
>> should be
>> automatically created). There should be many options for
>> this place
>> but I've already tried two and it didn't work.
>>
>> One try: Have all the message strings in the same package
>> as the
>> action class, and call the file
>> "package.properties". This is supposed
>> to work but didn't. (It shouldn't matter that I
>> have several action
>> classes in the same package, right?)
>>
>> Another try: I kept the file from above but tried to
>> explicitly define
>> where Struts 2 should find it, both in struts.properties,
>> like this:
>>
>> struts.custom.i18n.resources = Web.StrutsActions.package
>>
>> and in struts.xml, like this:
>>
>> <constant name="struts.custom.i18n.resources"
>> value =
>> "Web.StrutsActions.package"/>
>>
>> The Web package is directly underneath \src\java,
>> but I shouldn't have
>> to specify that, or should I?
>>
>>
>> The problem is (just to be clear) that when I try to
>> execute, for
>> instance this tag:
>> <s:text name = "nameAndCv.title"/>
>> ..the properties file can't be found so what is printed
>> is literally
>> "nameAndCv.title"
>>
>> Does anyone have a solution to this problem? That would be
>> great!
>>
>> Thanks in advance!
>>
>> /Ylva
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail:
>> user-help@(protected)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_189910.ezm (zipped)Hi,
I implement ModelDriven interface, but I have a list in my model. It
looks like:
public class Role(){
private String id;
private String name ;
private List<Privilege> privilegeList;
}
In my action, I have a set/get method for Role Object, but what about
the list?
I am confused for retrieve data from my "edit page" for privilegeList.
Should I define another list then convent it to privilegeList myself?
Always thanks for solution or some urls for reference.
--
Thanks!
Mobile: +086-15864011231
EMail>alk:saharabear@(protected)
EMail&yahoo:jia_haolin@(protected)
Skype:saharabear
贾昊林(Haulyn Runner Jason)

Attachment:
user_189912.ezm (zipped)--- On Mon, 8/11/08, Haulyn R. Jason <saharabear@(protected):
> I implement ModelDriven interface, but I have a list in my
> model. It
> looks like:
> public class Role(){
> private String id;
> private String name ;
> private List<Privilege> privilegeList;
> }
>
> In my action, I have a set/get method for Role Object, but
> what about the list?
You don't need a separate method for the list; if you're using ModelDriven you'd get it, for example, by using:
<s:iterator value="privilegeList">
...
The model (when not null) is pushed onto the top of the stack. If you weren't using ModelDriven and had a getter for role:
<s:iterator value="role.privilegeList">
...
Dave

Attachment:
user_189913.ezm (zipped)Dave Newton :
> --- On Mon, 8/11/08, Haulyn R. Jason <saharabear@(protected):
>
>> I implement ModelDriven interface, but I have a list in my
>> model. It
>> looks like:
>> public class Role(){
>> private String id;
>> private String name ;
>> private List<Privilege> privilegeList;
>> }
>>
>> In my action, I have a set/get method for Role Object, but
>> what about the list?
>>
>
> You don't need a separate method for the list; if you're using ModelDriven you'd get it, for example, by using:
>
> <s:iterator value="privilegeList">
> ...
>
> The model (when not null) is pushed onto the top of the stack. If you weren't using ModelDriven and had a getter for role:
>
> <s:iterator value="role.privilegeList">
> ...
>
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
Thanks Dave, but
It's a form, I want to use <select multiple="true" > or the similar ui
tags for modifying it. So how can I retrieve data from form?
--
Thanks!
Mobile: +086-15864011231
EMail>alk:saharabear@(protected)
EMail&yahoo:jia_haolin@(protected)
Skype:saharabear
贾昊林(Haulyn Runner Jason)

Attachment:
user_189914.ezm (zipped)Oh. So what are you asking then? How to create a select list? How to use the <s:select...> tag?
Dave
--- On Mon, 8/11/08, Haulyn R. Jason <saharabear@(protected):
> From: Haulyn R. Jason <saharabear@(protected)>
> Subject: Re: How to resolve list property for ModelDriven Action?
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Monday, August 11, 2008, 12:35 PM
> Dave Newton :
> > --- On Mon, 8/11/08, Haulyn R. Jason
> <saharabear@(protected):
> >
> >> I implement ModelDriven interface, but I have a
> list in my
> >> model. It
> >> looks like:
> >> public class Role(){
> >> private String id;
> >> private String name ;
> >> private List<Privilege> privilegeList;
> >> }
> >>
> >> In my action, I have a set/get method for Role
> Object, but
> >> what about the list?
> >>
> >
> > You don't need a separate method for the list; if
> you're using ModelDriven you'd get it, for example,
> by using:
> >
> > <s:iterator value="privilegeList">
> > ...
> >
> > The model (when not null) is pushed onto the top of
> the stack. If you weren't using ModelDriven and had a
> getter for role:
> >
> > <s:iterator
> value="role.privilegeList">
> > ...
> >
> >
> > Dave
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> > For additional commands, e-mail:
> user-help@(protected)
> >
> >
> >
>
> Thanks Dave, but
> It's a form, I want to use <select
> multiple="true" > or the similar ui
> tags for modifying it. So how can I retrieve data from
> form?
>
> --
>
> Thanks!
>
> Mobile: +086-15864011231
> EMail>alk:saharabear@(protected)
> EMail&yahoo:jia_haolin@(protected)
> Skype:saharabear
>
>
> 贾昊林(Haulyn Runner Jason)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment:
user_189917.ezm (zipped)Hello,
This has always been a problem. And a quick and decent way of solving this
is to forget OGNL and write your own implementation. Below listed the code
from AppFuse project which essentially creates a tag to expose all the
constants.
*package com.company.app.webapp.taglib;
import
java.lang.reflect.AccessibleObject;
import
java.lang.reflect.Field;
import
java.util.HashMap;
import
java.util.Map;
import
javax.servlet.jsp.JspException;
import
javax.servlet.jsp.PageContext;
import
javax.servlet.jsp.tagext.TagSupport;
import
org.apache.commons.logging.Log;
import
org.apache.commons.logging.LogFactory;
import com.loandukaan.app.Constants;
/**
* <p>This class is designed to put all the public variables in a class to a
* specified scope - designed for exposing a Constants class to Tag
* Libraries.</p>
*
* <p>It is designed to be used as follows:
* <pre><tag:constants /></pre>
* </p>
*
* <p>Optional values are "className" (fully qualified) and "scope".</p>
*
* <p>
* <a href="BaseAction.java.html"><i>View Source</i></a>
* </p>
*
* @author <a href="mailto:matt@(protected)>
*/
public class ConstantsTag extends TagSupport {
private static final long serialVersionUID = 3258417209566116146L;
private final Log log = LogFactory.getLog(ConstantsTag.class);
/**
* The class to expose the variables from.
*/
private String clazz = Constants.class.getName();
/**
* The scope to be put the variable in.
*/
protected String scope;
/**
* The single variable to expose.
*/
protected String var;
/**
* Main method that does processing and exposes Constants in specified
scope
* @return int
* @throws JspException if processing fails
*/
@Override
public int doStartTag() throws JspException {
// Using reflection, get the available field names in the class
Class c = null;
int toScope = PageContext.PAGE_SCOPE;
if (scope != null) {
toScope = getScope(scope);
}
try {
c = Class.forName(clazz);
} catch (ClassNotFoundException cnf) {
log.error("ClassNotFound - maybe a typo?");
throw new JspException(cnf.getMessage());
}
try {
// if var is null, expose all variables
if (var == null) {
Field[] fields = c.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (Field field : fields) {
pageContext.setAttribute(field.getName(),
field.get(this), toScope);
}
} else {
try {
Object value = c.getField(var).get(this);
pageContext.setAttribute(c.getField(var).getName(),
value, toScope);
} catch (NoSuchFieldException nsf) {
log.error(nsf.getMessage());
throw new JspException(nsf);
}
}
} catch (IllegalAccessException iae) {
log.error("Illegal Access Exception - maybe a classloader
issue?");
throw new JspException(iae);
}
// Continue processing this page
return (SKIP_BODY);
}
public void setClassName(String clazz) {
this.clazz = clazz;
}
public String getClassName() {
return this.clazz;
}
public void setScope(String scope) {
this.scope = scope;
}
public String getScope() {
return (this.scope);
}
public void setVar(String var) {
this.var = var;
}
public String getVar() {
return (this.var);
}
/**
* Release all allocated resources.
*/
public void release() {
super.release();
clazz = null;
scope = Constants.class.getName();
}
/**
* Maps lowercase JSP scope names to their PageContext integer constant
* values.
*/
private static final Map<String, Integer> SCOPES = new HashMap<String,
Integer>();
/**
* Initialize the scope names map and the encode variable
*/
static {
SCOPES.put("page", PageContext.PAGE_SCOPE);
SCOPES.put("request", PageContext.REQUEST_SCOPE);
SCOPES.put("session", PageContext.SESSION_SCOPE);
SCOPES.put("application", PageContext.APPLICATION_SCOPE);
}
/**
* Converts the scope name into its corresponding PageContext constant
value.
* @param scopeName Can be "page", "request", "session", or
"application" in any
* case.
* @return The constant representing the scope (ie.
PageContext.REQUEST_SCOPE).
* @throws JspException if the scopeName is not a valid name.
*/
public int getScope(String scopeName) throws JspException {
Integer scope = (Integer) SCOPES.get(scopeName.toLowerCase());
if (scope == null) {
throw new JspException("Scope '" + scopeName + "' not a valid
option");
}
return scope;
}
}
*
On Thu, May 1, 2008 at 2:34 PM, ravi_eze <ravichandrac@(protected):
>
> hi,
>
> even this doesnt seem to be working.
>
> is it possible to load the constant class to the context and then display
> it
> form there.? or in that case it expects a setters and getters... or some
> way
> of getting this done.. the code is very bad to read 'cos every time i am
> using @com.company....
>
> any help???
>
> cheers,
> ravi
>
>
>
> Wes Wannemacher wrote:
> >
> > Did you try to import your Constants class?
> >
> > <%@(protected)" %>
> >
> > <s:property value="@Constants@(protected)" />
> >
> > As far as say C.staticconstant1, all I can really say is that the @
> > symbol is how you access static vars/methods in OGNL.
> >
> > Another choice might be to use regular ol' EL expressions.
> >
> > -Wes
> >
> > On Tue, 2008-04-29 at 21:45 -0700, ravi_eze wrote:
> >> hi,
> >>
> >>
> >> Does the following work -
> >>
> >> <s:set name="C" value="@com.company.Constants@(protected)" />
> >> <s:property value="#C" />
> >>
> >> Yes it does. But my requirement is more like i would import the class
> >> into
> >> some bean/ variable (C) so that i can say C.staticconstant1 etc... but
> by
> >> the approach mentioned above, i should repeat the @com.company.Constant
> >> string always which reduces the readability. Hope this adds some
> clarity.
> >> Something similar to import.... and then say Constant....
> >>
> >> Also, is com.company.Constants.STATIC_CONSTANTS1 a String?
> >>
> >> Yes its a string. i would be greatful to any further help.
> >>
> >>
> >> cheers,
> >> ravi
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Simplified-usage-of%3A%40com.company.Constants.StaticCOnstants-tp16941171p16993179.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
--
Thanks
Ram