Re: File upload problem - setFile( ) never called, please help!

2006-04-11 Thread Murray Brandon
In fact, when I have a multipart form, none of the setters get called on 
my beans, even for h:inputText fields
(with or without an upload control on the form).  If I remove the 
multipart flag, my setters get called, but of course you need a 
multipart form for uploading binary files.


Could it be a MyFaces 1.1.3 bug?  Or could it be the result of using 
both ADF and MyFaces together?

My jars are below.

   10,823 adf-facelets.jar
  683,633 adf-faces-api-ea20-SNAPSHOT.jar
3,122,625 adf-faces-impl-ea20-SNAPSHOT.jar
   48,742 common-annotations.jar
  188,671 commons-beanutils-1.7.0.jar
   46,725 commons-codec-1.3.jar
  559,366 commons-collections-3.1.jar
  168,446 commons-digester-1.6.jar
  112,341 commons-el-1.0.jar
   31,825 commons-fileupload-1.1.jar
   65,621 commons-io-1.2.jar
  207,723 commons-lang-2.1.jar
   38,015 commons-logging-1.0.4.jar
   26,089 el-api.jar
   96,983 el-ri.jar
  252,102 jsf-facelets1014.jar
   50,491 jsp-api.jar
   16,923 jstl-1.1.0.jar
  123,206 mob-layer-interfaces.jar
  252,169 myfaces-api-1.1.3-SNAPSHOT.jar
  517,156 myfaces-impl-1.1.3-SNAPSHOT.jar
   15,420 portlet.jar
  188,993 serializer.jar
1,237,598 tomahawk-1.1.2-SNAPSHOT.jar
3,078,601 xalan.jar
1,203,860 xercesImpl.jar
  194,205 xml-apis.jar

Murray Brandon wrote:

Hi all,

I'm having a problem trying to get file upload to work.

h:form id=form1 name=form1 enctype=multipart/form-data 
h:outputText value=Please give me an image/
*t:inputFileUpload id=fileupload
   accept=image/*
   value=#{ui.someUser.file}
   storage=file
   required=true/*
h:commandButton value=Upload Now! 
action=#{ui.someUser.doUpload} /

/h:form

My bean effectively has this in it:

import org.apache.myfaces.custom.fileupload.UploadedFile;
:
:
public class MyBean
{
public void fileUploaded(ValueChangeEvent event)
{
UploadedFile file = (UploadedFile)event.getNewValue();
if (file != null)
{
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage(Successfully 
uploaded file  + file.getName() +  ( + file.getSize() +  bytes));

context.addMessage(event.getComponent().getClientId(context), message);

// Here's where we could call file.getInputStream()
}
else
{
System.out.println(fileUploaded called with no file);
}
}
   
public UploadedFile getFile()

{
return _file;
}

*public void setFile(UploadedFile file)
{
// never called!
_file = file;
}
*
public String doUpload()
{
UploadedFile file = getFile();
// ... and process it in some way
return (file != null ? file.getName() : nullo);
}

private UploadedFile _file;   
}


Please help!

Regards, Murray


extra notes:

1) I am using Facelets + Myfaces + Tomahawk + ADF faces.

2) For a start I get a javascript error on submit because 
clear_form1(); does not exist not sure why it is missing.

The following html was generated:
 input id=form1:_id6 name=form1:_id6 type=submit value=Upload 
Now! onclick=*clear_form1();*


3) My web.xml
filter
filter-nameMyFacesExtensionsFilter/filter-name

filter-classorg.apache.myfaces.webapp.filter.ExtensionsFilter/filter-class

init-param
param-namemaxFileSize/param-name
param-value20m/param-value
descriptionSet the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
/description
/init-param
/filter
   
!-- extension mapping for adding script/, link/, and other 
resource tags to JSF-pages  --

filter-mapping
filter-nameMyFacesExtensionsFilter/filter-name
servlet-nameFacesServlet/servlet-name
/filter-mapping
   
!-- extension mapping for serving page-independent resources 
(javascript, stylesheets, images, etc.)  --

filter-mapping
filter-nameMyFacesExtensionsFilter/filter-name
url-pattern/faces/myFacesExtensionResource/*/url-pattern
/filter-mapping

4) ADF faces file upload exhibits the same behaviour.

5) The file is definitely attempting to be uploaded because if I give 
a really big file I get a SizeLimitExceededException.


Apr 11, 2006 4:58:58 AM 
org.apache.myfaces.webapp.filter.MultipartRequestWrapper parseRequest

INFO: user tried to upload a file that exceeded file-size limitations.
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: 
the request was rejected because its size (337407087) exceeds the 
configured maximum (104857600)
at 

Newbie help

2006-04-11 Thread JSFSter Smith
Hi,

I have just started using MyFaces for a new project and had a couple of
questions while I am on the learning curve. Any help/response is
greatly appreciated. Its been a pleasure to actually create
JSP pages with no java code using JSF in them and I hope to keep them
that way!


1. h:commandLink tag does not work inside a t:dataTable tag 
 and ends up refreshing the same page from
where the link was clicked without any updates to the model. The
get/set methods for the corresponding backing bean member are
never called by the framework

 I looked through the mail archives for myFaces as
well as JSF RI. This seems to be an issue faced by many users and the
suggested work around is to make the backing bean that contains the
table data a session bean (currently mine is a request). Is this a bug
with the spec or am I missing something ?

2. h:commandButton with a request scope backing bean cannot be
used to pass request parameters to the next page using f:param
tags. 
 The h:commandLink tag has to be used instead. Again is this a bug or I am missing something?

Currently, I am using h:commandLinks for my request param passing
and it works fine. But this leads me to my final question:

3. I am trying to map the enter key to my command link (which is an image) using _javascript_ and have included a snippet below.
 
 if (keycode == 13) {

 document.forms['MyJSFForm'].elements['submitLink'].click()
 return false;
 }

 I have explicitly given id's to my form and commandLink. The _javascript_ object for the link is invalid

Thanks in advance for your response!

- Rajiv


Managed Bean Best Practices

2006-04-11 Thread arti



Hi

Are there any best practices for using Managed 
Beans?

We plan to use our own custom-built JSF components. 
Need to understand how to design backing beans for performance/effort 
optimization.For example :

1. How to make managed beans thread-safe for 
concurrent requests, without compromising on efficiency/speed?

2. How to enforce the J2EE security with 
managed-beans?

3. How to decide the scope of these beans to ensure 
minimal data-storage in session?

4. How to decide the granularity at which a 
managed-bean should be used for example :

4.1 One bean-per-component 
Advantages : a) if complex components require special 
data-holding/processing/event-handling capabilities from bean 
 (e.g. datagrid model,tree model,menu 
model) Problems :- with multiple components in a 
page/form  a) it becomes tedious to debug/change/track 
which bean serves which component  b) if session scope is 
required, too many beans will be cached in session c) 
unnecessarily too many beans will be created on server (= n pages * m 
components-per-page) d) unnecessarily increases the length 
of faces-config.xml

4.2 One bean-per-form  
Advantages : a) in multi-form web pages, to ensure the 
functional behaviour of each form is separate/modular in its own bean. 
 b) each managed-bean would map to specific/meaningful 
functionality/user-interaction in use-case.

 Problems :- if form 
includes complex components (datagrid/tree/menu) requiring a specialised bean 
class, then  a) either one of the specialized bean has to be 
augmented with additional logic to handle data/events for all other components 
within the form (Not good, as it mixes-up the 
responsibilities of component-specific-beans, and the bean may no more be 
reusable in another form)

 b) or without using component-specific 
beans, only single form bean should handle the data/events for all components in 
the form? (Neither good, since if a complex 
tree-compoent is reused in multiple forms, then the logic to handle data/events 
for such a component will be repeated in those many form-specific managed beans) 


4.3 One bean-per-page Advantages 
: a) seems more modular/meaningful way - since a page would map 
to some feature within the use-case b) bean will contain only 
behaviour which is relevent for the associated page/function within 
use-caseProblems : a) in multi-form pages, can single 
bean handle data/events for multiple forms?  b) if page 
uses complex component (e.g datagrid, tree) that needs its own bean - how does 
page-bean exchange data with component-bean?

Thanks,Arti


RE: Newbie help

2006-04-11 Thread Balaji Kalyansundaram



Hi

1.
h:commandLink tag does
not work inside a t:dataTable
tag The value
(collection) for the dataTable has to be avaialble in the Restore View Phase
too. You can achieve that by using Session Bean or SaveSate. Look @
t:saveSate
 There are a lot od posts on
this issue.

3. To
use your owbn ids, u need to use the t:forceId of MyFaces otherwise JSF creates
prefixes for the component's.

HIH.

Balaj

  -Original Message-From: JSFSter Smith
  [mailto:[EMAIL PROTECTED]Sent: Tuesday, 11 April 2006 5:21
  PMTo: MyFaces DiscussionSubject: Newbie
  helpHi,I have just started using MyFaces for a
  new project and had a couple of questions while I am on the learning curve.
  Any help/response is greatly appreciated. Its been a pleasure to
  actually create JSP pages with no java code using JSF in them and I hope
  to keep them that way!1. h:commandLink tag does not work
  inside a t:dataTable tag  and ends up
  refreshing the same page from where the link was clicked without any updates
  to the model. The get/set methods for the corresponding backing bean
  member are never called by the framework I looked
  through the mail archives for myFaces as well as JSF RI. This seems to be an
  issue faced by many users and the suggested work around is to make the backing
  bean that contains the table data a session bean (currently mine is a
  request). Is this a bug with the spec or am I missing something ?2.
  h:commandButton with a request scope backing bean cannot be used to
  pass request parameters to the next page using f:param tags.
   The h:commandLink tag has to be used instead.
  Again is this a bug or I am missing something?Currently, I am using
  h:commandLinks for my request param passing and it works fine. But this
  leads me to my final question:3. I am trying to map the enter key to
  my command link (which is an image) using _javascript_ and have included a
  snippet below.  if (keycode == 13)
  {
  document.forms['MyJSFForm'].elements['submitLink'].click()
  return false; } I have
  explicitly given id's to my form and commandLink. The _javascript_ object for
  the link is invalidThanks in advance for your response!-
  Rajiv

This correspondence is for the named persons only. 
It may contain confidential or privileged information or both. 
No confidentiality or privilege is waived or lost by any mis transmission. 
If you receive this correspondence in error please delete it from your system immediately and notify the sender. 
You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. 
Any opinions expressed in this message are those of the individual sender except where the sender expressly, 
and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.


Re: tld files are not found

2006-04-11 Thread Murat Hazer
Hi,Problem disappered when a built the source on a Linux machine, problem is something with windows i think :).regards...On 4/10/06, Murat Hazer
 [EMAIL PROTECTED] wrote:
Hi,I don't think this (http://issues.apache.org/jira/browse/TOMAHAWK-242) is the same issue as mine. On my situation tld files are missing in the jar files.
regards...On 4/10/06, Mario Ivankovits 
[EMAIL PROTECTED] wrote:
Hi!Could you please check if this is bughttp://issues.apache.org/jira/browse/TOMAHAWK-242
 ?If this is the case, I've already fixed it, though, will commit it tomorrow.
Ciao,Mario Hi,I built the myfaces from the SVN with maven, everything worked well and jar files are generated. Then i import these new jar files to the my project lib path and removed old myfaces jar files then i fired up
 the server and it started without any error. But when i call a page i got the following error; javax.servlet.ServletException: The absolute uri: 
http://java.sun.com/jsf/core
 cannot be resolved in either web.xml or the jar files deployed with this application javax.faces.webapp.FacesServlet.service(FacesServlet.java:152) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter

(ExtensionsFilter.java:144) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal (OpenSessionInViewFilter.java:174) org.springframework.web.filter.OncePerRequestFilter.doFilter

(OncePerRequestFilter.java:76) org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:43) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:292) 
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java :79)
 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)

 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:303) org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)

 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java

:220) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173) 
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120) then i checked the jar files which i built recently and i saw that tld files are missing in the META-INF directories. (nightly build jar files at the myfaces official page have these tld files)
 What am i doing wrong? regards... -- Murat HAZER Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer Tel - Phone: +90 222 335 05 80 - 1395
 Cep Tel - Mobile Phone: +90 532 472 00 63 Blog URL: http://www.projedunyasi.org Yahoo Group: 
http://groups.yahoo.com/group/malatyafenlisesi/
--mfgMario Ivankovits - OPS EDV Vertriebsges.m.b.H.Software EngineeringMichael-Bernhard-Gasse 10, A-1120 WienTel.: +43-1-8938810Fax: +43-1-8938810/3700E-Mail: 

[EMAIL PROTECTED]Skype: mario_ivankovits-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics EngineerTel - Phone: +90 222 335 05 80 - 1395
Cep Tel - Mobile Phone: +90 532 472 00 63Blog URL: http://www.projedunyasi.orgYahoo Group: 
http://groups.yahoo.com/group/malatyafenlisesi/


-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics EngineerTel - Phone: +90 222 335 05 80 - 1395Cep Tel - Mobile Phone: +90 532 472 00 63
Blog URL: http://www.projedunyasi.orgYahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/


SV: File upload problem - setFile( ) never called, please help!

2006-04-11 Thread Kasper Hansen



Hi,
I think you got a mismatch between your JSF code and Java 
class:
value="#{ui.someUser.file}"MyBean


Fra: Murray Brandon [mailto:[EMAIL PROTECTED] 
Sendt: 11. april 2006 07:09Til: MyFaces 
DiscussionEmne: File upload problem - setFile( ) never called, please 
help!
Hi all,I'm having a problem trying to get file upload to 
work. h:form id="form1" 
name="form1" enctype="multipart/form-data" 
 
h:outputText value="Please give me an 
image"/ 
t:inputFileUpload 
id="fileupload" 
accept="image/*" 
value="#{ui.someUser.file}" 
storage="file" 
required="true"/ 
h:commandButton value="Upload Now!" action="" 
/ /h:formMy 
bean effectively has this in it:import 
org.apache.myfaces.custom.fileupload.UploadedFile;::public class 
MyBean{ public void fileUploaded(ValueChangeEvent 
event) { 
UploadedFile file = 
(UploadedFile)event.getNewValue(); 
if (file != null) 
{ 
FacesContext context = 
FacesContext.getCurrentInstance(); 
FacesMessage message = new FacesMessage("Successfully uploaded file " + 
file.getName() + " (" + file.getSize() + " 
bytes)"); 
context.addMessage(event.getComponent().getClientId(context), 
message); 
// Here's where we could call 
file.getInputStream() 
} 
else 
{ 
System.out.println("fileUploaded called with no 
file"); } 
}  public UploadedFile 
getFile() { 
return _file; } public void 
setFile(UploadedFile file) 
{ // never 
called! _file = 
file; } public String 
doUpload() { 
UploadedFile file = getFile(); // 
... and process it in some way 
return (file != null ? file.getName() : "nullo"); 
} private UploadedFile _file; 
}Please help!Regards, 
Murrayextra 
notes:1) I am using Facelets + Myfaces + Tomahawk + ADF faces.2) 
For a start I get a _javascript_ error on submit because clear_form1(); does not 
exist not sure why it is missing.The following html was 
generated:input id="form1:_id6" name="form1:_id6" type="submit" 
value="Upload Now!" 3) My 
web.xml filter 
 
filter-nameMyFacesExtensionsFilter/filter-name 
 
filter-classorg.apache.myfaces.webapp.filter.ExtensionsFilter/filter-class 
init-param 
param-namemaxFileSize/param-name 
param-value20m/param-value 
descriptionSet the size limit for uploaded 
files. 
Format: 10 - 10 
bytes 
10k - 10 
KB 
10m - 10 
MB 
1g - 1 GB 
/description 
/init-param /filter 
 !-- extension mapping for adding script/, 
link/, and other resource tags to JSF-pages 
-- 
filter-mapping 
filter-nameMyFacesExtensionsFilter/filter-name 
servlet-nameFacesServlet/servlet-name 
/filter-mapping  !-- 
extension mapping for serving page-independent resources (_javascript_, 
stylesheets, images, etc.) -- 
filter-mapping 
filter-nameMyFacesExtensionsFilter/filter-name 
url-pattern/faces/myFacesExtensionResource/*/url-pattern 
/filter-mapping4) ADF faces file upload exhibits the same 
behaviour.5) The file is definitely attempting to be uploaded because if 
I give a really big file I get a SizeLimitExceededException.Apr 11, 2006 
4:58:58 AM org.apache.myfaces.webapp.filter.MultipartRequestWrapper 
parseRequestINFO: user tried to upload a file that exceeded file-size 
limitations.org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: 
the request was rejected because its size (337407087) exceeds the configured 
maximum (104857600) at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:310) 
at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268) 
at 
org.apache.myfaces.webapp.filter.MultipartRequestWrapper.parseRequest(MultipartRequestWrapper.java:81) 
at 
org.apache.myfaces.webapp.filter.MultipartRequestWrapper.getParameterMap(MultipartRequestWrapper.java:177) 
at 
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:184) 
at 
oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:80) 
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 
at 
org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:130) 
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) 
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) 
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 
at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432) 
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) 
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) 
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) 
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) 
at 

Re: Newbie help

2006-04-11 Thread Volker Weber
Hi Rajiv,

1: The model must the same on render and restore phase, afaik you can
   force this by using preserveDataModel=true on t:datatable.
   Or you can use the t:saveState tag see:
   http://myfaces.apache.org/tomahawk/uiSaveState.html


3: the html ids are created by prefixing component ids with the ids of
   namingcontainer components

   you should use sommething like

   document.forms['MyJSFForm'].elements['MyJSFForm:submitLink'].click()

   or

   document.getElementById('MyJSFForm:submitLink').click()

   Take a look into the generated html source if unclear about the
   generated id of the link.


Regards,
  Volker


JSFSter Smith wrote:
 Hi,
 
 I have just started using MyFaces for a new project and had a couple of
 questions while I am on the learning curve. Any help/response is greatly
 appreciated.  Its been a pleasure to actually create  JSP pages with no java
 code using JSF in them and I hope to keep them that way!
 
 
 1. h:commandLink tag does not work inside a t:dataTable tag
  and ends up refreshing the same page from where the link was clicked
 without any updates to the model. The get/set  methods for the corresponding
 backing bean member are never called by the framework
 
 I looked through the mail archives for myFaces as well as JSF RI. This
 seems to be an issue faced by many users and the suggested work around is to
 make the backing bean that contains the table data a session bean (currently
 mine is a request). Is this a bug with the spec or am I missing something ?
 
 2. h:commandButton with a request scope backing bean cannot be used to
 pass request parameters to the next page using f:param tags.
 The h:commandLink tag has to be used instead. Again is this a bug or I
 am missing something?
 
 Currently, I am using h:commandLinks for  my request param passing and it
 works fine. But this leads me to my final question:
 
 3. I am trying to map the enter key to my command link (which is an image)
 using javascript and have included a snippet below.
 
if (keycode == 13) {
 
document.forms['MyJSFForm'].elements['submitLink'].click()
 return false;
 }
 
 I have explicitly given id's to my form and commandLink. The java script
 object for the link is invalid
 
 Thanks in advance for your response!
 
 - Rajiv
 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.


Re: SV: File upload problem - setFile( ) never called, please help!

2006-04-11 Thread Murray Brandon

Hi Kasper,

It's a slight oddity in the way I resolve my beans (ui. uses my own 
resolver to find the bean value) which should be ok.
I replaced my resolver class name with MyBean to try and simplify the 
example.


doUpload( ) *does* get called.

The setFile( ) or getFile( ) don't get called, nor do 
setValue(file,) etc;


I'll move the example to a simple bean example tomorrow to be sure.

Oddly if I put a inputText field in a multi-part form it does not get 
persisted to a bean through my resolver either.
If I make the form non multi-part the bean gets a setValue( ) called on 
it through my resolver. 
Why should it be any different?


Regards, Murray

Kasper Hansen wrote:

*Hi,*
I think you got a mismatch between your JSF code and Java class:
*value=#{ui.someUser.file}*
MyBean

*Fra:* Murray Brandon [mailto:[EMAIL PROTECTED]
*Sendt:* 11. april 2006 07:09
*Til:* MyFaces Discussion
*Emne:* File upload problem - setFile( ) never called, please help!

Hi all,

I'm having a problem trying to get file upload to work.

h:form id=form1 name=form1 enctype=multipart/form-data 
h:outputText value=Please give me an image/
*t:inputFileUpload id=fileupload
   accept=image/*
   value=#{ui.someUser.file}
   storage=file
   required=true/*
h:commandButton value=Upload Now! 
action=#{ui.someUser.doUpload} /

/h:form

My bean effectively has this in it:

import org.apache.myfaces.custom.fileupload.UploadedFile;
:
:
public class MyBean
{
public void fileUploaded(ValueChangeEvent event)
{
UploadedFile file = (UploadedFile)event.getNewValue();
if (file != null)
{
FacesContext context = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage(Successfully 
uploaded file  + file.getName() +  ( + file.getSize() +  bytes));

context.addMessage(event.getComponent().getClientId(context), message);

// Here's where we could call file.getInputStream()
}
else
{
System.out.println(fileUploaded called with no file);
}
}
   
public UploadedFile getFile()

{
return _file;
}

*public void setFile(UploadedFile file)
{
// never called!
_file = file;
}
*
public String doUpload()
{
UploadedFile file = getFile();
// ... and process it in some way
return (file != null ? file.getName() : nullo);
}

private UploadedFile _file;   
}


Please help!

Regards, Murray


extra notes:

1) I am using Facelets + Myfaces + Tomahawk + ADF faces.

2) For a start I get a javascript error on submit because 
clear_form1(); does not exist not sure why it is missing.

The following html was generated:
 input id=form1:_id6 name=form1:_id6 type=submit value=Upload 
Now! onclick=*clear_form1();*


3) My web.xml
filter
filter-nameMyFacesExtensionsFilter/filter-name

filter-classorg.apache.myfaces.webapp.filter.ExtensionsFilter/filter-class

init-param
param-namemaxFileSize/param-name
param-value20m/param-value
descriptionSet the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
/description
/init-param
/filter
   
!-- extension mapping for adding script/, link/, and other 
resource tags to JSF-pages  --

filter-mapping
filter-nameMyFacesExtensionsFilter/filter-name
servlet-nameFacesServlet/servlet-name
/filter-mapping
   
!-- extension mapping for serving page-independent resources 
(javascript, stylesheets, images, etc.)  --

filter-mapping
filter-nameMyFacesExtensionsFilter/filter-name
url-pattern/faces/myFacesExtensionResource/*/url-pattern
/filter-mapping

4) ADF faces file upload exhibits the same behaviour.

5) The file is definitely attempting to be uploaded because if I give 
a really big file I get a SizeLimitExceededException.


Apr 11, 2006 4:58:58 AM 
org.apache.myfaces.webapp.filter.MultipartRequestWrapper parseRequest

INFO: user tried to upload a file that exceeded file-size limitations.
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: 
the request was rejected because its size (337407087) exceeds the 
configured maximum (104857600)
at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:310)
at 
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:268)
at 
org.apache.myfaces.webapp.filter.MultipartRequestWrapper.parseRequest(MultipartRequestWrapper.java:81)
at 

tree2 should not be rendered

2006-04-11 Thread Michael Heinen








Hi all,



I have a problem with tree2.

One of the trees on my page can be empty without any
nodes. In this case I don't want to render it.

But even when I set the rendered attribute to false
(hardcoded below) I got a NullPointerException.



Why do I get this exception when rendered is set to false?

Do I use it wrong? 



My BackingBean has session scope.

My STATE_SAVING_METHOD is client.

I don't manually save any states.





Here is my jsp snippet:

t:tree2 id=assTree
value=#{MyBean.assignedCategoriesTrees['mykey'].treeData} 

  var=node

 varNodeToggler=t

 clientSideToggle=false

 showRootNode=false

 rendered=false

 



In the above sample treeData is null.





Here is the stack:

org.apache.catalina.core.ApplicationDispatcher
invoke: Servlet.service() for servlet jsp threw exception

java.lang.NullPointerException

 at
org.apache.myfaces.custom.tree2.UITreeData.saveState(UITreeData.java:91)

 at
org.apache.myfaces.custom.tree2.HtmlTree.saveState(HtmlTree.java:60)

 at
javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:462)

 at
javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:456)

 at
javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:456)

 at
javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:456)

 at
javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:456)

 at
javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:456)

 at
javax.faces.component.UIComponentBase.processSaveState(UIComponentBase.java:456)

 at
org.apache.myfaces.application.jsp.JspStateManagerImpl.getComponentStateToSave(JspStateManagerImpl.java:70)

 at
org.apache.myfaces.application.jsp.JspStateManagerImpl.saveSerializedView(JspStateManagerImpl.java:215)

 at org.apache.myfaces.taglib.core.ViewTag.doAfterBody(ViewTag.java:139)

 ...





Any help is appreciated.

Michael








Re: tld files are not found

2006-04-11 Thread maixu
Coño contestame algo, que voy a pensar que me odias.On 4/11/06, Murat Hazer [EMAIL PROTECTED] wrote:
Hi,Problem disappered when a built the source on a Linux machine, problem is something with windows i think :).
regards...On 4/10/06, Murat Hazer
 [EMAIL PROTECTED] wrote:

Hi,I don't think this (http://issues.apache.org/jira/browse/TOMAHAWK-242) is the same issue as mine. On my situation tld files are missing in the jar files.
regards...On 4/10/06, Mario Ivankovits 

[EMAIL PROTECTED] wrote:
Hi!Could you please check if this is bughttp://issues.apache.org/jira/browse/TOMAHAWK-242
 ?If this is the case, I've already fixed it, though, will commit it tomorrow.
Ciao,Mario Hi,I built the myfaces from the SVN with maven, everything worked well and jar files are generated. Then i import these new jar files to the my project lib path and removed old myfaces jar files then i fired up
 the server and it started without any error. But when i call a page i got the following error; javax.servlet.ServletException: The absolute uri: 

http://java.sun.com/jsf/core
 cannot be resolved in either web.xml or the jar files deployed with this application javax.faces.webapp.FacesServlet.service(FacesServlet.java:152) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter


(ExtensionsFilter.java:144) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal (OpenSessionInViewFilter.java:174) org.springframework.web.filter.OncePerRequestFilter.doFilter


(OncePerRequestFilter.java:76) org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:43) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:292) 
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java :79)
 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)


 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:303) org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)


 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java


:220) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173) 
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120) then i checked the jar files which i built recently and i saw that tld files are missing in the META-INF directories. (nightly build jar files at the myfaces official page have these tld files)
 What am i doing wrong? regards... -- Murat HAZER Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer Tel - Phone: +90 222 335 05 80 - 1395
 Cep Tel - Mobile Phone: +90 532 472 00 63 Blog URL: http://www.projedunyasi.org Yahoo Group: 
http://groups.yahoo.com/group/malatyafenlisesi/
--mfgMario Ivankovits - OPS EDV Vertriebsges.m.b.H.Software EngineeringMichael-Bernhard-Gasse 10, A-1120 WienTel.: +43-1-8938810Fax: +43-1-8938810/3700E-Mail: 


[EMAIL PROTECTED]Skype: mario_ivankovits-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics EngineerTel - Phone: +90 222 335 05 80 - 1395
Cep Tel - Mobile Phone: +90 532 472 00 63Blog URL: http://www.projedunyasi.orgYahoo Group: 

http://groups.yahoo.com/group/malatyafenlisesi/


-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics Engineer
Tel - Phone: +90 222 335 05 80 - 1395Cep Tel - Mobile Phone: +90 532 472 00 63
Blog URL: http://www.projedunyasi.orgYahoo Group: 
http://groups.yahoo.com/group/malatyafenlisesi/

-- maixu


Re: tld files are not found

2006-04-11 Thread Murat Hazer
ooppsOn 4/11/06, maixu [EMAIL PROTECTED] wrote:
Coño contestame algo, que voy a pensar que me odias.On 4/11/06, 
Murat Hazer [EMAIL PROTECTED] wrote:
Hi,Problem disappered when a built the source on a Linux machine, problem is something with windows i think :).
regards...On 4/10/06, Murat Hazer
 [EMAIL PROTECTED] wrote:


Hi,I don't think this (http://issues.apache.org/jira/browse/TOMAHAWK-242) is the same issue as mine. On my situation tld files are missing in the jar files.
regards...On 4/10/06, Mario Ivankovits 


[EMAIL PROTECTED] wrote:
Hi!Could you please check if this is bughttp://issues.apache.org/jira/browse/TOMAHAWK-242
 ?If this is the case, I've already fixed it, though, will commit it tomorrow.
Ciao,Mario Hi,I built the myfaces from the SVN with maven, everything worked well and jar files are generated. Then i import these new jar files to the my project lib path and removed old myfaces jar files then i fired up
 the server and it started without any error. But when i call a page i got the following error; javax.servlet.ServletException: The absolute uri: 


http://java.sun.com/jsf/core
 cannot be resolved in either web.xml or the jar files deployed with this application javax.faces.webapp.FacesServlet.service(FacesServlet.java:152) org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter



(ExtensionsFilter.java:144) org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal (OpenSessionInViewFilter.java:174) org.springframework.web.filter.OncePerRequestFilter.doFilter



(OncePerRequestFilter.java:76) org.ajaxanywhere.AAFilter.doFilter(AAFilter.java:43) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:292) 
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116) org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java :79)
 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:143)



 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter (FilterChainProxy.java:303) org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:246)



 org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java



:220) org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303) org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173) 
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:120) then i checked the jar files which i built recently and i saw that tld files are missing in the META-INF directories. (nightly build jar files at the myfaces official page have these tld files)
 What am i doing wrong? regards... -- Murat HAZER Elektrik-Elektronik Mühendisi - Electrical-Electronics Engineer Tel - Phone: +90 222 335 05 80 - 1395
 Cep Tel - Mobile Phone: +90 532 472 00 63 Blog URL: http://www.projedunyasi.org Yahoo Group: 
http://groups.yahoo.com/group/malatyafenlisesi/
--mfgMario Ivankovits - OPS EDV Vertriebsges.m.b.H.Software EngineeringMichael-Bernhard-Gasse 10, A-1120 WienTel.: +43-1-8938810Fax: +43-1-8938810/3700E-Mail: 



[EMAIL PROTECTED]Skype: mario_ivankovits-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics EngineerTel - Phone: +90 222 335 05 80 - 1395
Cep Tel - Mobile Phone: +90 532 472 00 63Blog URL: http://www.projedunyasi.orgYahoo Group: 


http://groups.yahoo.com/group/malatyafenlisesi/


-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics Engineer
Tel - Phone: +90 222 335 05 80 - 1395Cep Tel - Mobile Phone: +90 532 472 00 63
Blog URL: http://www.projedunyasi.orgYahoo Group: 

http://groups.yahoo.com/group/malatyafenlisesi/

-- maixu

-- Murat HAZERElektrik-Elektronik Mühendisi - Electrical-Electronics EngineerTel - Phone: +90 222 335 05 80 - 1395Cep Tel - Mobile Phone: +90 532 472 00 63
Blog URL: http://www.projedunyasi.orgYahoo Group: http://groups.yahoo.com/group/malatyafenlisesi/


list from-outcome

2006-04-11 Thread Jan
Hi there,

can someone tell me if there is a possibility to declare more than one 
from-outcome definition in faces-config.xml?

This is what I have for now:
navigation-case

from-action#{LoginBackingBean.checkLogin}/from-action
from-outcomea/from-outcome
to-view-id/project.jsp/to-view-id
/navigation-case  

But I would like something in that way:
navigation-case

from-action#{LoginBackingBean.checkLogin}/from-action
from-outcomea OR b OR c/from-outcome
to-view-id/project.jsp/to-view-id
/navigation-case

Do I have to write a single navigation-case for each option, or is there a
better way to do so? 
Thanks in advance :)

Jan




tobago tab control

2006-04-11 Thread Nazar Stasiv

Hi all,

There is an issue with t:tab component. If I click twice any t:link 
element on second or third tab  tobago will render first ( default ) tab.

Why is that happening?

Nazar




Re: inputText fields cleared after validation errors

2006-04-11 Thread Santiago Vacas
I've found the problem. I'm using WebSphere 6 that comes with his own
JSF implementation so I had to remove jsf-api.jar and ws-jsf.jar from
the base installation to fix the issue. The funny thing is that
everything worked fine before using tiles.
Is there any way to avoid removing those jars and have the application working?
I've tried setting the classloader policy to PARENT_LAST with no success.

thanks
santiago

On 4/5/06, Santiago Vacas [EMAIL PROTECTED] wrote:
 hi,
 whenever I have a validation error in a form all the submitted values
 are cleared. This behavior appeared when I added tiles to the
 application. Without tiles it works OK (shows submitted values after
 validation error).
 I've made a minimum example showing this problem:

 testLayout.jsp
 %@ taglib prefix=tiles uri=http://struts.apache.org/tags-tiles; %
 %@ taglib uri=http://java.sun.com/jsf/core; prefix=f %
 %@ taglib uri=http://java.sun.com/jsf/html; prefix=h %
 html
 body
 f:view
 f:subview id=content
 tiles:insert attribute=body flush=false /
 /f:subview
 /f:view
 /body
 /html


 testSubmitError.jsp
 [EMAIL PROTECTED] uri=http://java.sun.com/jsf/core; prefix=f%
 [EMAIL PROTECTED] uri=http://java.sun.com/jsf/html; prefix=h%
 h:form id=form
 h:messages layout=table styleClass=errorMessage 
 globalOnly=true /
 h:panelGrid columns=3
 h:outputText id=stockNoLabel value=Stock # /
 h:inputText id=stockNo value=#{testBean.stockNo} 
 required=true
 f:validateLength minimum=5 maximum=5 /
 /h:inputText
 h:message for=stockNo /
 /h:panelGrid
 h:commandButton id=save action=#{testBean.save} 
 value=Save /
 /h:form


 tiles definition:
 tiles-definitions
 definition name=/testSubmitError.tiles
 path=/common/layout/testLayout.jsp 
 put name=body value=/testSubmitError.jsp /
 /definition
 /tiles-definitions

 any ideas?
 thanks

 santiago



Re: tree2 and AjaxAnywhere

2006-04-11 Thread Bill Schneider
I have it working with MyFaces 1.1.1 but had to do some work arounds 
(some messy). What does your XHTML (or JSP) looking like with the 
aa:zoneJSF and t:tree2 nodes? Let me know that and I'll see if I can 
help you out.


I should point out that I am overloading the tree2 component with some 
table function as well, like t:tree/t:treeColumn, as others have 
discussed previously on this list.  That may be the crux of the issue, 
but I'm not exactly sure why it would break anything because the basic 
tree2 functionality is the same; it just renders as table rows.


Besides that, this should be fairly vanilla MyFaces/AjaxAnywhere 
integration; I am putting the zoneJSF tag around my whole tree component:


aa:zoneJSF id=treeZone
  xxx:tree2Table ...
h:column...
  h:commandLink 
xxx:treeColumn...

then later, I have a script to set up the zone and substitute for the 
form submission function, since the tree is within a form with commandLinks.


script
ajaxAnywhere.setZonesToRefresh = function() {
  return treeZone;
}
ajaxAnywhere.formName = myForm;
ajaxAnywhere.substituteFormSubmitFunction();
ajaxAnywhere.substituteSubmitButtonsBehavior(true);
/script

It appears to be making the request and receiving the response, but the 
response HTML looks 'cut off'.  It appears to get as far as
script src=.../tree2.HtmlTreeRenderer/11302665/javascript/tree.js 
and that's the end of it.


debugging the response, I wonder if AjaxAnywhere is getting tripped up 
by the HTML comment immediately following that script tag (!-- \n // 
--), because it is not showing the following reference to cookielib.js 
that I would expect either.


-- Bill
--
Bill Schneider
Chief Architect

Vecna Technologies
5004 Lehigh Rd.
College Park, MD 20740
[EMAIL PROTECTED]
t: 240-737-1640
f: 301-699-3180



Re: inputText fields cleared after validation errors

2006-04-11 Thread Mike Kienenberger
On 4/11/06, Santiago Vacas [EMAIL PROTECTED] wrote:
 I've found the problem. I'm using WebSphere 6 that comes with his own
 JSF implementation so I had to remove jsf-api.jar and ws-jsf.jar from
 the base installation to fix the issue. The funny thing is that
 everything worked fine before using tiles.
 Is there any way to avoid removing those jars and have the application 
 working?
 I've tried setting the classloader policy to PARENT_LAST with no success.

Removing the two jars is the only working solution that I've seen
reported so far.  Even if you load those jars last, my guess is that
you're still triggering code in the JSF RI implementation, causing
both implementations to be in use.


Re: list from-outcome

2006-04-11 Thread Mike Kienenberger
One thing you can do is use *.   Not sure if this works in your situation.

I remember someone posting that you could put EL expressions in the
navigation rules, but I can't remember if this was a customization of
the NavigationHandler.

On 4/11/06, Jan [EMAIL PROTECTED] wrote:
 Hi there,

 can someone tell me if there is a possibility to declare more than one
 from-outcome definition in faces-config.xml?

 This is what I have for now:
 navigation-case

 from-action#{LoginBackingBean.checkLogin}/from-action
 from-outcomea/from-outcome
 to-view-id/project.jsp/to-view-id
 /navigation-case

 But I would like something in that way:
 navigation-case

 from-action#{LoginBackingBean.checkLogin}/from-action
 from-outcomea OR b OR c/from-outcome
 to-view-id/project.jsp/to-view-id
 /navigation-case

 Do I have to write a single navigation-case for each option, or is there a
 better way to do so?
 Thanks in advance :)

 Jan





Re: File upload problem - setFile( ) never called, please help!

2006-04-11 Thread Mike Kienenberger
On 4/11/06, Murray Brandon [EMAIL PROTECTED] wrote:
 In fact, when I have a multipart form, none of the setters get called on
 my beans, even for h:inputText fields
 (with or without an upload control on the form).  If I remove the
 multipart flag, my setters get called, but of course you need a
 multipart form for uploading binary files.

My guess is validation or conversion is failing, and you're never
reaching the updateModel phase.  Throw an h:messages tag on your page.


RE: tag to truncate outputText?

2006-04-11 Thread Lindholm, Greg

-Original Message-
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 06, 2006 2:03 PM

 String converters aren't allowed in JSF 1.1, but they are in 1.2. 
 Otherwise a converter would be a good choice.

Not sure what you meant by String converters aren't allowed I saw 
several examples in books so I wrote one and it works great.
(It's not a true converter since it only handles output.)


I call it truncateOutput and it takes two attributes a truncateAt
position 
and an optional continuationMark.

h:outputText value=#{var.description}
xxx:truncateOutput truncateAt=35 continuationMark=... /
/h:outputText

Here are all the pieces, if anyone want to package them up 
for contribution to tomahawk that would be great!
I don't have the time (or knowledge how) to do it right now.
 

TruncateConverter.java
--
public class TruncateConverter implements Converter, StateHolder
{
private int truncateAt = 0;
private String  continuationMark;
private boolean transientFlag;

public Object getAsObject(FacesContext context,
  UIComponent component,
  String value) throws ConverterException
{
// Should never happend - TruncateConverter is only usable for
output.
throw new AssertionError(getClass().getName()
+  does not support Input conversion.);
}

public String getAsString(FacesContext context,
  UIComponent component,
  Object value) throws ConverterException
{
if (value == null)
{
return null;
}

StringBuffer buff = new StringBuffer();
buff.append(value);

if (getTruncateAt()  0  buff.length()  getTruncateAt())
{
buff.setLength(getTruncateAt());
if (getContinuationMark() != null)
{
buff.append(getContinuationMark());
}
}

return buff.toString();
}

/**
 * @return Returns the continuationMark.
 */
public String getContinuationMark()
{
return continuationMark;
}

/**
 * @param continuationMark The continuationMark to set.
 */
public void setContinuationMark(String continuationMark)
{
this.continuationMark = continuationMark;
}

/**
 * @return Returns the truncateAt.
 */
public int getTruncateAt()
{
return truncateAt;
}

/**
 * @param truncateAt The truncateAt to set.
 */
public void setTruncateAt(int truncateAt)
{
this.truncateAt = truncateAt;
}

// STATE SAVE/RESTORE
public void restoreState(FacesContext facesContext, Object state)
{
Object[] values = (Object[]) state;
this.truncateAt = ((Integer) values[0]).intValue();
this.continuationMark = (String) values[1];
}

public Object saveState(FacesContext facesContext)
{
Object[] values = new Object[2];
values[0] = new Integer(getTruncateAt());
values[1] = getContinuationMark();
return values;
}

public boolean isTransient()
{
return transientFlag;
}

public void setTransient(boolean aTransient)
{
transientFlag = aTransient;
}
}

TruncateConverterTag.java
--
public class TruncateConverterTag extends ConverterTag
{
private static final long serialVersionUID = -5486065206529786966L;

public TruncateConverterTag()
{
setConverterId(xxx.TruncateConverter);
}

private String truncateAt;
private String continuationMark;

protected Converter createConverter() throws JspException
{
TruncateConverter converter = (TruncateConverter)
super.createConverter();

FacesContext facesContext = FacesContext.getCurrentInstance();
setConverterTruncateAt(facesContext, converter, truncateAt);
setContinuationMark(facesContext, converter, continuationMark);
return converter;
}

public void release()
{
truncateAt = null;
continuationMark = null;
}

/**
 * Set the continuation mark to be used if the value is truncated.
(E.g. ...)
 * @param continuationMark expression that evaluates to a String.
 */
public void setContinuationMark(String continuationMark)
{
this.continuationMark = continuationMark;
}

/**
 * Set the position to truncate the value.
 * @param truncateAt expression that evaluates to an int.
 */
public void setTruncateAt(String truncateAt)
{
this.truncateAt = truncateAt;

}

private static void setConverterTruncateAt(FacesContext
facesContext,
   TruncateConverter
converter,
   String value)
{
if (value == null)
{

tobago extra component

2006-04-11 Thread Nazar Stasiv

Hi all,

I need to manage t:link component text decoration. I have sheet 
component with items t:link. First column displays t:link elements with 
underlined font, but the rest of columns should be links without 
underlining. Since it is not possible to apply font styles to t:link 
directly I propose to introduce new t:font component which will add 
bold,italic,underline attributes to manage font display in a flexible 
way. This wont break concept of view layer. What do you think ?


Nazar



Re: Newbie help

2006-04-11 Thread Mike Kienenberger
On 4/11/06, JSFSter Smith [EMAIL PROTECTED] wrote:
 1. This
 seems to be an issue faced by many users and the suggested work around is to
 make the backing bean that contains the table data a session bean (currently
 mine is a request). Is this a bug with the spec or am I missing something ?

Use t:saveState to effectively make the scope of your request-scoped
beans into page-scoped beans.



  2. h:commandButton with a request scope backing bean cannot be
 used to pass request parameters to the next page using f:param tags.
  The h:commandLink tag has to be used instead. Again is this a bug or
 I am missing something?

Correct, you cannot do it this way as f:param doesn't work with buttons.
There's a few ways to do this.   One is to add a component that will
set values (updateActionListener) when the action is triggered.  
Another is to call some javascript to manually set the parameter, but
it's not recommended.


script language=javascript
// ![CDATA[
function triggerRefreshButton(){
clear_form();
   
document.forms['form'].elements['NET_SF_JSFC_OPT_VDTR_MODE'].value='soft';

document.forms['form'].elements['autoScroll'].value=getScrolling();

document.getElementById(form:nonclearingRefreshButton).click();
}
// ]]
/script


!-- non-clearing refresh button; JSF will see it as 
refreshButton  --
f:verbatim
input type=submit style=display: none; value=Submit
name=form:refreshButton id=form:nonclearingRefreshButton/
/f:verbatim

!-- never used directly; refreshButton exists so verbatim html
above can imitate it --
h:commandButton id=refreshButton
value=Submit action=#{page.refresh}
style=display:none
/h:commandButton


Re: tobago tab control

2006-04-11 Thread Volker Weber
Hi Nazar,

i don't understand what you mean with 'click twice' on a link element.

Did you mean you have a page containing tabs, click on second tab header
to switch to second tab (which switchype?). there are a link element on
this second tab, clicking this link should submit the page and execute a
action on the server.

Did you mean click a second time (1) before the page is redisplayed
which means you try to execute the same action on one view twice
or (2) after the action is executed and the same view was rerendered.

In case of 1: this is not a tobago issue, but a issue of the jsf
implementation. Which implementation did you use? AFAIK myfaces has
implemented something, in svn head, but not released yet, which enable
to work on old, already submitted views.

In case of 2: I'm wondering if the correct tab on first redisplay was
shown? If so please create a small example and create a jira issue on
http://issues.apache.org/jira/



Regards,
  Volker


Nazar Stasiv wrote:
 Hi all,
 
 There is an issue with t:tab component. If I click twice any t:link
 element on second or third tab  tobago will render first ( default ) tab.
 Why is that happening?
 
 Nazar
 
 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.


Re: tag to truncate outputText?

2006-04-11 Thread Mike Kienenberger
On 4/11/06, Lindholm, Greg [EMAIL PROTECTED] wrote:
  String converters aren't allowed in JSF 1.1, but they are in 1.2.
  Otherwise a converter would be a good choice.

 Not sure what you meant by String converters aren't allowed I saw
 several examples in books so I wrote one and it works great.
 (It's not a true converter since it only handles output.)

Sorry.  The inability to register a global String converter was a
personal pet peeve of mine, and I allowed my annoyance with it to
blind me to other possibilities.

Global string converters cannot be used, but you are absolutely
correct that you could use a per-instance converter like this.   You'd
never set this up as a global converter, so this is a perfect use case
for it.   Thank you for pointing this out.


Re: tobago tab control

2006-04-11 Thread Nazar Stasiv

Volker Weber wrote:

Hi Nazar,

i don't understand what you mean with 'click twice' on a link element.
  

I'll explain

Did you mean you have a page containing tabs, click on second tab header
to switch to second tab (which switchype?).

Correct. serverside=true

 there are a link element on
this second tab, clicking this link should submit the page and execute a
action on the server.

  
correct, it does. But if clicked link while page hasn't re-rendered yet 
(it is possible, sort of  double-clicking ) it renders first tab.

Did you mean click a second time (1) before the page is redisplayed
  
which means you try to execute the same action on one view twice
  


yes, correct


In case of 1: this is not a tobago issue, but a issue of the jsf
implementation. Which implementation did you use? AFAIK myfaces has
implemented something, in svn head, but not released yet, which enable
to work on old, already submitted views.
  
Its myfaces 1.1.0. Though I'm not aware of plans to upgrade to more 
recent version of myfaces yet

Regards,
  Volker

  

Thank You


dataScroller with newspaperTable?

2006-04-11 Thread Marcus Beyer

hello all,

Is it possible to apply a dataScroller on a newspaperTable?

I tried this with newspaperColumns=2 but got only one column.

Marcus



t:newspaperTable id=at newspaperColumns=2 
rows=#{articleHandler.numberRowsPerPage} 
value=#{articleHandler.currentRowSet.wrappedData} var=article

f:facet name=spacerf:verbatim#160;/f:verbatim/f:facet
h:column id=col
h:outputText value=#{article.title} id=title /
/h:column
/t:newspaperTable

t:dataScroller for=at
style=margin-top: 1em
fastStep=20
pageCountVar=pageCount
pageIndexVar=pageIndex
paginator=true
paginatorMaxPages=20
paginatorTableClass=paginator
paginatorActiveColumnClass=paginatorActiveColumn
renderFacetsIfSinglePage=false

/t:dataScroller


tomahawk - data scroller

2006-04-11 Thread Leandro Augusto de Almeida
Hi,

I´m creating a view handler that renders the viewroot and it´s childs
(by encode method) whithout interleave with other tecnologies (like
jsp tags). But I am having some problems with the datascroller
component. This component doesn´t have all attributes saved in
savestate and restorestate methods...: the index of page displayed is
only defined in render time. And the id of the component is used in an
input hidden that is outside off the main table of the scroller, which
makes dificult to refer to the whole component with one id.
Is It right?

I hope I made myself clear,

Leandro.


Re: list from-outcome

2006-04-11 Thread Dennis Byrne
Jan,

This feature does not exist in any JSF implementation.  Cool idea though.

Dennis Byrne

-Original Message-
From: Jan [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 11, 2006 08:57 AM
To: ''MyFaces Discussion''
Subject: list from-outcome

Hi there,

can someone tell me if there is a possibility to declare more than one 
from-outcome definition in faces-config.xml?

This is what I have for now:
   navigation-case
   
from-action#{LoginBackingBean.checkLogin}/from-action
   from-outcomea/from-outcome
   to-view-id/project.jsp/to-view-id
   /navigation-case  

But I would like something in that way:
   navigation-case
   
from-action#{LoginBackingBean.checkLogin}/from-action
   from-outcomea OR b OR c/from-outcome
   to-view-id/project.jsp/to-view-id
   /navigation-case

Do I have to write a single navigation-case for each option, or is there a
better way to do so? 
Thanks in advance :)

Jan







RE: tag to truncate outputText?

2006-04-11 Thread Michael Heinen
Hi Greg,

Many thanks for sharing your code.
I was also working on something similar but I did not get a working
solution with valueBindings and datatables.

Now I'm really curious about your version and added it to my project.
But I get the following error (see below) on a really simple page.

Do you have any ideas?
I am using MyFaces 1.1.1.


http-8080-Processor25 [ERROR]
org.apache.catalina.core.ApplicationDispatcher invoke: Servlet.service()
for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 18 in the jsp file: /pages/catWizard.jsp
Generated servlet error:
The method setPageContext(PageContext) is undefined for the type
TruncateConverter

An error occurred at line: 18 in the jsp file: /pages/catWizard.jsp
Generated servlet error:
The method setParent(Tag) is undefined for the type TruncateConverter

An error occurred at line: 18 in the jsp file: /pages/catWizard.jsp
Generated servlet error:
The method doStartTag() is undefined for the type TruncateConverter

Generated servlet error:
The method doEndTag() is undefined for the type TruncateConverter

Generated servlet error:
The method reuse(Tag) in the type TagHandlerPool is not applicable for
the arguments (TruncateConverter)

Generated servlet error:
The method reuse(Tag) in the type TagHandlerPool is not applicable for
the arguments (TruncateConverter)


at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHa
ndler.java:84)
at
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.ja
va:328)
at
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:40
9)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:288)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:267)
at
org.apache.jasper.compiler.Compiler.compile(Compiler.java:255)





-Original Message-
From: Lindholm, Greg [mailto:[EMAIL PROTECTED] 
Sent: Dienstag, 11. April 2006 15:23
To: MyFaces Discussion
Subject: RE: tag to truncate outputText?


-Original Message-
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 06, 2006 2:03 PM

 String converters aren't allowed in JSF 1.1, but they are in 1.2. 
 Otherwise a converter would be a good choice.

Not sure what you meant by String converters aren't allowed I saw 
several examples in books so I wrote one and it works great.
(It's not a true converter since it only handles output.)


I call it truncateOutput and it takes two attributes a truncateAt
position 
and an optional continuationMark.

h:outputText value=#{var.description}
xxx:truncateOutput truncateAt=35 continuationMark=... /
/h:outputText

Here are all the pieces, if anyone want to package them up 
for contribution to tomahawk that would be great!
I don't have the time (or knowledge how) to do it right now.
 

TruncateConverter.java
--
public class TruncateConverter implements Converter, StateHolder
{
private int truncateAt = 0;
private String  continuationMark;
private boolean transientFlag;

public Object getAsObject(FacesContext context,
  UIComponent component,
  String value) throws ConverterException
{
// Should never happend - TruncateConverter is only usable for
output.
throw new AssertionError(getClass().getName()
+  does not support Input conversion.);
}

public String getAsString(FacesContext context,
  UIComponent component,
  Object value) throws ConverterException
{
if (value == null)
{
return null;
}

StringBuffer buff = new StringBuffer();
buff.append(value);

if (getTruncateAt()  0  buff.length()  getTruncateAt())
{
buff.setLength(getTruncateAt());
if (getContinuationMark() != null)
{
buff.append(getContinuationMark());
}
}

return buff.toString();
}

/**
 * @return Returns the continuationMark.
 */
public String getContinuationMark()
{
return continuationMark;
}

/**
 * @param continuationMark The continuationMark to set.
 */
public void setContinuationMark(String continuationMark)
{
this.continuationMark = continuationMark;
}

/**
 * @return Returns the truncateAt.
 */
public int getTruncateAt()
{
return truncateAt;
}

/**
 * @param truncateAt The truncateAt to set.
 */
public void setTruncateAt(int truncateAt)
{
this.truncateAt = truncateAt;
}

// STATE SAVE/RESTORE
public void restoreState(FacesContext facesContext, Object state)
{
Object[] values = (Object[]) state;
this.truncateAt = ((Integer) values[0]).intValue();

Re: tree2 and AjaxAnywhere

2006-04-11 Thread Andrew Robinson
My biggest issues were with a tree not being rendered, then having it rendered on a subsequent post. The problems were as follows:The 2 JS files were not includedfix: manually call the tomahawk API to add the two resources manually:
AddResource.addJavaScriptToHeader(HtmlTreeRenderer.class,  _javascript_/tree.js, context);AddResource.addJavaScriptToHeader(HtmlTreeRenderer.class,  _javascript_/cookielib.js, context);
Facelets was not able to set the correct parameters on the tree2 as tree2's tag's properties were not the same as the UI component attributes.Fix is posted on the MyFaces wiki about getting tomahawk to work with facelets
tree2 uses f:param support to identify nodes that are being expanded. This needs (in myfaces) input type=hidden / tags for each of those parametersfix: Wrap an ajax anywhere span around all those tags and scripts that are rendered by 
HtmlFormRenderer.java in MyFaces 1.1.1 (which involved some nice string parsing). I extended this renderer and buffered the output of the encodeBegin and encodeEnd and moved any hidden elements and any script tags into a span tag using the AAUtils functions to make sure it was rendered correctly.
After doing all that, it is working fine for me now. I never had a problem with the tree rendering though. It was just getting it to be able to post back correctly. AjaxAnywhere handles script tags specially when the request is an AJAX request. It parses out the script tags and then executes an eval on the JS client side. Best thing there is to just look into 
aa.js. Other than that, I'm not sure what could be your problem. Hard to say since you are not using the tree2 out of the box. -AndrewOn 4/11/06, 
Bill Schneider [EMAIL PROTECTED] wrote:
 I have it working with MyFaces 1.1.1 but had to do some work arounds (some messy). What does your XHTML (or JSP) looking like with the aa:zoneJSF and t:tree2 nodes? Let me know that and I'll see if I can
 help you out.I should point out that I am overloading the tree2 component with sometable function as well, like t:tree/t:treeColumn, as others havediscussed previously on this list.That may be the crux of the issue,
but I'm not exactly sure why it would break anything because the basictree2 functionality is the same; it just renders as table rows.Besides that, this should be fairly vanilla MyFaces/AjaxAnywhereintegration; I am putting the zoneJSF tag around my whole tree component:
aa:zoneJSF id=treeZone xxx:tree2Table ... h:column... h:commandLink  xxx:treeColumn...then later, I have a script to set up the zone and substitute for the
form submission function, since the tree is within a form with commandLinks.scriptajaxAnywhere.setZonesToRefresh = function() { return treeZone;}ajaxAnywhere.formName = myForm;
ajaxAnywhere.substituteFormSubmitFunction();ajaxAnywhere.substituteSubmitButtonsBehavior(true);/scriptIt appears to be making the request and receiving the response, but theresponse HTML looks 'cut off'.It appears to get as far as
script src="">and that's the end of it.debugging the response, I wonder if AjaxAnywhere is getting tripped upby the HTML comment immediately following that script tag (!-- \n //
--), because it is not showing the following reference to cookielib.jsthat I would expect either.-- Bill--Bill SchneiderChief ArchitectVecna Technologies5004 Lehigh Rd.
College Park, MD 20740[EMAIL PROTECTED]t: 240-737-1640f: 301-699-3180


RE: tag to truncate outputText?

2006-04-11 Thread Lindholm, Greg
-Original Message- From: Michael Heinen
 Now I'm really curious about your version and added it to my project.
 But I get the following error (see below) on a really simple page.

 Do you have any ideas?
 I am using MyFaces 1.1.1.

I'm also use MyFaces 1.1.1 with Tomcat 5.0.25.

I don't know what's causing the errors your getting.

The only changes I made to the code I posted was:
- changed the package to xxx
- removed the uri info from the TLD 
urihttp://xxx.xxx/xxx/uri
- I didn't show the taglib tag
%@ taglib prefix=xxx uri=http://xxx.xxx/xxx%
- I didn't show the TLD doctype (see below)


Ensure your xxx.tld is in WEB-INF and starts:

?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE taglib PUBLIC -//Sun Microsystems, Inc.//DTD JSP Tag Library
1.2//EN http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd;
taglib...



RE: I need to customize the dataScroller

2006-04-11 Thread Jesse Alexander \(KSFD 121\)



Hi

I think your description sounds like a nice 
component...

Templates ... or ... extending?
I don't know of any template... I usually look at existing 
components and how they are done.

Extending...
Check out the code for the datascroller... something tells 
me it could work...
shameless_plugand when the code is done: check out 
jsf-comp.sf.net /shameless_plug

regards
Alexander

  
  
  From: robinhoo 
  [mailto:[EMAIL PROTECTED] Sent: Sunday, April 09, 2006 10:56 
  PMTo: MyFaces DiscussionSubject: I need to customize the 
  dataScroller
  Hello All,I need to customize the data Scroller that are 
  t:dataScroller -- tomahawk's componentso that it 
  displays alphabetic instead of numbers and make other modifications like 
  formatting spaces between alphabetic and displaying all alphabet and 
  disabling the ones that are not returned in the results.for 
  example suppose that the returned data contains only names so I need to 
  display all characters and disabling the ones the are not returned in the 
  result. Also I'm wondering if I can develop my Owen components and how 
  to do this is there any standards or templates I should use like 
  implementing or extending interface/class ?best 
  regards,-- Ali Abd El Aziz Ali 


Empty h:inputText field is being submitted with value - Is that right???

2006-04-11 Thread Rafael Nami
Well, good evening everyone (here in Brazil is 18:30).I'm developing a web application using the Spring/Hibernate/JSF-MyFaces combo, and so far is being a silver bullet to me.Well, I have several search forms in my webapp, but when I submit a empty inputText, the value passed to the backing bean is the  value, and this is directly impacting in my backend, because I'm using Hibernate Criteria API for the search method. Is this conversion the right behavior? If it is, how can I convert this value to null??
Thanks in advanceRafael Mauricio Nami


Re: Empty h:inputText field is being submitted with value - Is that right???

2006-04-11 Thread Mike Kienenberger
On 4/11/06, Rafael Nami [EMAIL PROTECTED] wrote:
 when I submit a empty
 inputText, the value passed to the backing bean is the  value, and this is
 directly impacting in my backend, because I'm using Hibernate Criteria API
 for the search method. Is this conversion the right behavior? If it is,
 how can I convert this value to null??

In JSF 1.2, you will be able to register a StringConverter to change
the values from  to null.

For now, you have to handle this in your backend code.   Not sure how
it's done for Hibernate, but for Cayenne, I have a method that does
this on the BaseDataObject superclass for all of my entity classes.  
There's probably a way to do something similar in Hibernate.

public void writeProperty(String propName, Object value)
{
// Oracle can't handle empty strings, and JSF generates them
instead of nulls.
if ( (value instanceof String)  (0 == ((String)value).length()) )
super.writeProperty(propName, null);
else super.writeProperty(propName, value);
}


IllegalStateException when rapidly clicking tree2 component in Jetspeed portlet

2006-04-11 Thread Springer, Martin
Title: IllegalStateException when rapidly clicking tree2 component in Jetspeed portlet






We are using tree2 inside a Jetspeed portlet using the JSR-168 bridge. If we rapidly click on the commandLink in the tree2, we sometimes get the following exception in the console:

java.lang.IllegalStateException: Must be called before the start element is closed (attribute 'id')

...


The portlet shows this exception:


JetspeedRequestDispatcher failed to include servlet resources. (details below)

Exception: java.lang.IllegalStateException

Message: Must be called before the start element is closed (attribute 'width')


Stack Trace:

 org.apache.myfaces.renderkit.html.HtmlResponseWriterImpl.writeAttribute(HtmlResponseWriterImpl.java:325)

 org.apache.myfaces.renderkit.html.HtmlRendererUtils.renderHTMLAttribute(HtmlRendererUtils.java:487)




We can replicate this problem using the simple sample application if we add the portlet.xml to it.


This seems like a problem with the portlet lifecycle vs. the JSF lifecycle.


Has anyone else experienced this problem? If so, do you have a workaround?


Thanks,

Marty





commandLink vs. commandButton logic

2006-04-11 Thread Jan Zach
Hi everybody!

Whenever I use a commandLink in the same form along with the inputHtml 
component, the commandLink does not work but commandButton does.
I'm not able to figure out the difference from the generated html mess...
Does anybody else encounter this?

A similar poblem found when a dialog window is open (tree component in my case) 
but this happens just for the first access to that url. I' ve described it in 
thread jsf view init.

Thanks

Jan




MyFaces, Tiles and Renaming Elements

2006-04-11 Thread marqpdx

We have an issue trying to use Ajax with Tiles and MyFaces. 

Imagine:
f:subview id=content
  tiles:insert attribute=body flush=false/
/f:subview

Inside the body, there is an element id'd selectTable  - a lot of Ajax
depends on that ID being unchanged. But, tiles changes it to
content:selectTable

That messes up a lot of stuff.

Any way around that?? Any way to turn off that renaming of my elements by
Faces and Tiles???

Thanks,
m

--
View this message in context: 
http://www.nabble.com/MyFaces%2C-Tiles-and-Renaming-Elements-t1435144.html#a3872637
Sent from the MyFaces - Users forum at Nabble.com.



Re: MyFaces, Tiles and Renaming Elements

2006-04-11 Thread Mike Kienenberger
On 4/11/06, marqpdx [EMAIL PROTECTED] wrote:
 We have an issue trying to use Ajax with Tiles and MyFaces.

 Imagine:
 f:subview id=content
   tiles:insert attribute=body flush=false/
 /f:subview

 Inside the body, there is an element id'd selectTable  - a lot of Ajax
 depends on that ID being unchanged. But, tiles changes it to
 content:selectTable

 That messes up a lot of stuff.

 Any way around that?? Any way to turn off that renaming of my elements by
 Faces and Tiles???

content:selectTable comes from JSF and not from Tiles.

subview is a naming container, so anything enclosed in it is going to
be prefixed by content:

Do you really need a subview enclosing your insert?


Re: commandLink vs. commandButton logic

2006-04-11 Thread Mike Kienenberger
What version of JSF are you using?

What does your page code look like?


On 4/11/06, Jan Zach [EMAIL PROTECTED] wrote:
 Hi everybody!

 Whenever I use a commandLink in the same form along with the inputHtml 
 component, the commandLink does not work but commandButton does.
 I'm not able to figure out the difference from the generated html mess...
 Does anybody else encounter this?

 A similar poblem found when a dialog window is open (tree component in my 
 case) but this happens just for the first access to that url. I' ve described 
 it in thread jsf view init.

 Thanks

 Jan





Re: commandLink vs. commandButton logic

2006-04-11 Thread Jan Zach

I do not know the version I downloaded all jars about 1-1.5 month ago maybe I shoud mention that I use tiles also.

the code for htmlInput is

-
h:form

    t:div rendered=#{identity.admin  pgEditor.edit}

        h:commandButton actionListener=#{pgEditor.cancel} value=cancel/
       %-- commandLink does not work here --%

   t:inputHtml
    id=page_editor
    value=#{pgEditor.text}
    allowEditSource=true
    showPropertiesToolBox=false
    allowExternalLinks=true
    addKupuLogo=false
    showLinksToolBox=false
    showImagesToolBox=false
    showTablesToolBox=false
    showDebugToolBox=false
    showCleanupExpressionsToolBox=false
/

        h:commandButton
            image=/layout/img/flag/#{cmEditor.selectedLocale.name}.gif
            style=width:36px; height: 18px;
            actionListener=#{pgEditor.store}
        /
/h:form

---

and the tree in dialog:



html

f:view

    head
        script type=text/_javascript_
            function doSave(id, name, code)
            {
                var formId = window.openerFormId;
                var op = document.createElement(option);
                op.text = name;
                opener.document.forms[formId][formId + :srv-category].appendChild(op);
                var v = opener.document.forms[formId][formId + :srv-category_ids].value;
                v = (v == null || v.length == 0)? id: (v + , + id);
                opener.document.forms[formId][formId + :srv-category_ids].value = v;
                   window.close();
            }
        /script
    /head

    body

        h:form id=f_dir_category_tree_selector

            h:commandLink id=loc_expall  value=Expand All actionListener=#{dirEditor.category.expandAll}/

            t:tree2 id=category_tree value=#{dirEditor.category.treeData}
                    var=node
                    varNodeToggler=t clientSideToggle=false binding=#{dirEditor.category.tree}

                f:facet name=root
                    h:panelGroup
                        h:graphicImage value=/cc/img/files_box.gif width=20px height=20px  /
                    /h:panelGroup
                /f:facet

                f:facet name=0
                    h:panelGroup
                        t:graphicImage value=/layout/img/icon/yellow-folder-open.png rendered=#{t.nodeExpanded} border=0/
                        t:graphicImage value=/layout/img/icon/yellow-folder-closed.png rendered=#{!t.nodeExpanded} border=0/

                        h:panelGroup
                            z:commandLink id=edit_cat_0  '#{node.description}');
                                h:outputText value=#{node.description} styleClass=nodeFolder/
                            /z:commandLink
                        /h:panelGroup

                    /h:panelGroup
                /f:facet

            /t:tree2

        /h:form

    /body

/f:view

/html

--

the dialog is open like:

    function doCategoryPopup(source)
    {
        popup = window.open(/cc/page/category.jsf, Select Category, scrollbars=yes,toolbar=no,menubar=no,location=no,width=400,height=500,modal,dialog,minimizable=false,top);
        popup.openerFormId = source.id.substring(0, source.id.lastIndexOf(:));
        popup.focus();
    }




__
 Od: [EMAIL PROTECTED]
 Komu:  MyFaces Discussion users@myfaces.apache.org
 CC:  
 Datum: 12.04.2006 01:38
 Předmět: Re: commandLink vs. commandButton logic

  What version of JSF are you using?
 
 What does your page code look like?
 
 
 On 4/11/06, Jan Zach <[EMAIL PROTECTED]> wrote:
  Hi everybody!
 
  Whenever I use a commandLink in the same form along with the inputHtml
 component, the commandLink does not work but commandButton does.
  I'm not able to figure out the difference from the generated html
 mess...
  Does anybody else encounter this?
 
  A similar poblem found when a dialog window is open (tree component in
 my case) but this happens just for the first access to that url. I' ve
 described it in thread jsf view init.
 
  Thanks
 
  Jan
 
 
 
 



Re: File upload problem - setFile( ) never called, please help!

2006-04-11 Thread Murray Brandon
I added an h:messages/ tag and there are none - I haven't plugged in 
any validation yet anyway.
I redid a clean example (ie. vanilla myfaces/tomahawk) to be sure I 
wasn't wasting your time. ;-)


!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;


html xmlns=http://www.w3.org/1999/xhtml;
 xmlns:f=http://java.sun.com/jsf/core;
 xmlns:h=http://java.sun.com/jsf/html;
 xmlns:ui=http://java.sun.com/jsf/facelets;
 xmlns:c=http://java.sun.com/jstl/core;
 xmlns:t=http://myfaces.apache.org/tomahawk; 
 xmlns:afh=http://xmlns.oracle.com/adf/faces/html;

 xmlns:af=http://xmlns.oracle.com/adf/faces;
   

   ui:composition id=fu
   h:form id=fu3 name=form1 enctype=multipart/form-data 
   h:outputText id=fu4 value=Please give me an image/
   t:inputFileUpload id=fileupload
  accept=image/*
  value=#{myModel.file}
  storage=file
  required=true/
   h:commandButton id=fu5 value=Upload Now! 
action=#{myModel.doUpload} /

   /h:form
   h:messages/

   /ui:composition
/html

From my console (my own phase listener debug):

=== phase RESTORE_VIEW(1)===
=== phase APPLY_REQUEST_VALUES(2)===
=== phase PROCESS_VALIDATIONS(3)===
=== phase UPDATE_MODEL_VALUES(4)===
=== phase INVOKE_APPLICATION(5)===
MyModel 1
MyModel 3 null

My full model class is as below:

/*
* Created on Feb 13, 2006
*/
package com.playpen.ncs.aui.model;

import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.event.AbortProcessingException;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;

import org.apache.myfaces.custom.fileupload.UploadedFile;

/**
* @author Murray
*/
public class MyModel
{
   private UploadedFile _file;   
  
   public void processAction(ActionEvent e) throws AbortProcessingException

   {
   System.out.println(MyModel: triggered with processAction 
event= + e.getComponent().getId());

   }

   /**
* To support file upload
* @param event
*/
   public void fileUploaded(ValueChangeEvent event)
   {
   System.out.println(MyModel 0);
   UploadedFile file = (UploadedFile)event.getNewValue();
   if (file != null)
   {
   System.out.println(MyModel fileUploaded called with a file);
   FacesContext context = FacesContext.getCurrentInstance();
   FacesMessage message = new FacesMessage(Successfully 
uploaded file  + file.getName() +  ( + file.getSize() +  bytes));
   
context.addMessage(event.getComponent().getClientId(context), message);

   // Here's where we could call file.getInputStream()
   }
   else
   {
   System.out.println(MyModel fileUploaded called with no file);
   }
   }
  
   public UploadedFile getFile()

   {
   System.out.println(MyModel 1);
   return _file;
   }

   public void setFile(UploadedFile file)
   {
   System.out.println(MyModel 2);
   _file = file;
   }

   public String doUpload()
   {
   UploadedFile file = getFile();
   System.out.println(MyModel 3  + file);
   // ... and process it in some way
   return (file != null ? file.getName() : null);
   }
}



enctype=multipart/form-data not persisting text fields back into my model.

2006-04-11 Thread Murray Brandon
I have a simple h:form with a single h:inputText component inside it 
with value={#bean.property} and a
h:commandButton actionListener=#{bean.processAction}... to submit the 
form.


It works great, setting the value of {#bean.property}to whatever text I 
enter on submit of the form.


However, if I change ONLY the form encoding type to be 
multipart/form-data, the bean.property never gets set.

What gives?  Do I have to do something special for multipart form submits?

Regards, Confused



Re: Newbie help - Java script to submit on accessing commandLink

2006-04-11 Thread JSFSter Smith
Hi,

Thanks for your responses! Adding the preserveDataModel=true did
solve the commandLink problem inside the dataTable and I did not have
to go the session bean route. I

I am still having problems with the _javascript_ to trap the enter
key to submit the form using when a h:commandLink is clicked. I tried
setting the forceID attribute (in an earlier version) as well as using
the id explicitly in the _javascript_. 

My _javascript_ :
 function trapEnter(evt) {
var keycode;
 if (evt)
 ;
 else if (window.event)
 evt = window.event;
 else if (event)
   evt = event;
 else
 return true;

 if (evt.charCode)
 keycode = evt.charCode;
 else if (evt.keyCode)
 keycode = evt.keyCode;
 else if (evt.which)
 keycode = evt.which;
 else
 keycode = 0;

 if (keycode == 13) {
 document.forms['myJSFForm'].elements['myJSFForm:searchLink'].click();
 return false;
 }
 else
 return true;
}

and my form is as follows:
 body >
 f:view

f:loadBundle basename=ifmessages var=msgs/
 h:form id=myJSFForm
 h:panelGrid
 h:panelGroup styleClass=bookSearchPanel

h:inputText id=searchText value=#{searchMain.searchTerm} /


t:commandLink forceId=searchLink
action="">

h:graphicImage value=/images/submit.gif/

/t:commandLink

/h:panelGroup
 -


 /h:form

The keypress event is trapped and I tested it using alerts. Is there anything I am missing here?

thanks,

Rajiv
On 11/04/06, Volker Weber [EMAIL PROTECTED] wrote:
Hi Rajiv,1: The model must the same on render and restore phase, afaik you can force this by using preserveDataModel=true on t:datatable. Or you can use the t:saveState tag see: 
http://myfaces.apache.org/tomahawk/uiSaveState.html3: the html ids are created by prefixing component ids with the ids of namingcontainer components you should use sommething like 
document.forms['MyJSFForm'].elements['MyJSFForm:submitLink'].click() or document.getElementById('MyJSFForm:submitLink').click() Take a look into the generated html source if unclear about the
 generated id of the link.Regards,VolkerJSFSter Smith wrote: Hi, I have just started using MyFaces for a new project and had a couple of questions while I am on the learning curve. Any help/response is greatly
 appreciated.Its been a pleasure to actually createJSP pages with no java code using JSF in them and I hope to keep them that way! 1. h:commandLink tag does not work inside a t:dataTable tag
and ends up refreshing the same page from where the link was clicked without any updates to the model. The get/setmethods for the corresponding backing bean member are never called by the framework
 I looked through the mail archives for myFaces as well as JSF RI. This seems to be an issue faced by many users and the suggested work around is to make the backing bean that contains the table data a session bean (currently
 mine is a request). Is this a bug with the spec or am I missing something ? 2. h:commandButton with a request scope backing bean cannot be used to pass request parameters to the next page using f:param tags.
 The h:commandLink tag has to be used instead. Again is this a bug or I am missing something? Currently, I am using h:commandLinks formy request param passing and it works fine. But this leads me to my final question:
 3. I am trying to map the enter key to my command link (which is an image) using _javascript_ and have included a snippet below.if (keycode == 13) {document.forms
['MyJSFForm'].elements['submitLink'].click() return false; } I have explicitly given id's to my form and commandLink. The _javascript_ object for the link is invalid
 Thanks in advance for your response! - Rajiv--Don't answer to From: address!Mail to this account are droped if not recieved via mailinglist.To contact me direct create the mail address by
concatenating my forename to my senders domain.