Author Login
Post Reply
user Digest 14 Jul 2008 12:55:51 -0000 Issue 8139
Topics (messages 188828 through 188843):
[S2] s:property - how to use CSS on it?
188828 by: wild_oscar
188840 by: Gabriel Belingueres
188843 by: Dave Newton
Struts 2 Indexed Properties
188829 by: YAQ
188830 by: YAQ
Do we have such alternative?
188831 by: Igor Vlasov
188832 by: Igor Vlasov
188833 by: Igor Vlasov
188834 by: Igor Vlasov
188835 by: Antonio Petrelli
188836 by: Piero Sartini
188837 by: Igor Vlasov
Struts2 configuration problems
188838 by: Jan Froehlich
188841 by: Gabriel Belingueres
Re: [S2] Recipe for Action and View
188839 by: Gabriel Belingueres
Re: struts2 validation
188842 by: Dave Newton
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_188828.ezm (zipped)
Because I want just a simple list of actionErrors, I have an iterator for the
actionErrors such as:
<s:iterator value="actionErrors" >
<s:property/>
</s:iterator>
However, how can I use Css calsses on the property? I want to display the
error in red, but the property element doesn't have any CSS property. What's
the best way of applying a Css syle to it?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188840.ezm (zipped)You could pass a css class to the <s:actionerror> tag.
If the HTML code that produces <s:actionerror> doesn't satisfy you,
you can define your own actionerror.ftl template.
2008/7/14 wild_oscar <miguel@(protected)>:
>
> Because I want just a simple list of actionErrors, I have an iterator for the
> actionErrors such as:
>
> <s:iterator value="actionErrors" >
> <s:property/>
> </s:iterator>
>
> However, how can I use Css calsses on the property? I want to display the
> error in red, but the property element doesn't have any CSS property. What's
> the best way of applying a Css syle to it?
>
> --
> View this message in context: http://www.nabble.com/-S2--s%3Aproperty---how-to-use-CSS-on-it--tp18440945p18440945.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_188843.ezm (zipped)--- On Mon, 7/14/08, wild_oscar <miguel@(protected):
> <s:iterator value="actionErrors" >
> <s:property/>
> </s:iterator>
>
> However, how can I use Css calsses on the property? I want
> to display the error in red, but the property element doesn't
> have any CSS property. What's the best way of applying a Css
> syle to it?
<span class="..."><s:property/></span>
(Or <div...>, or put it in a list and have a class for list elements, or... any other CSS methodology.)
Dave

Attachment:
user_188829.ezm (zipped)
Attachment:
user_188830.ezm (zipped)
Attachment:
user_188831.ezm (zipped)
Hello.
Some days ago I looked in source code of project in ASP.net 2.
Here I saw a good architectural alternative to:
<%@(protected)" %>
body
<%@(protected)" %>
It looks like this:
Page 1:
<%@(protected)" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
content 1+ asp.net controls
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
content 2 + asp.net controls
</asp:Content>
and Template page=Default.master:
<%@(protected)" %>
<head>...</head>
<body>
col1
<div align="left">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
col2
<div align="right">
</div>
</body>
Do we have some similar mechanism is JSP 2 + struts2?
Or Do i must use struts2+....+.... library?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188832.ezm (zipped)
Hello.
Some days ago I looked in source code of project in ASP.net 2.
Here I saw a good architectural alternative to:
<%@(protected)" %>
body
<%@(protected)" %>
It looks like this:
Page 1:
<%@(protected)" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
content 1
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
content 2
</asp:Content>
and Template page:
<%@(protected)" %>
<head>...</head>
<body>
col1
<div align="left">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
col2
<div align="right">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
</body>
Do we have some similar mechanism is JSP 2 + struts2?
Or Do i must use struts2+....+.... library?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188833.ezm (zipped)
Hello.
Some days ago I looked in source code of project in ASP.net 2.
Here I saw a good architectural alternative to:
<%@(protected)" %>
body
<%@(protected)" %>
It looks like this:
Page 1:
<%@(protected)" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
content 1+ asp.net controls
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
content 2 + asp.net controls
</asp:Content>
and Template page=Default.master:
<%@(protected)" %>
<head>...</head>
<body>
col1
<div align="left">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
col2
<div align="right">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
</body>
Do we have some similar mechanism is JSP 2 + struts2?
Or Do i must use struts2+....+.... library?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188834.ezm (zipped)
Hello.
Some days ago I looked in source code of project in ASP.net 2.
Here I saw a good architectural alternative to:
<code>
<%@(protected)" %>
body
<%@(protected)" %>
</code>
It looks like this:
Page 1:
<%@(protected)" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
content 1+ asp.net controls
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
content 2 + asp.net controls
</asp:Content>
and Template page=Default.master:
<%@(protected)" %>
<head>...</head>
<body>
col1
<div align="left">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
col2
<div align="right">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
</body>
Do we have some similar mechanism is JSP 2 + struts2?
Or Do i must use struts2+....+.... library?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188835.ezm (zipped)2008/7/14 Igor Vlasov <vigor78@(protected)>:
> Do we have some similar mechanism is JSP 2 + struts2?
Well, Tiles:
http://tiles.apache.org/
Struts 2 has a Tiles plugin:
http://struts.apache.org/2.x/docs/tiles-plugin.html
Antonio

Attachment:
user_188836.ezm (zipped)Hello,
> Do we have some similar mechanism is JSP 2 + struts2?
>
> Or Do i must use struts2+....+.... library?
JSP can not do that out of the box. But there are very good solutions
available. Have a look at Sitemesh or Tiles2:
-> http://struts.apache.org/2.x/docs/sitemesh-plugin.html
-> http://struts.apache.org/2.x/docs/tiles-plugin.html
Piero

Attachment:
user_188837.ezm (zipped)
Piero Sartini-3 wrote:
>
> Hello,
>
>> Do we have some similar mechanism is JSP 2 + struts2?
>>
>> Or Do i must use struts2+....+.... library?
>
> JSP can not do that out of the box. But there are very good solutions
> available. Have a look at Sitemesh or Tiles2:
>
> -> http://struts.apache.org/2.x/docs/sitemesh-plugin.html
> -> http://struts.apache.org/2.x/docs/tiles-plugin.html
>
> Piero
>
Thank for your answer.
I will try .....
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_188838.ezm (zipped)
Attachment:
user_188841.ezm (zipped)
Attachment:
user_188839.ezm (zipped)Calling an action's input() method is a "shortcut" to render the page
pointed by the "input" result.
If you need to do some processing before displaying the page, just
implement a regular action.
2008/7/14 ravi_eze <ravichandrac@(protected)>:
>
> hi,
>
> i didnt get you. I have a page for which i need to do some preprocessing to
> display it. After the page is done by user it has to be processed. Can you
> please elaborate on the soln given?
>
> ravi
>
>
> Gabriel Belingueres-2 wrote:
>>
>> Sorry it seems I entered the conversation later and didn't saw that email.
>>
>> The problem you want to solve is very common (skipping form validation
>> the first time you call an action) and, as Dave wrote, it is commonly
>> solved by invoking the action with the input() method [1]. This method
>> will do nothing and will return INPUT as the result, thus forwarding
>> the response to the page with the form.
>>
>> [1]
>> http://struts.apache.org/2.1.2/struts2-core/apidocs/com/opensymphony/xwork2/ActionSupport.html#input()
>>
>> 2008/7/12 Andreas Mähler <andreas.maehler@(protected)>:
>>> Hello again,
>>>
>>> Gabriel Belingueres schrieb:
>>>>
>>>> Without knowing what are you actually trying to accomplish with this
>>>> interceptor, I would warn that when an interceptor messes up with the
>>>> parameters, you need to carefully think where in the interceptor chain
>>>> this interceptor will execute.
>>>
>>> I explain what I am trying to do in my first post[1].
>>>
>>> What do you mean by messing up with the parameters? The Interceptor only
>>> checks for the presence of at least one of the specified parameters. It
>>> does
>>> not change anything. Are there any interceptors that actually change the
>>> parameter map? As I said, I am a S2 newbie and haven't heard of many
>>> things,
>>> but I would consider it as bad style.
>>>
>>> Greetings,
>>> ~Andreas
>>>
>>>
>>> [1] http://article.gmane.org/gmane.comp.jakarta.struts.user/158395
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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)
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/-S2--Recipe-for-Action-and-View-tp18381617p18438070.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_188842.ezm (zipped)If you don't have an action property named "fieldname" then not only will validation not work but neither will normal property copying (from form to action).
If, for example, you have a MyForm named "form", and has an appropriate getter/setter, its form element would look like this:
<s:textfield name="form.fieldName"/>
If you're handling validation programmatically (via the Validateable interface and the action's validate() method) you'd then validate against the MyForm instance, for example:
public void validate() {
if (StringUtils.isBlank(this.form.getFieldName())) {
...
}
...
}
It sort of seems like you're implementing a bit of ModelDriven, but manually--not a problem, but seems a bit duplicative.
Dave
--- On Mon, 7/14/08, Nicole Luneburg wrote:
> From: Nicole Luneburg <Nicole.Luneburg@(protected)>
> Subject: RE: struts2 validation
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Monday, July 14, 2008, 3:16 AM
> ps. My post added some "3D" text that isn't
> supposed to be there ...
>
> Thanks Jeromy.
>
> Yes I do have a <s:head> attribute, maybe not
> *exactly* but I have:
> <s:head theme="ajax" />
>
> Apologies for the confusion.
> What I meant in my pevious post was that I had tried a few
> ways to do this validation task.
> In my initial post I had described one of these attempts
> which I think should have worked.
>
> What I am getting regardless of what sort of validation I
> try to implement is this error:
>
>
java.lang.StringIndexOutOfBoundsException: String index out
> of range: -7
>
> You mentioned the getters and setters for the fieldnames
> ... this only works though if the fields are stored in the
> action right?
> coz the fields I have aren't stored in the action, they
> are stored in a Form class.
>
> Ie my action looks something like:
>
> public String execute() {
> MyForm myForm = (MyForm)super.form;
> String myField = myForm.getFieldName();
> }
>
> Markus: Thanks for your reply too, I am trying it right
> now. Just want this to work grrr
>
>
> -----Original Message-----
> From: Jeromy Evans
> [mailto:jeromy.evans@(protected)]
> Sent: Monday, 14 July 2008 4:25 PM
> To: Struts Users Mailing List
> Subject: Re: struts2 validation
>
> Nicole Luneburg wrote:
> >
> >
> >
> > <s:form action=3D"myaction"
> method=3D"post" validate=3D"true">
> >
> The validate attribute here is used to enable client-side
> validation
> only. That will only work if you include the
> <s:head> attribute in the
> page.
>
>
> >
> >
> > My setup is that I have an Action class, which uses a
> Form to set and get f= ield values from the JSP page.
> >
> > In Struts1 I was using the validate(...) method in the
> Form class.
> >
> > It seems none of the Struts2 validation examples on
> the net are working for= me.
> >
> >
>
> You haven't mentioned whether you're using XML
> validation or
> annotation-based validation. If by not working you mean
> "does nothing",
> then your XML file is probably incorrectly named or your
> missing an
> annotation. (You need to enable this separately from
> client-side
> validation)
>
> Whatever the case, the main difference between Struts1 and
> Struts2 here
> is that Struts2 performs validation on the Object, not on
> the form
> parameters.
> That means, to check that "fieldName" is
> non-blank, it will call
> getFieldName() after setFieldName() was called by the
> ParametersInterceptor.
>
> A common problem is to forget the getter, but in that case
> Struts will
> keep returning INPUT (validation failed) instead of
> invoking your action.
>
> Hope that helps,
> Jeromy Evans
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)
>
>
> The contents of this email are confidential and may be
> subject to legal or professional privilege and copyright.
> No representation is made that this email is free of
> viruses or other defects. If you have received this
> communication in error, you may not copy or distribute any
> part of it or otherwise disclose its contents to anyone.
> Please advise the sender of your incorrect receipt of this
> correspondence.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)