• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Custom sizeErrorLabel with maxRequestSize?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm using rich:fileUpload component in my app.
To restrict file size for upload, I have setting into web.xml the maxRequestSize param in the filter tag. It's works.

When I use for upload a file with size greater than maxRequestSize param, it is display out "File size restricted".

Now I have a properties file with internalization and in my bean (that uses rich:fileUpload component) I use a resourceBundle to change all label in fileUpload component:

<rich:fileUpload ... sizeErrorLabel="#{resourceBundle.msgSizeLimited}" .... />

Can I modify this message (msgSizeLimited) using maxRequestSize param?
I wish to get: "Use file size smaller than 'maxRequestSize param'".
If it is possibile, how can I do it?

Also I can to use my bean to format sizeErrorLabel:
<rich:fileUpload ... sizeErrorLabel="#{bean.stringSizeLimited}" .... />
but I don't know how to read a maxRequestSize param into web.xml.

Finally, only for info, can I to use a label as "Use file size smaller than {0}", and to use a <f:param ... /> into rich:fileUpload component?


Thanks
Pasquy



 
Saloon Keeper
Posts: 25477
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Getting the maxRequestSize might be a challenge, since as I read it, you'd have to locate the filter and ask the filter for the value it had been configured with. Assuming that it it was willing to tell you. Possibly you could wrap the filter class with one of your own to make it easier.

I don't think you can parameterize errorlabel attributes, so that lets that one out. If you get the message from a backing bean, you can have the property accessor format the message before returning it, however.

On the last one, you can probably specify "Use file size smaller than #{myBean.maxRequestSize}" on your label.
 
pasquale vitale
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank Mill,
I have created a my filter (that extends org.ajax4jsf.Filter) and into init() method I read my maxRequestSize param and it put in session.
In my bean I get my maxRequestSize param from session.
It's works

bye
 
I can't renounce my name. It's on all my stationery! And hinted in this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic