Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 17 Mar 2008 09:24:50 -0000 Issue 7930

user-digest-help

2008-03-17


Author LoginPost Reply

user Digest 17 Mar 2008 09:24:50 -0000 Issue 7930

Topics (messages 184313 through 184342):

Re: Exception in Validation
 184313 by: Dave Newton
 184314 by: aum strut

Struts2 - Can I access the form object from fielderror.ftl
 184315 by: Néstor Boscán
 184316 by: Martin Gainty

<s:date>
 184317 by: meeboo

Re: Struts2 URL problem
 184318 by: Tauri Valor
 184320 by: Frans Thamura
 184321 by: Jeromy Evans
 184322 by: Jeromy Evans
 184325 by: Tauri Valor

[OT] XML Preprocessing
 184319 by: Chris Pratt
 184323 by: crackeur.comcast.net
 184324 by: crackeur.comcast.net

[S2] variable of variable in OGNL?
 184326 by: GF

Re: Struts 2 scheduler
 184327 by: GF

Re: should I learn struts 1 first before learning struts 2?
 184328 by: GF

Re: How to initialize business service objects?
 184329 by: GF

Struts2 Annotation based Validation
 184330 by: Tauri Valor
 184339 by: Lukasz Lenart
 184341 by: Tauri Valor

Is type property in <form-bean /> tag must be filled?
 184331 by: Chen Chunwei
 184332 by: Antonio Petrelli
 184333 by: Chen Chunwei
 184334 by: Antonio Petrelli
 184336 by: Chen Chunwei
 184337 by: Antonio Petrelli

Re: <s:property in <s:*> not interpreted
 184335 by: GF

[S2] accessing #application and #request from a Interceptor
 184338 by: GF
 184340 by: GF
 184342 by: Nils-Helge Garli Hegvik

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_184313.ezm (zipped)
--- aum strut <aum.struts@(protected):
> Thanks for the help.i have solved the problem,actually i was not
> configuring for the input result type in the struts.xml file.

Sometimes reading the error message is actually useful!

Not always :/ But sometimes.

Dave


Attachment: user_184314.ezm (zipped)
thats true
:)


On 3/16/08, Dave Newton <newton.dave@(protected):
>
> --- aum strut <aum.struts@(protected):
> > Thanks for the help.i have solved the problem,actually i was not
> > configuring for the input result type in the struts.xml file.
>
> Sometimes reading the error message is actually useful!
>
> Not always :/ But sometimes.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_184315.ezm (zipped)
Is there a way to access the form object from fielderror.ftl. I need to
access the form Id.

Regards,

Néstor Boscán

Attachment: user_184316.ezm (zipped)
you can if you use a combination of Freemarker AND dojo ..
assume you have <form id="formId"..>

<script type="text/javascript">
dojo.require("dojo.event.*");
<#if (parameters.formId?if_exists?size > 0)>
var containingForm = document.getElementById("${formId}");

Anyone else?
Martin-

----- Original Message -----
From: "Néstor Boscán" <nestor.boscan@(protected)>
To: <user@(protected)>
Sent: Sunday, March 16, 2008 2:30 PM
Subject: Struts2 - Can I access the form object from fielderror.ftl


Is there a way to access the form object from fielderror.ftl. I need to
access the form Id.

Regards,

Néstor Boscán


Attachment: user_184317.ezm (zipped)

Hi all

I have set my struts.date.format properties but they seem to have no effect
at all. The set value is
struts.date.format=yyyy-MM-dd but when using the <s:date> tag the format is
for example "Jan 14, 2008 8:00:00 AM". All my other properties take effect
so there's no problem with setting other values via the struts.properties
file.

In this case am trying to print a java.util.Date object with <s:date
name="starts" />. It will print out fine if I for instance use <s:date
name="myDate" format="%{@com.test.StrutsSupport@(protected)}" />

I've also noticed that since you can't nest S2 tags the <s:date> tag becomes
pretty useless because you can't use it within <s:url> actions. Is there a
way around this?

Thanks!
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184318.ezm (zipped)

Thanks Jeromy!

I tried all the four solutions that youve provided..but I still have the
same problem. :)

Im still unable to get the error page for the wrong url with the scrappy
namespace in the addressbar.

If you have thought of any other solution pls let me know. I will try and
let you know..

Thanks again for your time..

Thanks,
Tauri.



Jeromy Evans - Blue Sky Minds wrote:
>
> Hi Tauri,
>
> I don't have time to try it myself right now, but what I meant was
> create an additional default package that contains no actions. I'm not
> sure if it will help though. The idea is that when the default action
> mapper can't match the namespace, it falls back to an empty back.
>
> Like this:
>
> <package name="default" namespace="" extends="struts-default"></package>
> <package name="register" namespace="/register" extends="tiles-default">
> ...normal actions...
> </package>
>
>
> ie. create an empty back in the "" namespace. If that doesn't work also
> try the "/" namespace.
>
> If that doesn't work, there's also some poorly documented options for
> the default ActionMapper.
> Try setting the struts property
> "struts.mapper.alwaysSelectFullNamespace" to true. It may be the one
> you need. Put it in struts.properties or a const in struts.xml.
>
> Hope that helps,
> Jeromy Evans
>
> Tauri Valor wrote:
>> Thanks Jeromy!
>>
>> Ive tried creating a package with empty name space ie :
>>
>> <package name="register" namespace="/" extends="tiles-default">
>>
>> then the following url :
>>
>> http://localhost:8080/MY_WEB/acc.register.RegistrationForm.do
>>
>> without the namespace works fine ..
>>
>> But any other way to keep my namespace in tact in the url because the
>> above
>> may not be acceptable?
>>
>> Thanks,
>> Tauri
>>
>>
>>
>>
>> http://localhost:8080/MY_WEB/register/acc.register.RegistrationForm.do
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Jeromy Evans - Blue Sky Minds wrote:
>>  
>>> No mistake. AFAIK that's a design flaw of the default action mapper.
>>>
>>> See:
>>> http://www.planetstruts.org/struts2-blank/example/somecrap/HelloWorld.action
>>>
>>> If there's no match in a package namespace it falls back to the default
>>> package and matches a little to generously.
>>>
>>> You may be able to avoid it by creating a package with an empty
>>> namespace containing no actions. Not sure about that one...
>>>
>>> Tauri Valor wrote:
>>>  
>>>> Hi
>>>>
>>>> I have the following problem with url in my web application:
>>>>
>>>> I run my app using Struts2 and Tomcat6.
>>>>
>>>> Context name of webapp: MY_WEB
>>>>
>>>> Namespace in my package tag of struts-config.xml:
>>>>
>>>> package name="register" namespace="/register" extends="tiles-default"
>>>>
>>>>
>>>> Mapping of Action class in my struts-config.xml :
>>>>
>>>> action name= acc.register.RegistrationForm
>>>>
>>>>
>>>> A Href link in my jsp page:
>>>>
>>>>
>>>> a href="register/acc.register.RegistrationForm.do"
>>>>
>>>>
>>>>
>>>> Now, the following url works fine when I launch my app:
>>>>
>>>> http://localhost:8080/MY_WEB/register/acc.register.RegistrationForm.do
>>>>
>>>>
>>>> But the problem is the url when added something between my
>>>> packagename(register)and my uri (acc.register.RegistrationForm.do) like
>>>> following:
>>>>
>>>> http://localhost:8080/MY_WEB/register/somecrap/acc.register.RegistrationForm.do
>>>>
>>>> it still works fine instead of displaying the error page. I need to get
>>>> an
>>>> error page if I give wrong url like the above.
>>>>
>>>> What is my mistake ?
>>>>
>>>> Pls advise.
>>>>  
>>>>    
>>> ---------------------------------------------------------------------
>>> 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)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184320.ezm (zipped)
hi all

if i want to create the url something like this, and withour .do or .action,
like REST

is smartURL the answer or we must use RESTplugins, which we know we cannot
mixed REST with current struts2 setting

i want the url like this http://localhost:8080/cimande/profile/fthamura

which fthamura is my account

F

Attachment: user_184321.ezm (zipped)
At this point I'd either
a) accept it, because it's unlikely to cause really problems or ever be
noticed by a real user. It's just scrappy
b) create a custom ActionMapper derived from the default one that
removes that feature
c) Use a plugin that does b for you

I don't use the DefaultActionMapper myself any more.

Option b is not as difficult as it may first seem. The default code is
quite straight-forward [1], [2]

As you're using Struts 2.0 you can't use the new Convention plugin. As
you're using struts.xml rather than CodeBehind I don't recommend
switching to the SmartURLs plugin as you'll have to re-check all the
configuration (unless it's a small application) [3]. The
Struts2UrlPlugin [4] will fix the problem immediately by dropping the
jar into the classpath but it's not released yet, undocumented and is
probably overkill.

So I recommend a) or b).

[1] http://struts.apache.org/2.x/docs/actionmapper.html
[2]
http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java?view=markup
[3] http://cwiki.apache.org/S2PLUGINS/smarturls-plugin.html
[4] http://code.google.com/p/struts2urlplugin/


Attachment: user_184322.ezm (zipped)
Frans Thamura wrote:
> hi all
>
> if i want to create the url something like this, and withour .do or .action,
> like REST
>
>  

URLs without the extension is possible by setting the property:
struts.action.extension=action,,

Where the double comma indicates "no extension".

> is smartURL the answer or we must use RESTplugins, which we know we cannot
> mixed REST with current struts2 setting
>
> i want the url like this http://localhost:8080/cimande/profile/fthamura
>
> which fthamura is my account
>
>  

Passing parameters through the path is supported by the
NamedVariablePatternMatcher, a largely undocumented feature of XWork2.1
(search the user mail archives for discussion), or by the
Struts2UrlPlugin which is not released and also undocumented
(http://code.google.com/p/struts2urlplugin/). I created the latter
specifically for this use-case and because it's impossible for the
NamedVariablePatternMatcher to solve all the issues in isolation. It
won't be released or announced until I have time to write a user guide
though.



Attachment: user_184325.ezm (zipped)

Thanks Jeromy

I will try your approach and let you know.




Jeromy Evans - Blue Sky Minds wrote:
>
> At this point I'd either
> a) accept it, because it's unlikely to cause really problems or ever be
> noticed by a real user. It's just scrappy
> b) create a custom ActionMapper derived from the default one that
> removes that feature
> c) Use a plugin that does b for you
>
> I don't use the DefaultActionMapper myself any more.
>
> Option b is not as difficult as it may first seem. The default code is
> quite straight-forward [1], [2]
>
> As you're using Struts 2.0 you can't use the new Convention plugin. As
> you're using struts.xml rather than CodeBehind I don't recommend
> switching to the SmartURLs plugin as you'll have to re-check all the
> configuration (unless it's a small application) [3]. The
> Struts2UrlPlugin [4] will fix the problem immediately by dropping the
> jar into the classpath but it's not released yet, undocumented and is
> probably overkill.
>
> So I recommend a) or b).
>
> [1] http://struts.apache.org/2.x/docs/actionmapper.html
> [2]
> http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java?view=markup
> [3] http://cwiki.apache.org/S2PLUGINS/smarturls-plugin.html
> [4] http://code.google.com/p/struts2urlplugin/
>
>
> ---------------------------------------------------------------------
> 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_184319.ezm (zipped)
Sorry I missed the normal Friday free-for-all with my Off Topic
question, but I'm hoping someone around here has already solved the
problem I'm staring at.

I am trying to pre-process a stream of HTML/XML. My first thought was
to just use SAX (with TagSoup for the HTML) and watch for the tokens I
needed to modify while passing the rest through, but all the XML tools
I can find are geared towards processing XML, not pre-processing it.
So they help you out by automatically converting entities to their
values and other things that completely get in the way of
pre-processing. Has anybody else had to solve this problem? If so,
any pointers would be GREATLY appreciated. Thanks.
(*Chris*)

Attachment: user_184323.ezm (zipped)
VTD-XML doesn't convert entities automatically... it perserves those
things by nature of non-extractive parsing (http://vtd-xml.sf.net)


-------------- Original message --------------
From: "Chris Pratt" <thechrispratt@(protected)>

> Sorry I missed the normal Friday free-for-all with my Off Topic
> question, but I'm hoping someone around here has already solved the
> problem I'm staring at.
>
> I am trying to pre-process a stream of HTML/XML. My first thought was
> to just use SAX (with TagSoup for the HTML) and watch for the tokens I
> needed to modify while passing the rest through, but all the XML tools
> I can find are geared towards processing XML, not pre-processing it.
> So they help you out by automatically converting entities to their
> values and other things that completely get in the way of
> pre-processing. Has anybody else had to solve this problem? If so,
> any pointers would be GREATLY appreciated. Thanks.
> (*Chris*)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment: user_184324.ezm (zipped)
VTD-XML doesn't convert entities automatically... it perserves those
things by nature of non-extractive parsing (http://vtd-xml.sf.net)


-------------- Original message --------------
From: "Chris Pratt" <thechrispratt@(protected)>

> Sorry I missed the normal Friday free-for-all with my Off Topic
> question, but I'm hoping someone around here has already solved the
> problem I'm staring at.
>
> I am trying to pre-process a stream of HTML/XML. My first thought was
> to just use SAX (with TagSoup for the HTML) and watch for the tokens I
> needed to modify while passing the rest through, but all the XML tools
> I can find are geared towards processing XML, not pre-processing it.
> So they help you out by automatically converting entities to their
> values and other things that completely get in the way of
> pre-processing. Has anybody else had to solve this problem? If so,
> any pointers would be GREATLY appreciated. Thanks.
> (*Chris*)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment: user_184326.ezm (zipped)
I have something like
%{#application.one.two.three}

is it possible to do something like:

%{#application.%{stringVariable}.two.three}

Thanks.

Attachment: user_184327.ezm (zipped)
Yes, I usually use Quartz inside Spring.
If I remember correctly there is a chapter about Scheduling in the big
Spring manual

On Fri, Mar 14, 2008 at 3:47 AM, alex xander <xanlex@(protected):

> thx all,
> i solve my problem with quartz, i used it with spring
> thx so much
>

Attachment: user_184328.ezm (zipped)
I learned Struts2 without knowing anything about Struts1.
But I'm a little curious to take a look to Struts1 too. But just for
personal knowledge.

On Fri, Mar 14, 2008 at 7:51 PM, akoo <ogenium@(protected):

>
> Hi, forgive me if this has been asked before. I am just starting on
> struts
> and wondering if I should first learn Struts 1 or just jump straight to
> struts 2? Will spending time on struts 1 help me with struts 2 or will it
> get in the way since everything in struts 2 is different from Struts 1? I
> have all of the requisites for starting struts 1.
> Thanks.
>

Attachment: user_184329.ezm (zipped)
I suggest you to read this simple but useful tutorial to have an idea about
how much is simple to use Struts2+Spring+Hibernate together.

http://struts.apache.org/2.x/docs/struts-2-spring-2-jpa-ajax.html

On Thu, Mar 13, 2008 at 10:32 PM, Frank Fischer <
frank.fischer@(protected):

>
> Now i don't understand (1) where to create/initialize these business logic
> classes and (2) how to get access to them from the action classes.
>

Attachment: user_184330.ezm (zipped)

Using Annotation based Validation, I want to try the following:

The Validation Error message can be retrieved in our jsp using :

<s:actionerror />
<s:fielderror />

Do I have any alternative method of using the above tags ?
For eg. can I retrieve the error using session.getAttribute(actionerror) ?

Are actionerror and fielderror stored in a request or a session object ?

Please help me understand this .

Thanks,
Tauri.

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184339.ezm (zipped)
Hi,

Error messages are stored in request, you have to subclass
ActionSupport and add some mechanism to store messages in session.


Regards
--
Lukasz

http://www.linkedin.com/in/lukaszlenart

Attachment: user_184341.ezm (zipped)

Thanks Lukasz!

I tried request.getAttribute("actionerror") and
request.getAttribute("fielderror") in my jsp but it did not work.

Am I doing it the wrong way ?









Lukasz Lenart wrote:
>
> Hi,
>
> Error messages are stored in request, you have to subclass
> ActionSupport and add some mechanism to store messages in session.
>
>
> Regards
> --
> Lukasz
>
> http://www.linkedin.com/in/lukaszlenart
>
> ---------------------------------------------------------------------
> 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_184331.ezm (zipped)
Hi all,

I'm new to Struts. And I want to ask if the type property in <form-bean /> tag must be filled? I mean if it's null, will the form-bean work?

Thanks.

Talos

Attachment: user_184332.ezm (zipped)
2008/3/17, Chen Chunwei <out-chenchunwei@(protected)>:
> I'm new to Struts. And I want to ask if the type property in <form-bean /> tag must be filled? I mean if it's null, will the form-bean work?

If you are using Struts 1.2.x, the "type" attribute is required:
http://struts.apache.org/dtds/struts-config_1_2.dtd

If you are using Struts 1.3.x, you must specify the "type" or the
"extends" attribute.

HTH
Antonio

Attachment: user_184333.ezm (zipped)
Thanks Antonio

But I'm using Struts 1.1, then is it still required?

Talos

----- Original Message -----
From: "Antonio Petrelli" <antonio.petrelli@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Monday, March 17, 2008 4:07 PM
Subject: Re: Is type property in <form-bean /> tag must be filled?


> 2008/3/17, Chen Chunwei <out-chenchunwei@(protected)>:
>> I'm new to Struts. And I want to ask if the type property in <form-bean /> tag must be filled? I mean if it's null, will the form-bean work?
>
> If you are using Struts 1.2.x, the "type" attribute is required:
> http://struts.apache.org/dtds/struts-config_1_2.dtd
>
> If you are using Struts 1.3.x, you must specify the "type" or the
> "extends" attribute.
>
> HTH
> Antonio
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>

Attachment: user_184334.ezm (zipped)
2008/3/17, Chen Chunwei <out-chenchunwei@(protected)>:
>
> But I'm using Struts 1.1, then is it still required?



Yes. See:
http://struts.apache.org/dtds/struts-config_1_1.dtd

And learn DTD :-)

Antonio

Attachment: user_184336.ezm (zipped)
Thanks Antonio.

I know little about DTD, but in my company, we are not allowed to access Internet. So I cann't see these dtds. :-(

Talos

----- Original Message -----
From: "Antonio Petrelli" <antonio.petrelli@(protected)>
To: "Struts Users Mailing List" <user@(protected)>
Sent: Monday, March 17, 2008 4:32 PM
Subject: Re: Is type property in <form-bean /> tag must be filled?


> 2008/3/17, Chen Chunwei <out-chenchunwei@(protected)>:
>>
>> But I'm using Struts 1.1, then is it still required?
>
>
>
> Yes. See:
> http://struts.apache.org/dtds/struts-config_1_1.dtd
>
> And learn DTD :-)
>
> Antonio
>

Attachment: user_184337.ezm (zipped)
2008/3/17, Chen Chunwei <out-chenchunwei@(protected)>:
>
> Thanks Antonio.
>
> I know little about DTD, but in my company, we are not allowed to access
> Internet. So I cann't see these dtds. :-(


WTF?
Now I know why you are still using Struts 1.1 :-D
You're forgiven :-D

Antonio

Attachment: user_184335.ezm (zipped)
>
>
> ...unless you use the XML syntax available from JSP 2.0 and later ;-)
>
>
And in this case, how can you resolve the <div id="<s:property... ?

Attachment: user_184338.ezm (zipped)
I have some data stored in #application.mymap
Inside and interceptor I want to put some of this data in
#request.anothermap

How can I access them?
About the #request, is it right to do this?

    final ActionContext context = invocation.getInvocationContext();
    request = (HttpServletRequest) context.get(HTTP_REQUEST);
    request.setAttribute("anothermap", anotherMap);

Attachment: user_184340.ezm (zipped)
On Mon, Mar 17, 2008 at 10:06 AM, GF <ganfab@(protected):

> I have some data stored in #application.mymap
> Inside and interceptor I want to put some of this data in
> #request.anothermap
>
> How can I access them?
> About the #request, is it right to do this?
>
>      final ActionContext context = invocation.getInvocationContext();
>      request = (HttpServletRequest) context.get(HTTP_REQUEST);
>      request.setAttribute("anothermap", anotherMap);
>
>
> Ok, I have found this is right.
I'm still searching how to access #application map from the Interceptor..

Attachment: user_184342.ezm (zipped)
Have you tried context.getApplication()?

BTW: The source code for the ServletConfigInterceptor shows how to
access most of the context objects from an interceptor.

Nils-H

On Mon, Mar 17, 2008 at 10:16 AM, GF <ganfab@(protected):
>
> On Mon, Mar 17, 2008 at 10:06 AM, GF <ganfab@(protected):
>
> > I have some data stored in #application.mymap
> > Inside and interceptor I want to put some of this data in
> > #request.anothermap
> >
> > How can I access them?
> > About the #request, is it right to do this?
> >
> >      final ActionContext context = invocation.getInvocationContext();
> >      request = (HttpServletRequest) context.get(HTTP_REQUEST);
> >      request.setAttribute("anothermap", anotherMap);
> >
> >
> > Ok, I have found this is right.
> I'm still searching how to access #application map from the Interceptor..
>
©2008 gg3721.com - Jax Systems, LLC, U.S.A.