Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 19 Jan 2010 23:59:39 -0000 Issue 8983

user-digest-help

2010-01-19


Author LoginPost Reply

user Digest 19 Jan 2010 23:59:39 -0000 Issue 8983

Topics (messages 204686 through 204701):

adding UploadProgressListener to a struts2 upload
 204686 by: Stephen Ince
 204687 by: Jorge Sousa
 204688 by: Stephen Ince

Migration from Struts1 to Struts2.1.6 - Plugin in Application Starup
 204689 by: Raghuveer

Problem with <s:property /> tag
 204690 by: VSGoud
 204691 by: Dave Newton
 204692 by: Nils-Helge Garli Hegvik
 204693 by: VSGoud

TextProviderHelper throws NullPointerException
 204694 by: psycotrompus

Struts2.1.8.1, s:push does not return s:property value
 204695 by: Emi Lu
 204696 by: Musachy Barroso
 204697 by: Emi Lu
 204698 by: Emi Lu

Struts 2 JSON plugin
 204699 by: Artashes Hovasapyan

s:iterator did not return result?
 204700 by: Emi Lu
 204701 by: Emi Lu

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_204686.ezm (zipped)
Hi,
 I would like to add a UploadProgressListener to a struts file
upload. I tried setting the struts.multipart.parser property but I
can't seem to override the setting. I also tried downloading the
"Advance File upload plugin" but no download link. So I basically have
3 questions.

1) Is it possible to override struts.multipart.parser for a struts2
file upload? I have done the following:

<struts>
  <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
name="jakartax"
class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequestx"
scope="default"/>
  <constant name="struts.multipart.parser" value="jakartax" />

  <package name="loadgeneral" extends="struts-default">
    <interceptors>
       <interceptor name="login"
class="com.loadgeneral.struts2.LoginInterceptor" />
       <interceptor-stack name="defaultLoginStack">
          <interceptor-ref name="defaultStack" />
          <interceptor-ref name="login" />
          <interceptor-ref name="fileUpload">
            <param name="maximumSize">10240</param>
          </interceptor-ref>
       </interceptor-stack>
    </interceptors>

2) Where can I download the "Advance File upload plugin" ?
http://cwiki.apache.org/S2PLUGINS/advanced-fileupload-plugin.html page
does not have a download link?

3) How to add UploadProgressListener to a struts2 file upload?
My assumption is that you have to use a plugin that overrides
struts.multipart.parser setting. I did see a link that this was fixed
and that functionality to add a UploadProgressListener was added to
struts 2.1.18

Any help would be greatly appreciated?
Steve


Attachment: user_204687.ezm (zipped)
Hi,

Have you tried the Execute and Wait interceptor?
http://struts.apache.org/2.0.14/docs/execute-and-wait-interceptor.html
I propose you this solution, assuming that you want to accomplish the
"progress meter effect".

Cheers,
Jorge


On 17-01-2010 18:57, Stephen Ince wrote:
> Hi,
>   I would like to add a UploadProgressListener to a struts file
> upload. I tried setting the struts.multipart.parser property but I
> can't seem to override the setting. I also tried downloading the
> "Advance File upload plugin" but no download link. So I basically have
> 3 questions.
>
> 1) Is it possible to override struts.multipart.parser for a struts2
> file upload? I have done the following:
>
> <struts>
>    <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
> name="jakartax"
> class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequestx"
> scope="default"/>
>    <constant name="struts.multipart.parser" value="jakartax" />
>
>    <package name="loadgeneral" extends="struts-default">
>       <interceptors>
>         <interceptor name="login"
> class="com.loadgeneral.struts2.LoginInterceptor" />
>         <interceptor-stack name="defaultLoginStack">
>            <interceptor-ref name="defaultStack" />
>            <interceptor-ref name="login" />
>            <interceptor-ref name="fileUpload">
>               <param name="maximumSize">10240</param>
>            </interceptor-ref>
>         </interceptor-stack>
>       </interceptors>
>
> 2) Where can I download the "Advance File upload plugin" ?
> http://cwiki.apache.org/S2PLUGINS/advanced-fileupload-plugin.html page
> does not have a download link?
>
> 3) How to add UploadProgressListener to a struts2 file upload?
>   My assumption is that you have to use a plugin that overrides
> struts.multipart.parser setting. I did see a link that this was fixed
> and that functionality to add a UploadProgressListener was added to
> struts 2.1.18
>
> Any help would be greatly appreciated?
> Steve
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>  



Attachment: user_204688.ezm (zipped)
Jorge,
Thx for the suggestion. I will definitely use this for other pages.
I am basically doing file uploads and want to use the dojo status bar,
so that I can maintain the same look and feel in my application.

Steve

On Sun, Jan 17, 2010 at 2:37 PM, Jorge Sousa
<jorge.sousa@(protected):
> Hi,
>
> Have you tried the Execute and Wait interceptor?
> http://struts.apache.org/2.0.14/docs/execute-and-wait-interceptor.html
> I propose you this solution, assuming that you want to accomplish the
> "progress meter effect".
>
> Cheers,
> Jorge
>
>
> On 17-01-2010 18:57, Stephen Ince wrote:
>>
>> Hi,
>>    I would like to add a UploadProgressListener to a struts file
>> upload. I tried setting the struts.multipart.parser property but I
>> can't seem to override the setting. I also tried downloading the
>> "Advance File upload plugin" but no download link. So I basically have
>> 3 questions.
>>
>> 1) Is it possible to override struts.multipart.parser for a struts2
>> file upload? I have done the following:
>>
>> <struts>
>>     <bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest"
>> name="jakartax"
>> class="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequestx"
>> scope="default"/>
>>     <constant name="struts.multipart.parser" value="jakartax" />
>>
>>     <package name="loadgeneral" extends="struts-default">
>>         <interceptors>
>>             <interceptor name="login"
>> class="com.loadgeneral.struts2.LoginInterceptor" />
>>             <interceptor-stack name="defaultLoginStack">
>>                 <interceptor-ref name="defaultStack" />
>>                 <interceptor-ref name="login" />
>>                 <interceptor-ref name="fileUpload">
>>                     <param name="maximumSize">10240</param>
>>                 </interceptor-ref>
>>             </interceptor-stack>
>>         </interceptors>
>>
>> 2) Where can I download the "Advance File upload plugin" ?
>> http://cwiki.apache.org/S2PLUGINS/advanced-fileupload-plugin.html page
>> does not have a download link?
>>
>> 3) How to add UploadProgressListener to a struts2 file upload?
>>   My assumption is that you have to use a plugin that overrides
>> struts.multipart.parser setting. I did see a link that this was fixed
>> and that functionality to add a UploadProgressListener was added to
>> struts 2.1.18
>>
>> Any help would be greatly appreciated?
>> Steve
>>
>> ---------------------------------------------------------------------
>> 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_204689.ezm (zipped)
I need to migrate an application from struts1 to struts2.1.6.

I had a plug-in configurations existing in Strut1 application related to SAP
connection pool creation(CCreateSAPConnectionPlugin.java as shown below
implementing org.apache.struts.action.PlugIn).This will create a SAP
connection pool with connections.



How this can be implemented through struts2.1.6.

Is there a facility to implement custom plugin and to make it called dusting
application startup.







<!-- ========== Declare Log Plugin =====================================-->

<plug-in className="com.utc.test.loadonstatup..util.LogPlugin">

       <set-property property="devlLogConfigFile"
value="/log4j.properties"/>

</plug-in>

<!-- ========== Declare SAP Plugin =====================================-->

<plug-in
className="com.utc.test.loadonstatup..util.CCreateSAPConnectionPlugin">

       <set-property property="devlSapConfigFile"
value="/config/config.properties"/>

</plug-in>



Regards,
Raghu


Attachment: user_204690.ezm (zipped)

Hi Friends,

Facing problem with <s:property /> tag.
when i fetch the data from one of the columns in a given table, I am able to
view the certain parts of the fetched data in new lines in <s:textarea />
tag. But, when i tried to view the same fetched data through <s:property />
tag, the text isn't appearing in new lines.

On viewing the fetched data in sql file the text is appended with "
\r\n\r\n" in it. So i guess these ( \r\n\r\n) are not playing any role with
<s:property /> tag where as it is working normally or as desired with
<s:textarea /> tag

Could u pls help me out from this issue ?

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



Attachment: user_204691.ezm (zipped)
VSGoud wrote:
> Facing problem with <s:property /> tag.
> when i fetch the data from one of the columns in a given table, I am able to
> view the certain parts of the fetched data in new lines in <s:textarea />
> tag. But, when i tried to view the same fetched data through <s:property />
> tag, the text isn't appearing in new lines.
>
> On viewing the fetched data in sql file the text is appended with "
> \r\n\r\n" in it. So i guess these ( \r\n\r\n) are not playing any role with
> <s:property /> tag where as it is working normally or as desired with
> <s:textarea /> tag

Convert it into HTML.

Dave



Attachment: user_204692.ezm (zipped)
Putting it inside <pre> tag might also work.

Nils-H

On Mon, Jan 18, 2010 at 2:12 PM, Dave Newton <newton.dave@(protected):
> VSGoud wrote:
>>
>> Facing problem with <s:property /> tag.
>> when i fetch the data from one of the columns in a given table, I am able
>> to
>> view the certain parts of the fetched data in new lines in <s:textarea />
>> tag. But, when i tried to view the same fetched data through <s:property
>> />
>> tag, the text isn't appearing in new lines.
>>
>> On viewing the fetched data in sql file the text is appended with "
>> \r\n\r\n" in it. So i guess these ( \r\n\r\n) are not playing any role
>> with
>> <s:property /> tag where as it is working normally or as desired with
>> <s:textarea /> tag
>
> Convert it into HTML.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_204693.ezm (zipped)

Hi,
 Using <pre> tag it is working.
 thanks.

Srikanth


Nils-Helge Garli wrote:
>
> Putting it inside <pre> tag might also work.
>
> Nils-H
>
> On Mon, Jan 18, 2010 at 2:12 PM, Dave Newton <newton.dave@(protected)>
> wrote:
>> VSGoud wrote:
>>>
>>> Facing problem with <s:property /> tag.
>>> when i fetch the data from one of the columns in a given table, I am
>>> able
>>> to
>>> view the certain parts of the fetched data in new lines in <s:textarea
>>> />
>>> tag. But, when i tried to view the same fetched data through <s:property
>>> />
>>> tag, the text isn't appearing in new lines.
>>>
>>> On viewing the fetched data in sql file the text is appended with "
>>> \r\n\r\n" in it. So i guess these ( \r\n\r\n) are not playing any role
>>> with
>>> <s:property /> tag where as it is working normally or as desired with
>>> <s:textarea /> tag
>>
>> Convert it into HTML.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> 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_204694.ezm (zipped)

Here's my stack trace:

Caused by: java.lang.NullPointerException
 at
org.apache.struts2.util.TextProviderHelper.getText (TextProviderHelper.java:101)
 at org.apache.struts2.components.Text.end (Text.java:161)
 at
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag (ComponentTagSupport.java:42)
 at
org.apache.jsp.WEB_002dINF.pages.home_jsp._jspx_meth_s_005ftext_005f0(home_jsp.java:145)
 at org.apache.jsp.WEB_002dINF.pages.home_jsp._jspService(home_jsp.java:82)
 at org.apache.jasper.runtime.HttpJspBase.service (HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service (HttpServlet.java:820)
 at
org.apache.jasper.servlet.JspServletWrapper.service (JspServletWrapper.java:374)
 ... 118 more

The freemarker tag used:

<s:text name="home.desc"/>

The key is found in the custom default resource bundle:

struts.custom.i18n.resources=Application

Please help me on this.

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



Attachment: user_204695.ezm (zipped)
Good afternoon,

Struts2.1.8.1, the following push example
http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html

Title returns, but "s:push" never returns attributes such as "name"
under artist. Does someone tries and knows the reason?


  <b>Album Title:   </b> <s:property value="title" /> <BR/>
  <s:push value="artist" />
  <B>Artist Name:   </B> <s:property value="name"   /> <BR/>

Thanks a lot!
--
Lu Ying




Attachment: user_204696.ezm (zipped)
The pushed object will be on the stack while the tag is evaluated (in
the tag body), and it will be popped after the end of the tag, so

<s:push value="%{'not now john'}">
  <s:property value="%{top}"/> <--- will print 'not now john'
<s:push>

<s:property value="%{top}"/> <--will print whatever was in the top of
the stack, before the "push" tag was invoked

musachy

On Mon, Jan 18, 2010 at 12:55 PM, Emi Lu <emilu@(protected):
> Good afternoon,
>
> Struts2.1.8.1, the following push example
> http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html
>
> Title returns, but "s:push" never returns attributes such as "name" under
> artist. Does someone tries and knows the reason?
>
>
>   <b>Album Title:     </b> <s:property value="title"  /> <BR/>
>   <s:push value="artist" />
>   <B>Artist Name:     </B> <s:property value="name"    /> <BR/>
>
> Thanks a lot!
> --
> Lu Ying
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


Attachment: user_204697.ezm (zipped)
> The pushed object will be on the stack while the tag is evaluated (in
> the tag body), and it will be popped after the end of the tag, so
>
> <s:push value="%{'not now john'}">
>   <s:property value="%{top}"/> <--- will print 'not now john'
> <s:push>
>
> <s:property value="%{top}"/> <--will print whatever was in the top of
> the stack, before the "push" tag was invoked

Thank you Musachy.

If I am right, the example in the tutorial does not work.

Working codes:
================
<s:push value="artist">
  Artist Name:<s:property value="name"   /> <BR/>
  Artist Bio: <s:property value="bio"   /> <BR/>
</s:push>



*Not* working codes shown in the link:
>>http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html
====================================================
<s:push value="artist" />
Artist Name:<s:property value="name"   /> <BR/>
Artist Bio: <s:property value="bio"   /> <BR/>


Push an object, and then retrieve the object's attribute outside s:push
tag will not work (have to use artist.name).

--
Lu Ying





>
>> Struts2.1.8.1, the following push example
>> http://www.vaannila.com/struts-2/struts-2-example/struts-2-push-tag-example1.html
>>
>> Title returns, but "s:push" never returns attributes such as "name" under
>> artist. Does someone tries and knows the reason?
>>  <b>Album Title:   </b> <s:property value="title" /> <BR/>
>>  <s:push value="artist" />
>>  <B>Artist Name:   </B> <s:property value="name"   /> <BR/>


Attachment: user_204698.ezm (zipped)
Musachy Barroso wrote:
> The pushed object will be on the stack while the tag is evaluated (in
> the tag body), and it will be popped after the end of the tag, so
>
> <s:push value="%{'not now john'}">
>   <s:property value="%{top}"/> <--- will print 'not now john'
> <s:push>
>
> <s:property value="%{top}"/> <--will print whatever was in the top of
> the stack, before the "push" tag was invoked
>
Sorry the example does shown within the push tag.
My mistake.

--
Lu Ying


Attachment: user_204699.ezm (zipped)
Hi,

I've just started using JSON plugin and noticed strange behaviour. It looks
like JSON annotation fields are completely ignored by the plugin. My action
looks like this:

public class TestAction extends ActionSupport {
  private Date date;

  @JSON(format = "yyyy-MM-dd HH:mm:ss Z")
  public Date getDate() {
    return date;
  }

  public void setDate(Date date) {
    this.date = date;
  }

  public String test() {
    date = new Date();
    return "success";
  }
}

Struts configuration looks like this:

  <package name="test" extends="json-default">
    <action name="Test" class="org.test.TestAction" method="test">
       <result name="success" type="json">
          <param name="root">date</param>
       </result>
    </action>
  </package>

Result date is serialized according to default "yyyy-MM-dd'T'HH:mm:ss"
format.

Further research showed that JSONResult.execute() method calls
JSONUtil.serialize() (line 198), which in turn calls
JSONWriter.write()(line 112). This
JSONWriter.write() method calls JSONWriter.value() method (line 99), which
has 2 parameters - actual object to be serialized and the method, which
supposed to be the getter method of the serializable object (at least that's
how it looks to me). Apparently JSONWriter.write() calls
JSONWriter.value()only passing the object,
null is passed instead of the method. That's where I got confused the most -
if the method is not propagated, how the plugin will pick the annotation
fields?
Any idea anyone? Maybe developers can help me with this?

--
Regards,
Artashes Hovasapyan

Attachment: user_204700.ezm (zipped)
Good morning,

I have a problem of running the example:
http://www.vaannila.com/struts-2/struts-2-example/struts-2-iterator-tag-example1.html

JSP is:
<table>
<TR class="even">
  <TD> <B>Title </B></TD>     <TD> <B>Genre </B></TD>
</TR>

 <s:iterator value="songs" status="songStatus">
  <tr class="<s:if test="#songStatus.odd ==
true">odd</s:if><s:else>even</s:else>">
   <td><s:property value="title" /></td>
   <td><s:property value="genre" /></td>
  </tr>
 </s:iterator>
</table>


View sources, only see:
<table>
  <TR class="even">
    <TD> <B>Title </B></TD>
    <TD> <B>Genre </B></TD>
  </TR>
</table>


Codes under iterator did not return? Could someone help?

Thanks a lot!
--
Lu Ying


Attachment: user_204701.ezm (zipped)

> I have a problem of running the example:
> http://www.vaannila.com/struts-2/struts-2-example/struts-2-iterator-tag-example1.html
>
>
> JSP is:
> <table>
> <TR class="even">
>   <TD> <B>Title </B></TD>     <TD> <B>Genre </B></TD>
> </TR>
>
>  <s:iterator value="songs" status="songStatus">
>   <tr class="<s:if test="#songStatus.odd ==
> true">odd</s:if><s:else>even</s:else>">
>    <td><s:property value="title" /></td>
>    <td><s:property value="genre" /></td>
>   </tr>
>  </s:iterator>
> </table>
>
>
> View sources, only see:
> <table>
>   <TR class="even">
>     <TD> <B>Title </B></TD>
>     <TD> <B>Genre </B></TD>
>   </TR>
> </table>
>
>
> Codes under iterator did not return? Could someone help?
All right, find the reason:

http://www.vaannila.com/struts-2/struts-2-example/struts-2-control-tags-example1.html

static ArrayList does not work. Updated to non-static. The codes work
correctly then.

--
Lu Ying




©2008 gg3721.com - Jax Systems, LLC, U.S.A.