Re: JSF Chart Creator and JSF Client Side Validators

2006-01-12 Thread Kurt Edegger

Hi,

I'd like to use the chart creator component in one of my JSF applications. I 
followed the installation steps in the manual[1] and copied the jars to the /lib 
folder.
I followed the example in the manual, but when my jsf page is rendered, I just 
get a broken image icon and a NullPointerException[2] in the log file.


Any pointers? Any help really appreciated!

Thanks and by the way, there's an upper/lowercase typo in the manual.
Installation: step3: the component-type should be chartCreator not 
chartcreator, right?


Enjoy,

Kurt

[1] http://www.jroller.com/resources/c/cagataycivici/manual.jar

[2] Here's the detailed trace:
ERROR: Servlet.service() for servlet ChartWriter threw exception (2006-01-12 
10:47:48,578 
http-8080-Processor25_org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sakai-ecgviewer-tool].[ChartWriter])

java.lang.NullPointerException
at chartcreator.ChartWriter.doGet(ChartWriter.java:83)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
	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.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 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
	at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
	at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
	at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)




Re: Tree2 startup Question-

2006-01-03 Thread Kurt Edegger

Matias,

I'm not _the_ expert as well, but can't you use the body onload to execute the 
backing bean methode to expand the tree.
Or could a hidden input field at the bottom of the page to which you bind a 
method that handles the logic deal with it?


Kurt

on 1/3/2006 4:57 AM Matias Gomez Carabias stated:

Kurt, thanks for your reply. The htmlTree is already bound to the
component. What I mean is when should I call the expandAll(), cuz I only
want to show it expanded when the page loads for the first time, after
that, I want the tree to be expanded or collapsed by the client.

Thanks a lot

Matias



-Original Message-
From: Kurt Edegger [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 02, 2006 6:15 PM

To: MyFaces Discussion
Subject: Re: Tree2 startup Question-

Hi Matias,

Happy New Year to you as well.
To show the tree2 expanded bind a htmlTree to the component. With this
you can 
use htmlTree.expandAll() to show the tree completely expanded.


Hope that helps.

Kurt

on 1/2/2006 5:46 AM Matias Gomez Carabias stated:

Hi guys, first of all happy new year. 


Here's my question, is there anyway to show the tree2 expanded the


first


time. I mean the tree expanded only when the page loads, after that,


the

behavior should be as usual. 

Thanks a lot 


Matias









Re: Tree2 startup Question-

2006-01-02 Thread Kurt Edegger

Hi Matias,

Happy New Year to you as well.
To show the tree2 expanded bind a htmlTree to the component. With this you can 
use htmlTree.expandAll() to show the tree completely expanded.


Hope that helps.

Kurt

on 1/2/2006 5:46 AM Matias Gomez Carabias stated:
Hi guys, first of all happy new year. 


Here's my question, is there anyway to show the tree2 expanded the first
time. I mean the tree expanded only when the page loads, after that, the
behavior should be as usual. 

Thanks a lot 


Matias






Re: Popup calendar javascript - loadPopupScript not defined

2005-12-21 Thread Kurt Edegger
Hi,

thank you for the idea. I followed the thread discussing that the extension
filter needs a head or body tag to be able to add the neccessary
javaScripts.
I do indeed work with a non standalone JSF application, but it's not in a
portal
environment. The thing is called Sakai and is a sort of classroom management
software using frames.
I did check the rendered response and there are proper body and head tags
and additionally there are some javaScript extensionFilter entries defined.
Just to show two examples:

script type=text/javascript
src=/sakai-ecgviewer-tool/faces/myFacesExtensionResource/tree2.HtmlTreeRenderer/11302665/javascript/cookielib.js

script type=text/javascript!--
jscalendarMonthName = new
Array(January,February,March,April,May,June,July,August,September,October,November,December);jscalendarMonthName2
= new
Array(January,February,March,April,May,June,July,August,September,October,November,December);jscalendarDayName
= new Array(Sun,Mon,Tue,Wed,Thu,Fri,Sat);jscalendarStartAt = 0;
jscalendarTodayString = Today is: ;
jscalendarWeekString = Wk;
if (!document.layers) {
document.write('img
src=/sakai-ecgviewer-tool/faces/myFacesExtensionResource/calendar.HtmlCalendarRenderer/11302665/images/calendar.gif
style=vertical-align:bottom;
onclick=jscalendarPopUpCalendar(this,document.getElementById(\'dateOfDiagnosisForm:_id63\'),\'M/d/yy\')
/');
}
//--/script

Take care,

Kurt

Quoting CD [EMAIL PROTECTED]:

 Hi Kurt,
 
 Are you working in a portal environment perhaps?  I don't think that has any
 bearing on the issue I'm dealing with as you are getting the same problems I
 am, but it would be comforting to know :)
 
 
 On 12/21/05, Kurt Edegger [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I posted the same issue couple of weeks ago and couldn't resolve it. I'm
  still
  stuck with an JavaScript error: jscalendarPopUpCalendar is not defined
 
  I do have the extensionsFilter declared in my web.xml, both mapped to
  /faces/*
  and *.jsf as shown by this snipplet of my web.xml:
 
  filter
  filter-nameMyFacesExtensionsFilter/filter-name
  filter-class
  org.apache.myfaces.component.html.util.ExtensionsFilter
  /filter-class
  init-param
  param-namemaxFileSize/param-name
  param-value20m/param-value
  /init-param
  /filter
 
  filter-mapping
 filter-nameMyFacesExtensionsFilter/filter-name
 url-pattern*.jsf/url-pattern
  /filter-mapping
  filter-mapping
 filter-nameMyFacesExtensionsFilter/filter-name
 url-pattern/faces/*/url-pattern
  /filter-mapping
 
  servlet
  servlet-nameFaces Servlet/servlet-name
  servlet-classjavax.faces.webapp.FacesServlet/servlet-class
  load-on-startup2/load-on-startup
  /servlet
 
  servlet-mapping
  servlet-nameFaces Servlet/servlet-name
  url-pattern*.jsf/url-pattern
  /servlet-mapping
 
  It seems that some javaScripts are not loaded in the head or body of the
  page.
 
  Thanks for any help!
 
  Kurt
 
 
 






Re: Popup calendar javascript - loadPopupScript not defined

2005-12-21 Thread Kurt Edegger
Hi,

nope this didn't work. No change at all - same problem .. 

Thank you,

   Kurt

Quoting [EMAIL PROTECTED] [EMAIL PROTECTED]:

 Kurt Edegger [EMAIL PROTECTED] wrote on 12/21/2005 01:18:05 PM:
 
  Hi,
  
  I posted the same issue couple of weeks ago and couldn't resolve it.I'm 
 still
  stuck with an JavaScript error: jscalendarPopUpCalendar is not defined
  
  I do have the extensionsFilter declared in my web.xml, both mapped to 
 /faces/*
  and *.jsf as shown by this snipplet of my web.xml:
 
 Map the filter to *.faces also, and check..?
 
 
  Thanks for any help!
  
Kurt
  
 
 Geeta
 






Re: How to get currently selected node of tree2 component

2005-12-20 Thread Kurt Edegger

Hi Hans,

thank you for this hint! This looks like somethink that should work. The 
question is only, why the HtlmTree.getNode() is reset anyway after the 
listener. But I think this is out of scope for now.
How did you find out about this updateActionListener? I just found the 
JavaDoc entry after you pointed this listener out to me. Additional the 
doc is not very descriptive in terms of functionality.


Again, thank you very much!

Take care,

Kurt


h:inputTextarea bug?

2005-12-20 Thread Kurt Edegger

Hi everyone,

I ran into a problem by using the inputTextarea component of myfaces-1.1.1.
I simply like to display some editable text by adding

h:inputTextarea id=patientHistory rows=#{configBean.patientHistoryHeight} 
cols=#{configBean.patientHistoryWidth} value=#{bean.patientHistory}/

to my jsp page. The application crashed with an ClassCastException [1] while 
retrieving the attribute cols for the tag.
The two methods configBean.getPatientHistoryHeight and configBean.getPatientHistoryWidth are 
returning two Strings like 10 and 40 respectively. I double checked this by 
adding

h:outputText value=#{configBean.patientHistoryHeight}/ by
h:outputText value=#{configBean.patientHistoryWidth}/

to my page, which renders properly showing: 10 by 40

If I replace the value bindings for rows and cols by actual numbers, the 
application works fine.

Any ideas why I can't use value bindings, which are returning string values, 
with the inputTextarea component??

Thank you for your help in advance,

Kurt

[1] here's the shortened stacktrace:
javax.faces.FacesException: Could not get property rows of component 
buttonform:patientHistory
 at 
javax.faces.component._ComponentAttributesMap.getComponentProperty(_ComponentAttributesMap.java:226)
 at 
javax.faces.component._ComponentAttributesMap.get(_ComponentAttributesMap.java:128)
[...snip...]
Caused by: java.lang.reflect.InvocationTargetException
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:324)
 at 
javax.faces.component._ComponentAttributesMap.getComponentProperty(_ComponentAttributesMap.java:221)
 ... 71 more
Caused by: java.lang.ClassCastException
 at 
javax.faces.component.html.HtmlInputTextarea.getRows(HtmlInputTextarea.java:321)
 ... 76 more
ERROR: Servlet.service() for servlet Faces Servlet threw exception (2005-12-20 
16:22:44,156 
http-8080-Processor24_org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sakai-ecgviewer-tool].[Faces
 Servlet])
javax.faces.FacesException: Could not get property rows of component 
buttonform:patientHistory
 at 
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
 at 
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
 at 
org.sakaiproject.jsf.app.SakaiViewHandler.renderView(SakaiViewHandler.java:140)
[...snip...]
Caused by: org.apache.jasper.JasperException: Could not get property rows of 
component buttonform:patientHistory
 at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
[...snip...]
ERROR: Servlet.service() for servlet sakai.ecgviewer.tool threw exception 
(2005-12-20 16:22:44,171 
http-8080-Processor24_org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/sakai-ecgviewer-tool].[sakai.ecgviewer.tool])
javax.faces.FacesException: Could not get property rows of component 
buttonform:patientHistory
 at 
org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:421)
 at 
org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:234)
 at 
org.sakaiproject.jsf.app.SakaiViewHandler.renderView(SakaiViewHandler.java:140)
[...snip...]
Caused by: org.apache.jasper.JasperException: Could not get property rows of 
component buttonform:patientHistory
 at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:370)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
[...snip...]



Re: How to get currently selected node of tree2 component

2005-12-19 Thread Kurt Edegger

Hi Daniel,

thank you for your answer. That's probably a better way than using 
another bean property to store the selected node in the listener. But 
why and when is the tree.getNode() reset? If you set the node 
explicitely by tree.setNodeSelected(evt) is this persistent until the 
next node is selected?


Thank you again and sorry for the late response,

Kurt

on 12/14/2005 2:53 AM Lefevre, Daniel stated:

Hello,

My (short) experiences shows that the getNode() method returns the node
which is selected in the htmlTree. Then the getNode() method returns the
selected node only in your selection event or via the htmlTree, when you
have set it explicitely.

What I do is as follows:
- in my selectNode method (actionListener), I take the selectedNodeId
and set the selected node of the htmlTree.

public void selectNode(ActionEvent event)
{
// set the selected status on the node of the tree
htmlTree.setNodeSelected(event);
selectedNodeId = htmlTree.getNodeId();
}

- in the other actionListeners, I access the selected node by using the
selectedNodeId.

public void addNode(ActionEvent event)
{
// get access to the selected node 
htmlTree.setNodeId(selectedNodeId);

MyTreeNode node = ((MyTreeNode) treeModel.getNode());
.
.
.
}

The used variables being declared as follows (with getters and setters
of course):

private TreeModel   treeModel;
private transient HtmlTree  htmlTree;

private MyTreeNode  selectedNode;
private String  selectedNodeId;

This is maybe not THE solution, but it works.
Hope this helps,

Bye, Dan






Re: Newbie actionListener attribute question

2005-12-15 Thread Kurt Edegger

Hi,

but with f:actionListener type=class you can only specify a class 
implementing the ActionListener interface, right? It's not possible to 
register a '#{beanName.methodName}' as asked by Saumil in the first posting.


Best regards,

Kurt

on 12/15/2005 4:06 AM Hans Sowa stated:

Hi

You can use more than 1 actionListener:

h:commandLink
   h:outputText value=dummy/
   f:actionListener type=blalbla /
   f:actionListener type=blalbla /
/h:commandLink

Instead of using the attribute actionListener use the tag actionListener.

best regards Hans

2005/12/15, Saumil Mehta [EMAIL PROTECTED]:


Quick question - is it possible to attach more than one action listener
method to a commandLink component using the JSF EL? Effectively, could I
do something like this?

h:commandLink actionListener=#{EL gobbledygook here}
   h:outputText value=dummy/
/h:commandLink

I have two separate backing beans that provide separate functionality
when the *same* ActionEvent fires. It seems reasonable to allow more
than one listener on an event, I just don't know how to write the JSF
expression for it, and documentation on the EL that I've found so far
doesn't discuss this. Obviously, I know how to write expressions to
register one listener with #{beanName.methodName}.

Any clues?

Thanks so much in advance for your time and help.

Regards,
Saumil Mehta






--
mfg Hans Sowa
mailto:[EMAIL PROTECTED]





Re: Object/Embed JSF component request

2005-12-15 Thread Kurt Edegger

Hi Darren,

I was looking for such a component to be able to embed SVG graphics in a 
faces page eg. with the embed tag . I did some research but couldn't 
find any ready to use components, so I looked into implementing own 
components.
It was pretty much straight forward to implement a custom component 
functioning as embed tag [1] with the attributes src, width, height, 
pluginspage, and type.
If you would like to use this tag, I'll could provide you with the 
sources. But bear in mind, that this is just a code snipplet I coded on 
the way within a project. I can't take any responsibilities if you use 
the code ;)


Take care,

Kurt

[1] e:embed src=#{bean.propertySrc} width=#{bean.propertyWidth} 
height=#{bean.propertyHeight} 
pluginspage=#{bean.propertyPluginsPage} 
type=#{bean.propertyType}/e:embed




How to get currently selected node of tree2 component

2005-12-14 Thread Kurt Edegger

Hi,

I'm having another issue with my tree2 component.
I'm using a TreeModelBase field to be able to access the currently 
selected node within my backing bean, which should be possible regarding 
to the Javadocs by using the method getNode().


I have a page with a tree2 component, from which I can select a node and 
this node is highlit according to the css styles.
If I invoke a method in the backing bean where the tree2 is hosted as 
well by pressing an commandButton, I don't get any values for 
TreeModelBase.getNode().
The value remains 'null' regardless if a node is selected in the tree or 
not.


I attached an ActionListener to the nodes and when this is invoked, the 
TreeModelBase.getNode() method is actually returning the currently 
selected node (which has triggered the listener).


I have verified that I'm dealing with the same instance of the bean with 
a debugger and they are indeed the same.


Why can't I access the currently selected node in the backing bean 
though in the action listener?
I don't have any validators attached to the component and also a generic 
h:messages/ in the same jsp page doesn't print any errors.


Any thoughts? What would be the best practise to access the currently 
selected node?


Thanks for any help,

Kurt



How to get currently selected node of tree2 component

2005-12-13 Thread Kurt Edegger

Hi,

I'm having another issue with my tree2 component.
I'm using a TreeModelBase field to be able to access the currently 
selected node within my backing bean, which should be possible regarding 
to the Javadocs by using the method getNode().


I have a page with a tree2 component, from which I can select a node and 
this node is highlit according to the css styles.
If I invoke a method in the backing bean where the tree2 is hosted as 
well by pressing an commandButton, I don't get any values for 
TreeModelBase.getNode().
The value remains 'null' regardless if a node is selected in the tree or 
not.


I attached an ActionListener to the nodes and when this is invoked, the 
TreeModelBase.getNode() method is actually returning the currently 
selected node (which has triggered the listener).


I have verified that I'm dealing with the same instance of the bean with 
a debugger and they are indeed the same.


Why can't I access the currently selected node in the backing bean 
though in the action listener?
I don't have any validators attached to the component and also a generic 
h:messages/ in the same jsp page doesn't print any errors.


Any thoughts? What would be the best practise to access the currently 
selected node?


Thanks for any help,

Kurt



Re: StartupServletContextListener crashes Tomcat container

2005-12-08 Thread Kurt Edegger

Jeff,

the error message just say that the exception occured in 
FacesServler.service but doesn't tell you anything about the reason.
If you'd like to find out, you have to look into tomcat's log file for 
some stacktrace telling you what caused the crash.


But anyway, since you are having trouble to get the whole JSF thing 
running, I'd recommend you to give it a fresh start and look into one of 
the different tutorials or quickstart applications like Equinox or 
AppFuse. You can find them at https://equinox.dev.java.net/ and 
https://appfuse.dev.java.net/ respectively.
Once these apps are running, you know your setup is fine and can start 
developing your own application.


Hope that helps,

Kurt

on 12/8/2005 7:57 AM [EMAIL PROTECTED] stated:

Kurt,

Thanks for your response. I had unzipped the file in the wrong place.

I have followed the instructions in the two links you sent me and have
conquered this problem to arrive at another one, which may or may not
be related. With the following JSP code


%@ page contentType=text/html %
%@ taglib uri=http://java.sun.com/jsf/html; prefix=h %
%@ taglib uri=http://java.sun.com/jsf/core; prefix=f %

f:view
   h:form
 From: h:inputText size=8 /
   /h:form
/f:view


I get the following error
javax.servlet.ServletException:
org/apache/commons/el/ExpressionEvaluatorImpl
javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)

The difference (and source of joy) is that now I am at least getting this
in the browser instead of in the startup panel in Tomcat.
My web.xml file is still as below and my newly cleaned lib directories are

common\lib
  jasper-compiler-jdt.jar
  jasper-compiler.jar
  jasper-runtime.jar
  jsp-api.jar
  naming-factory-dbcp.jar
  naming-factory.jar
  naming-resources.jar
  sample_app_1_0_2.jar
  servlet-api.jar
  standard.jar

sample\WEB-INF\lib
  commons-beanutils.jar
  commons-collections.jar
  commons-digester.jar
  commons-el.jar
  commons-logging.jar
  custom_jsf_lib_1_0_2.jar
  jstl.jar
  myfaces-all.jar
  myfaces-api.jar
  myfaces-impl.jar
  struts.jar


Is this error still connected to the ServletContext problem from before?

Thanks again
Jeff





Message from Kurt Edegger [EMAIL PROTECTED] received on 12/07/2005
06:24 PM
|+--+
||  ||
||  12/07/2005  ||
||   06:24 PM   ||
||  ||
||  ||
|+--+
  
|
  | 
   |
  |Kurt Edegger [EMAIL PROTECTED] 
   |
  | 
   |
  |Please respond to MyFaces Discussion users@myfaces.apache.org
   |
  |Sent by Kurt Edegger [EMAIL PROTECTED] 
   |
  
|

|---
|   |
|   |
|---
  
---|
  | 
  |
  |  To:   MyFaces Discussion users@myfaces.apache.org, Jeff 
Mullen/USCRC/[EMAIL PROTECTED]   |
  |  cc:
  |
  |  Subject:  Re: StartupServletContextListener crashes Tomcat container   
  |
  
---|



Hi,

please make sure that you inluded the myfaces libraries to your webapp,
since
they are not in your common\lib.
The following links explain how to get started with myfaces (which is just
an
implementation of JSF):

http://wiki.apache.org/myfaces/Installation_and_Configuration
http://wiki.apache.org/myfaces/Getting_Started

Take care,

   Kurt

Quoting [EMAIL PROTECTED] [EMAIL PROTECTED]:



Greetings

I just joined this list tonight, as I have only started messing around
witth Java Server Faces and Tomcat.
I am working through some tutorials very slowly and I seem to be able to
work

Re: tree2 and the icons

2005-12-08 Thread Kurt Edegger

Hi

on 12/8/2005 7:07 AM Sean Schofield stated:

Tree2 isn't really doing anything with your images.  It's just a
container for other JSF components and they get rendered in the normal
way.  It shouldn't be any different then putting a GIF image in a
h:dataTable.


ack!
I'm exclusively using png images and still encounter the same issue 
described. The folders are closed befor the tree is expanded the first 
time. But after a node has been expanded once, the icon doesn't toggle 
back to the closed one.
I do have the filters installed, but my images are located in a 
different location than the jsp file.


Kurt


Re: h:selectOneMenu question

2005-12-08 Thread Kurt Edegger

Simon,

unfortunately they don't have the sources published directly on this 
site but provide the jar file 
(http://www.exadel.com/tutorial/jsf/misc/jsftags-guide.jar)

to download.
Let me post the carBean class to show that 'carBean.currentCar' accesses 
the SelectItem directly [1]:


public class CarBean {

  ArrayList car = new ArrayList();
  ArrayList carList = new ArrayList();

  SelectItem currentCar;

  public CarBean()  {

carList.add(new SelectItem(accord,Honda Accord,Honda Accord - 
sedan));
carList.add(new SelectItem(4runner,Toyota 4Runner,Toyota 
4Runner - suv));
carList.add(new SelectItem(nissan-z,Nissan Z350,Nissan Z350 - 
sports));

  }

  //[1] carBean.currentCar accesses SelectItem
  public SelectItem getCurrentCar () {
 return new SelectItem(nissan-z,Nissan Z350,Nissan Z350 - 
sports);

  }

  public void setCurrenteCar (SelectItem item) {
 currentCar = item;
  }

  public Object[] getCar() {
  return car.toArray();
  }

  public void setCar(Object[] newCar) {

int len=0;
if (null == newCar || ( len = newCar.length)==0 ) {
  return;
}
car.clear();
car = new ArrayList(len);
for ( int i=0;ilen;i++) {
  car.add(newCar[i]);
}
  }
  public ArrayList getCarList() {
  return this.carList;
  }

  public void setCarList(ArrayList _carList) {
 this.carList = _carList;
  }
}


Regards,

Kurt


on 12/8/2005 12:38 PM Simon Kitching stated:

[EMAIL PROTECTED] wrote:


Simon,

thank you for your answer, I modified the getter/setter to handle
SelectItem.getValue().toString() instead of the selectItem itself.
But had you ever the chance to take a look at the jsftags-guide examples
(http://www.exadel.com/tutorial/jsf/jsftags-guide.html)?
They are using the SelectItems directly. Where's the difference?




The page shows this example:

h:selectOneMenu id=selectCar
 value=#{carBean.currentCar}
  f:selectItems
   value=#{carBean.carList} /
/h:selectOneMenu

But where does it say what datatype method getCurrentCar is returning?
I would think it returns String, eg accord.

And likewise, I would expect setCurrentCar to take a String parameter, 
which will be one of accord, 4runner, nissan-z depending on what 
the user chooses.



Regards,

Simon




Re: h:selectOneMenu question

2005-12-08 Thread Kurt Edegger

Hi Simon,

the exadel example jar actually runs without any problems and I don't 
see any custom converter configured.
I don't know why this is the case, this was the reason for starting this 
thread anyway ;)
I modified my classes to handle Strings in the getter and setters and 
now it works.
I still would like to know why the exadel example handles 
javax.faces.model.SelectItem directly.


Regards,

Kurt

on 12/8/2005 2:36 PM Simon Kitching stated:

Simon Kitching wrote:


Kurt Edegger wrote:



Let me post the carBean class to show that 'carBean.currentCar' 
accesses the SelectItem directly [1]:




Hmm..interesting. Thanks for posting that.


However I can't see any Converter class in MyFaces that is capable of 
doing String-SelectItem conversion. The Converter methods do get 
passed the associated UIComponent, so potentially such a converter 
could access its parent component in order to iterate over its child 
SelectItem objects.


It must be possible, as the example jar clearly does it. However I 
can't figure out *how* the UISelectOneMenu can use a value-binding 
dealing in SelectItem instances. I'd be very happy if someone could 
explain!


Of course, specifying the value binding as a primitive property 
(String/int/etc) works fine.



Looking at the official Sun javadoc for the SelectItem class, the 
getValue() method is defined as follows:


quote
Return the value of this item, to be delivered to the model if this item 
is selected by the user.

/quote


This sure implies that the value attribute of the enclosing 
t:selectOneMenu should point to a property that takes objects of the 
same type as is returned by SelectItem.getValue(), rather than taking a 
complete SelectItem instance.


The MyFaces examples dir has selectbox.jsp, whose backing bean is 
class CarConfigurator.java. This example always maps the select 
component's value attribute to primitive properties, eg

 public String getCar();
 public int getDoors();

Does the exadel example jar actually run?

Cheers,

Simon




h:selectOneMenu question

2005-12-07 Thread Kurt Edegger
Hi everybody,

I'd like to use a dropdown menu in my jsp page, therefor I added 

h:selectOneMenu id=selectModifier value=#{bean.currentItem}
  f:selectItems value=#{bean.itemList} /
/h:selectOneMenu 

to my page. The bean provides getter and setters for both properties, whereby
currentItem is of type SelectItem and itemList is an ArrayList containing
SelectItems. 

Just a static example copied from jsftags-guide into my bean class:

private SelectItem currentItem;

private ArrayList itemList;


public SelectItem getCurrentItem() {
  return new SelectItem(4runner,Toyota 4Runner,Toyota 4Runner - suv);
}

public void setCurrentItem(SelectItem currentItem) {
  this.currentItem = currentItem;
}

public ArrayList getItemList() {
  this.itemList=new ArrayList();
  this.itemList.add(new SelectItem(accord,Honda Accord,Honda Accord -
sedan));
  this.itemList.add(new SelectItem(4runner,Toyota 4Runner,Toyota 4Runner -
suv));
  this.itemList.add(new SelectItem(nissan-z,Nissan Z350,Nissan Z350 -
sports));
  return itemList;
}

public void setItemList(ArrayList itemList) {
  this.itemList = itemList;
}

But whenever I try to render the page, I'll get an
'java.lang.IllegalArgumentException: Value is no String and component
treetestformdb:selectModifier does not have a Converter' Exception.
IMHO the returned SelectItem should be rendered as a String automatically
without the need to attach a custom converter.

What am I'm missing here? I'm banging my head for an hour now,

Kurt





Re: StartupServletContextListener crashes Tomcat container

2005-12-07 Thread Kurt Edegger
Hi,

please make sure that you inluded the myfaces libraries to your webapp, since
they are not in your common\lib.
The following links explain how to get started with myfaces (which is just an
implementation of JSF):

http://wiki.apache.org/myfaces/Installation_and_Configuration
http://wiki.apache.org/myfaces/Getting_Started

Take care,

   Kurt

Quoting [EMAIL PROTECTED] [EMAIL PROTECTED]:

 Greetings
 
 I just joined this list tonight, as I have only started messing around
 witth Java Server Faces and Tomcat.
 I am working through some tutorials very slowly and I seem to be able to
 work the JSP side of things
 fairly well, but I cannot get Java Server Faces to work at all. I will skip
 the tortuous details of how I got
 to this point and simply say that I get the following error when I try to
 add the StartupServletContextListener
 to the web.xml file
 
 
 Dec 7, 2005 4:48:43 PM org.apache.catalina.core.StandardContext start
 SEVERE: Error listenerStart
 Dec 7, 2005 4:48:43 PM org.apache.catalina.core.StandardContext start
 SEVERE: Context [/samples] startup failed due to previous errors
 
 
 
 Relevant info:
   Apache/Tomcat version 5.5.12
   MyFaces 1.1.1
 
 Included in common\lib
   commons-beanutils.jar
   commons-collections.jar
   commons-digester.jar
   commons-el.jar
   commons-logging.jar
   custom_jsf_lib_1_0_2.jar
   jasper-compiler-jdt.jar
   jasper-compiler.jar
   jasper-runtime.jar
   jsf-api.jar
   jsf-impl.jar
   jsp-api.jar
   jstl.jar
   naming-factory-dbcp.jar
   naming-factory.jar
   naming-resources.jar
   sample_app_1_0_2.jar
   servlet-api.jar
   standard.jar
   struts.jar
 
 
 
 web.xml file
 --
 ?xml version=1.0 ?
 
 web-app xmlns=http://java.sun.com/xml/ns/j2ee;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
 http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
 version=2.4
 
 
 
 context-param
 param-namejavax.faces.STATE_SAVING_METHOD/param-name
 param-valueserver/param-value
   /context-param
 
 
 !-- Startup of Tomcat works until I add this node --
 listener
 

listener-classorg.apache.myfaces.webapp.StartupServletContextListener/listener-class
 /listener
 
 
 
   servlet
 servlet-nameFacesServlet/servlet-name
 servlet-classjavax.faces.webapp.FacesServlet/servlet-class
 load-on-startup1/load-on-startup
   /servlet
 
   servlet-mapping
 servlet-nameFacesServlet/servlet-name
 url-pattern*.faces/url-pattern
   /servlet-mapping
 
 
 
 
 
 
 /web-app
 

---
 
 
 As I point out above, starting Tomcat works until I add the listener
 node. Without it, or so I gather from
 googling this all day, the faces page won't work, but the server starts up
 at least.
 
 So, what exactly am I missing? (I hope this is enough info)
 
 Thanks
 Jeff
 
 
 
 
 






Bean definition question faces-config.xml

2005-12-06 Thread Kurt Edegger

Hi,

I wonder if it is possible to declare the constructor of a bean in 
faces-config.xml similar to using constructor-arg in spring's 
configuration files.
The idea behind this is, that I'd like to inject a bean into my 
application and use a referenced bean already in the constructor.
As far as I know and encountered, first the default constructor is 
called, then the referenced beans are injected by using the 
corresponding setters, and finally the bean is used in the application 
depending of the scope.

Or is possible to use/reference Spring beans in faces-config.xml?

Thank you for your answers,

Kurt


Re: Bean definition question faces-config.xml

2005-12-06 Thread Kurt Edegger

Thank you for your fast response!


on 12/6/2005 7:39 PM Simon Kitching stated:

[...snip...]
This is definitely not a feature of the JSF specification, and MyFaces 
can't add any new tags to the faces-config.xml file without violating 
the spec.

Ok, short and precise answer ;)
[...snip...] 
You can also do initialisation after all the properties have been set. 
See the FAQ entry How do I know when a managed bean's properties have 
all been set?.
There's a method called initDao() in the class 
org.springframework.jdbc.core.support.JdbcDaoSupport which should be 
overwritten in a case you need to init a DAO (which is the case in my 
situation).
But this one is not called by JSF right? So I'd need to use spring to 
construct the bean?


Thank you for pointing to the FAQ - missed that one ..

Take care, Kurt


http://wiki.apache.org/myfaces/FAQ


Or is possible to use/reference Spring beans in faces-config.xml?



Any managed-property like:
  managed-property
namefoo/name
value#{someValue}/value
  /managed-property
simply looks for a key someValue in the request, session and 
application scopes. So if your spring bean is stored in one of those 
maps then it will be passed to the managed bean on creation.



Regards,

Simon




Re: naming conventions in faces-config.xml

2005-12-05 Thread Kurt Edegger

Hi Mike,

thank you for your help, but I don't think that your answer is correct.
We are talking about two different classes. The first one is 
CasesJdbcDAO with the setter taking an JDBCDataSource Object and the 
second on is the JDBCDataSource class having a getDs() method to return 
the actual javax.sql.DataSource object. To clearify: The JDBCDataSource 
object is injected to CasesJdbcDAO using the setter in CasesJdbcDAO 
which takes the correct type of JDBCDataSource.
I don't think this is an issue of a misscasted type since it works if 
the field in CasesJdbcDAO (marked as [1] in my former postings) isn't 
named 'dataSource'. In that case the JSF implementation seems to 
interpret the name as a type and causing the exception. In the case it 
isn't named 'dataSource' (e.g. 'ds' in my example) the injection is done 
without any problems.


I'm appreciating your help and thoughts.

Kurt



on 12/5/2005 8:54 AM Mike Kienenberger stated:

Your setter and getter return different types.

 public DataSource getDs()

needs to be

 public JDBCDataSource getDs() {

On 12/2/05, Kurt Edegger [EMAIL PROTECTED] wrote:


Hi Mike,

thank you for your response.

on 12/2/2005 7:30 AM Mike Kienenberger stated:
 Can you post the setter method for ds in CasesJdbcDAO?

Here are the crucial parts of CasesJdbcDAO:
/* the field definition [1]*/
private JDBCDataSource ds;

/* the setter*/
public void setDs(JDBCDataSource dataSource) {
  this.ds = dataSource;
  this.setDataSource(this.ds.getDs());
}

 Also can you post the class definition line for JDBCDataSource?
The JDBCDataSource class is very simple and just holds an
javax.sql.DataSource object. Here are the interesting parts:

/*the class definition */
public class JDBCDataSource{

/*the javax.sql.DataSource*/
private DataSource ds;
private String jndiLookup;
...

public DataSource getDs() {
doLookup();
return ds;
}

}


The issue again: If I change the name of the field in CasesJdbcDAO at
position [1] to dataSource, and adjust the injection in faces-config.xml
accordingly the application crashes with the stated exception.

Any ideas?

Kurt





Re: jsCalendarPopupCalendar not embedded

2005-12-03 Thread Kurt Edegger

Martin,

thank you for the suggestion, but I tried it w/ myfaces-1.0.9 (both the 
-all.jar and the split up dist) and 1.1.0 as well.

I'm still getting the same jScript errors.

clueless,

Kurt

on 12/2/2005 3:38 AM Martin Marinschek stated:

Ah - now I remember some issue with inputCalendar in 1.1.1.

Are you using 1.1.1 or a nightly build?

regards,

Martin

On 12/2/05, Kurt Edegger [EMAIL PROTECTED] wrote:


I do think, that the ExtensionFilter is called when the page is
rendered. The reason is that I do use a tree2 component, which didn't
function properly before I added the filter and now it works fine.

just a thought,

   Kurt


on 12/1/2005 11:20 PM Martin Marinschek stated:


ah, I overlooked the 2.4 statement on top, sorry.

Maybe you should try to start your debugger and see if you ever get
into the ExtensionsFilter, that might be useful.

regards,

Martin

On 12/1/05, Mike Kienenberger [EMAIL PROTECTED] wrote:



Martin,

That's no longer true for 2.4, which is xml-schema based:




From the comments in the url at the top of the file:



  The web-app element is the root of the deployment
  descriptor for a web application.  Note that the sub-elements
  of this element can be in the arbitrary order.

Kurt,

Unfortunately, I don't see anything wrong with your web.xml.   That
doesn't mean there's nothing wrong, only that I don't see it, though
:)

Sorry I can't be of more help.


On 12/1/05, Martin Marinschek [EMAIL PROTECTED] wrote:



On the first glance - you need to keep the sequence of things
correctly in your web.xml, AFAIK.

That would mean that you should first define all filters and their
mappings, then servlets and their mappings.

regards,

Martin


On 12/1/05, Kurt Edegger [EMAIL PROTECTED] wrote:



Hi Mike,

here's my web.xml. The JSF application is a tool for a program called
Sakai, thus the additional servlets and mappings.

Thanks

?xml version=1.0 encoding=UTF-8?
web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
display-nameECGViewer_standalone/display-name

!-- Sakai JSF Tool Servlet, for the jsf1 tool --
 servlet
 servlet-namesakai.ecgviewer.tool/servlet-name
 servlet-classorg.sakaiproject.jsf.util.JsfTool/servlet-class
 init-param
 param-namedefault/param-name
 param-valueindex/param-value
 /init-param
 init-param
 param-namepath/param-name
 param-value//param-value
 /init-param
 load-on-startup 1 /load-on-startup
 /servlet

 servlet
 servlet-nameFaces Servlet/servlet-name
 servlet-classjavax.faces.webapp.FacesServlet/servlet-class
 load-on-startup2/load-on-startup
 /servlet

 listener
 listener-classorg.sakaiproject.util.ToolListener/listener-class
 /listener

!-- added to ensure a Context - as recommended by error message --
  listener

listener-classorg.apache.myfaces.webapp.StartupServletContextListener/listener-class
  /listener

!-- Sakai request filter, mapped to anything that goes to the faces
servlet --
filter
   filter-namesakai.request/filter-name
   filter-classorg.sakaiproject.util.RequestFilter/filter-class
/filter

filter-mapping
filter-namesakai.request/filter-name
servlet-nameFaces Servlet/servlet-name
dispatcherREQUEST/dispatcher
dispatcherFORWARD/dispatcher
dispatcherINCLUDE/dispatcher
/filter-mapping


context-param
 param-namejavax.faces.STATE_SAVING_METHOD/param-name
 param-valueserver/param-value
/context-param

context-param
param-namecom.sun.faces.validateXml/param-name
param-valuetrue/param-value
/context-param

servlet-mapping
 servlet-nameFaces Servlet/servlet-name
 url-pattern*.jsf/url-pattern
/servlet-mapping


 !--  myFaces Extension Filter - neccessary for extended myFaces
components like Tree2 --
 filter
  filter-nameMyFacesExtensionsFilter/filter-name
  filter-class
  org.apache.myfaces.component.html.util.ExtensionsFilter
  /filter-class
  init-param
  param-namemaxFileSize/param-name
  param-value20m/param-value
  description
  Set the size limit for uploaded files.
   Format: 10 - 10 bytes 10k - 10 KB
   10m - 10 MB 1g - 1 GB
  /description
  /init-param
 /filter


 filter-mapping
  filter-nameMyFacesExtensionsFilter/filter-name
  url-pattern*.jsf/url-pattern
 /filter-mapping
 filter-mapping
  filter-nameMyFacesExtensionsFilter/filter-name
  url-pattern/faces/*/url-pattern
 /filter-mapping

 !--  /myFaces Extension Filter --
/web-app

Thank you,

   Kurt


on 12/1/2005 9:44 AM Mike Kienenberger stated:



Post your web.xml configuration sections on filters, filter mappings,
servlets, and servlet mappings.   Maybe we can spot

Re: jsCalendarPopupCalendar not embedded

2005-12-02 Thread Kurt Edegger
I do think, that the ExtensionFilter is called when the page is 
rendered. The reason is that I do use a tree2 component, which didn't 
function properly before I added the filter and now it works fine.


just a thought,

Kurt


on 12/1/2005 11:20 PM Martin Marinschek stated:

ah, I overlooked the 2.4 statement on top, sorry.

Maybe you should try to start your debugger and see if you ever get
into the ExtensionsFilter, that might be useful.

regards,

Martin

On 12/1/05, Mike Kienenberger [EMAIL PROTECTED] wrote:


Martin,

That's no longer true for 2.4, which is xml-schema based:

From the comments in the url at the top of the file:

   The web-app element is the root of the deployment
   descriptor for a web application.  Note that the sub-elements
   of this element can be in the arbitrary order.

Kurt,

Unfortunately, I don't see anything wrong with your web.xml.   That
doesn't mean there's nothing wrong, only that I don't see it, though
:)

Sorry I can't be of more help.


On 12/1/05, Martin Marinschek [EMAIL PROTECTED] wrote:


On the first glance - you need to keep the sequence of things
correctly in your web.xml, AFAIK.

That would mean that you should first define all filters and their
mappings, then servlets and their mappings.

regards,

Martin


On 12/1/05, Kurt Edegger [EMAIL PROTECTED] wrote:


Hi Mike,

here's my web.xml. The JSF application is a tool for a program called
Sakai, thus the additional servlets and mappings.

Thanks

?xml version=1.0 encoding=UTF-8?
web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;
display-nameECGViewer_standalone/display-name

!-- Sakai JSF Tool Servlet, for the jsf1 tool --
  servlet
  servlet-namesakai.ecgviewer.tool/servlet-name
  servlet-classorg.sakaiproject.jsf.util.JsfTool/servlet-class
  init-param
  param-namedefault/param-name
  param-valueindex/param-value
  /init-param
  init-param
  param-namepath/param-name
  param-value//param-value
  /init-param
  load-on-startup 1 /load-on-startup
  /servlet

  servlet
  servlet-nameFaces Servlet/servlet-name
  servlet-classjavax.faces.webapp.FacesServlet/servlet-class
  load-on-startup2/load-on-startup
  /servlet

  listener
  listener-classorg.sakaiproject.util.ToolListener/listener-class
  /listener

!-- added to ensure a Context - as recommended by error message --
   listener

listener-classorg.apache.myfaces.webapp.StartupServletContextListener/listener-class
   /listener

!-- Sakai request filter, mapped to anything that goes to the faces
servlet --
 filter
filter-namesakai.request/filter-name
filter-classorg.sakaiproject.util.RequestFilter/filter-class
 /filter

 filter-mapping
 filter-namesakai.request/filter-name
 servlet-nameFaces Servlet/servlet-name
 dispatcherREQUEST/dispatcher
 dispatcherFORWARD/dispatcher
 dispatcherINCLUDE/dispatcher
 /filter-mapping


 context-param
  param-namejavax.faces.STATE_SAVING_METHOD/param-name
  param-valueserver/param-value
 /context-param

 context-param
 param-namecom.sun.faces.validateXml/param-name
 param-valuetrue/param-value
 /context-param

 servlet-mapping
  servlet-nameFaces Servlet/servlet-name
  url-pattern*.jsf/url-pattern
 /servlet-mapping


  !--  myFaces Extension Filter - neccessary for extended myFaces
components like Tree2 --
  filter
   filter-nameMyFacesExtensionsFilter/filter-name
   filter-class
   org.apache.myfaces.component.html.util.ExtensionsFilter
   /filter-class
   init-param
   param-namemaxFileSize/param-name
   param-value20m/param-value
   description
   Set the size limit for uploaded files.
Format: 10 - 10 bytes 10k - 10 KB
10m - 10 MB 1g - 1 GB
   /description
   /init-param
  /filter


  filter-mapping
   filter-nameMyFacesExtensionsFilter/filter-name
   url-pattern*.jsf/url-pattern
  /filter-mapping
  filter-mapping
   filter-nameMyFacesExtensionsFilter/filter-name
   url-pattern/faces/*/url-pattern
  /filter-mapping

  !--  /myFaces Extension Filter --
/web-app

Thank you,

Kurt


on 12/1/2005 9:44 AM Mike Kienenberger stated:


Post your web.xml configuration sections on filters, filter mappings,
servlets, and servlet mappings.   Maybe we can spot the error.





--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces






--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces




naming conventions in faces-config.xml

2005-12-02 Thread Kurt Edegger

Hi,

I do have a question relating to properties of managed beans defined in 
faces-config.xml. I do face the following situation of two beans:


managed-bean
  managed-bean-namejdbcDataSourceBean/managed-bean-name
  managed-bean-classJDBCDataSource/managed-bean-class
  managed-bean-scopeapplication/managed-bean-scope
/managed-bean

managed-bean
  managed-bean-namecasesDAOBean/managed-bean-name
  managed-bean-classCasesJdbcDAO/managed-bean-class
  managed-bean-scopesession/managed-bean-scope
  managed-property
!--  [1] --
property-nameds/property-name
value#{jdbcDataSourceBean}/value
  /managed-property
/managed-bean

The first bean is injected into the second one and everything works 
fine, but as I wrote the code I decided to name the managed-property of 
the second bean 'dataSource' since it's more descriptive.

I renamed the field in the class and the setter as well.
But when the casesDAOBean is contructed at runtime, the application 
crashes with an exception 'javax.servlet.jsp.el.ELException: Attempt to 
coerce a value of type JDBCDataSource to type javax.sql.DataSource'.


Somehow the property name is recognized as type, even I had to declared 
it in CasesJdbcDAO anyway (JDBCDataSource dataSource; ).


Why am I not allowed to call the field like a class in the package 
javax.sql?


I had a hard time to find this one, since I wouldn't think of simply 
renaming the field solved the issue.

Any clues why this happens?

Thanks,

Kurt

P.S.: Yep, sorry, not really myfaces related ;)


Re: naming conventions in faces-config.xml

2005-12-02 Thread Kurt Edegger

Hi Mike,

thank you for your response.

on 12/2/2005 7:30 AM Mike Kienenberger stated:
 Can you post the setter method for ds in CasesJdbcDAO?

Here are the crucial parts of CasesJdbcDAO:
/* the field definition [1]*/
private JDBCDataSource ds;

/* the setter*/
public void setDs(JDBCDataSource dataSource) {
  this.ds = dataSource;
  this.setDataSource(this.ds.getDs());
}

 Also can you post the class definition line for JDBCDataSource?
The JDBCDataSource class is very simple and just holds an 
javax.sql.DataSource object. Here are the interesting parts:


/*the class definition */
public class JDBCDataSource{

/*the javax.sql.DataSource*/
private DataSource ds;
private String jndiLookup;
...

public DataSource getDs() {
doLookup();
return ds;
}

}


The issue again: If I change the name of the field in CasesJdbcDAO at 
position [1] to dataSource, and adjust the injection in faces-config.xml 
accordingly the application crashes with the stated exception.


Any ideas?

Kurt





The question is can JDBCDataSource be coerced to the type of getDs()?

On 12/2/05, Kurt Edegger [EMAIL PROTECTED] wrote:


Hi,

I do have a question relating to properties of managed beans defined in
faces-config.xml. I do face the following situation of two beans:

managed-bean
  managed-bean-namejdbcDataSourceBean/managed-bean-name
  managed-bean-classJDBCDataSource/managed-bean-class
  managed-bean-scopeapplication/managed-bean-scope
/managed-bean

managed-bean
  managed-bean-namecasesDAOBean/managed-bean-name
  managed-bean-classCasesJdbcDAO/managed-bean-class
  managed-bean-scopesession/managed-bean-scope
  managed-property
   !--  [1] --
   property-nameds/property-name
   value#{jdbcDataSourceBean}/value
  /managed-property
/managed-bean

The first bean is injected into the second one and everything works
fine, but as I wrote the code I decided to name the managed-property of
the second bean 'dataSource' since it's more descriptive.
I renamed the field in the class and the setter as well.
But when the casesDAOBean is contructed at runtime, the application
crashes with an exception 'javax.servlet.jsp.el.ELException: Attempt to
coerce a value of type JDBCDataSource to type javax.sql.DataSource'.

Somehow the property name is recognized as type, even I had to declared
it in CasesJdbcDAO anyway (JDBCDataSource dataSource; ).

Why am I not allowed to call the field like a class in the package
javax.sql?

I had a hard time to find this one, since I wouldn't think of simply
renaming the field solved the issue.
Any clues why this happens?

Thanks,

   Kurt

P.S.: Yep, sorry, not really myfaces related ;)





Re: naming conventions in faces-config.xml

2005-12-02 Thread Kurt Edegger

Hi Mike,

thank you for your response.

on 12/2/2005 7:30 AM Mike Kienenberger stated:
 Can you post the setter method for ds in CasesJdbcDAO?

Here are the crucial parts of CasesJdbcDAO:
/* the field definition [1]*/
private JDBCDataSource ds;

/* the setter*/
public void setDs(JDBCDataSource dataSource) {
  this.ds = dataSource;
  this.setDataSource(this.ds.getDs());
}

 Also can you post the class definition line for JDBCDataSource?
The JDBCDataSource class is very simple and just holds an 
javax.sql.DataSource object. Here are the interesting parts:


/*the class definition */
public class JDBCDataSource{

/*the javax.sql.DataSource*/
private DataSource ds;
private String jndiLookup;
...

public DataSource getDs() {
doLookup();
return ds;
}

}


The issue again: If I change the name of the field in CasesJdbcDAO at 
position [1] to dataSource, and adjust the injection in faces-config.xml 
accordingly the application crashes with the stated exception.


Any ideas?

Kurt


Re: sorry for email duplicates...

2005-12-02 Thread Kurt Edegger

Hi,

same over here - sorry ;)

Have a great weekend everyone!

Kurt

on 12/2/2005 4:20 PM Matthias Kahlau stated:

Hi!

Sorry for email duplicates, but there must have been a huge delay, and I
have resend my emails because I thought sth. is wrong with my email
program...


Regards,
Matthias





Re: jsCalendarPopupCalendar not embedded

2005-12-01 Thread Kurt Edegger

Hi Mike,

here's my web.xml. The JSF application is a tool for a program called 
Sakai, thus the additional servlets and mappings.


Thanks

?xml version=1.0 encoding=UTF-8?
web-app version=2.4 xmlns=http://java.sun.com/xml/ns/j2ee;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd;

display-nameECGViewer_standalone/display-name

!-- Sakai JSF Tool Servlet, for the jsf1 tool --
  servlet
  servlet-namesakai.ecgviewer.tool/servlet-name
  servlet-classorg.sakaiproject.jsf.util.JsfTool/servlet-class
  init-param
  param-namedefault/param-name
  param-valueindex/param-value
  /init-param
  init-param
  param-namepath/param-name
  param-value//param-value
  /init-param
  load-on-startup 1 /load-on-startup
  /servlet

  servlet
  servlet-nameFaces Servlet/servlet-name
  servlet-classjavax.faces.webapp.FacesServlet/servlet-class
  load-on-startup2/load-on-startup
  /servlet

  listener
  listener-classorg.sakaiproject.util.ToolListener/listener-class
  /listener

!-- added to ensure a Context - as recommended by error message --
listener
	 
listener-classorg.apache.myfaces.webapp.StartupServletContextListener/listener-class

/listener

!-- Sakai request filter, mapped to anything that goes to the faces 
servlet --

 filter
filter-namesakai.request/filter-name
filter-classorg.sakaiproject.util.RequestFilter/filter-class
 /filter

 filter-mapping
 filter-namesakai.request/filter-name
 servlet-nameFaces Servlet/servlet-name
 dispatcherREQUEST/dispatcher
 dispatcherFORWARD/dispatcher
 dispatcherINCLUDE/dispatcher
 /filter-mapping


 context-param
  param-namejavax.faces.STATE_SAVING_METHOD/param-name
  param-valueserver/param-value
 /context-param

 context-param
 param-namecom.sun.faces.validateXml/param-name
 param-valuetrue/param-value
 /context-param

 servlet-mapping
  servlet-nameFaces Servlet/servlet-name
  url-pattern*.jsf/url-pattern
 /servlet-mapping


  !--  myFaces Extension Filter - neccessary for extended myFaces 
components like Tree2 --

  filter
filter-nameMyFacesExtensionsFilter/filter-name
filter-class
org.apache.myfaces.component.html.util.ExtensionsFilter
/filter-class
init-param
param-namemaxFileSize/param-name
param-value20m/param-value
description
Set the size limit for uploaded files.
Format: 10 - 10 bytes 10k - 10 KB
10m - 10 MB 1g - 1 GB
/description
/init-param
  /filter


  filter-mapping
filter-nameMyFacesExtensionsFilter/filter-name
url-pattern*.jsf/url-pattern
  /filter-mapping
  filter-mapping
filter-nameMyFacesExtensionsFilter/filter-name
url-pattern/faces/*/url-pattern
  /filter-mapping

  !--  /myFaces Extension Filter --
/web-app

Thank you,

Kurt


on 12/1/2005 9:44 AM Mike Kienenberger stated:

Post your web.xml configuration sections on filters, filter mappings,
servlets, and servlet mappings.   Maybe we can spot the error.



Issues adding childNodes to TreeNode elements when using Tree2 component

2005-11-30 Thread Kurt Edegger
Hi!

I'd like to use a tree2 component in my JSF application.
The entries are aquired via a DAO from a database. The DAO holds a list
containing the entries in the tree describing the entry itself and the name of
the parent node where it should be attached to (the names of the nodes are
unique).
I'm parsing the list and attach a new TreeNode to the root for each entry where
the parent node is either root or not defined. To add the child nodes, I'm
searching the tree and if the parent node is existing I'm adding a new TreeNode
to the parent one. 
But after I added the child to the parent, the tree.getChildCount() method still
returns the number of nodes without the child. 
What could be the reason for loosing the child node after adding it to the
tree?

Here's a small code snipplet to demonstrate:

nodeIdentifier = parentNodeIdentifier;
TreeNode parentNode = getNode(treeData, nodeIdentifier);
TreeNodeBase groupNode=null;
if (parentNode!=null){
  int index = treeData.getChildren().indexOf(parentNode);
  TreeNode pNode2 = (TreeNode) treeData.getChildren().get(index);
  //pNode2 is the same as parentNode as expected
  nodeIdentifier = childNodeIdentifier;
  groupNode = new TreeNodeBase(type, name, nodeIdentifier, false);
  //[1]
  parentNode.getChildren().add(groupNode);
  //[2]
}

treeData holds the root of the tree as a simple TreeNodeBase element.
parentNode.getChildCount() return 0 at [1] and 1 at [2] as expected,
but treeData.getChildCount() returns 1 at both positions of the code.

Even if I add the parentNode explicitely again to the tree, the number of childs
in the tree is increased only by 1 (the parentnode) and not by 2
(parent+child).

What am I missing here? Is there an easier way to construct a tree which has
more than one level of children?

Any help appreciated.

Thank you,

   Kurt



Re: jsCalendarPopupCalendar not embedded

2005-11-30 Thread Kurt Edegger
Hi,

I agree that there is missing JavaScript Code, but is there anything else to
configer except the myfaces extension filters described at
http://myfaces.apache.org/tomahawk/extensionsFilter.html

All the documentation I found stated, that installing the filter and adding the
taglib to the jsp page is sufficient.

Any more thoughts?

Thanks,
   Kurt

Quoting \R. Müller\ [EMAIL PROTECTED]:

 Hi,
 
 [EMAIL PROTECTED] wrote:
  [...]
  I'm still getting the jscalendarPopUpCalendar is not defined JavaScript
  error.
  But there is another one, while rendering the page: 'loadPopupScript is
 not
  defined'
  
 
 it seems that there is some javascript-code missing (function 
 'loadPopupScript') in rendered page. make sure that your web is proper 
 configurated, especially filter- and servletmappings.
 
 Ronald
 
 






Re: Tree2 space between table elements

2005-11-29 Thread Kurt Edegger

Hi Marius,

thank you for your answer, but the only parent tags of my tree2 
element are the view and the body elements. For each row in the tree 
there will be an individual table rendered, right? Which style do I need 
to set to adjust the spacing between adjacent tables to zero?


Thanks again - any more ideas anyone?

Kurt


on 11/29/2005 12:48 AM Marius Kreis stated:

Hi!
This looks to me like an issue with the surrounding tag. Is your tree 
inside of a table? Then probably the height-attribute of the td tag 
might cause the stretching of the tree...


Kurt Edegger wrote:


Hi,

I do have troubles with the tree2 component. I implemented a little 
demo page,
where the data from the example of the source distribution 
(myfaces-1.1.1-src)

is displayed in a tree2 component. The tree is rendered fully functional
(server  side and client side handling), but there's a big optical issue.
Between each row of the tree, there's a gap and the table cells 
containing the
graphical tree representation contain additional borders on their left 
and
right side. It seems to be a CSS issue, but I copied the CSS from the 
source distribution.
The CSS is readbecause I can change attributes like font size and 
color. How do I get rid of the spacing between the actual tables (each 
row a table on

its own, right?)?

Please find a small image of the rendered response (a pic says more 
than 1000

words).
Thank you for your help,

 Kurt











jsCalendarPopupCalendar not embedded

2005-11-29 Thread Kurt Edegger

Hi,

I would like to use the inputCalender element on one of my jsf pages. 
I'd like to have the element rendered to use the javaScript popup to 
display the calendar. But when I add the following to my jsp document, I 
only get an jsCalendarPopupCalendar is not defined JavaScript Error 
after clicking on the calendar icon next to the input field.


h:form id=dateOfDiagnosisForm
  t:inputCalendar monthYearRowClass=yearMonthHeader
 weekRowClass=weekHeader currentDayCellClass=currentDayCell
 value=#{ecgViewer.diagDate} renderAsPopup=true
 popupTodayString=#{msg['calendarpopup_today_string']}
 popupWeekString=#{msg['calendarpopup_week_string']}
 renderPopupButtonAsImage=true /
/h:form

I did add the extension filter entries to my web.xml and I can use other 
elements correctly. I found a former thread in this group relating to 
the same issue, but there the issue was that the jsp document had no 
body nor head elements, which I do have both in my jsp.


Any ideas?

Kurt



Tree2 space between table elements (horizontal)

2005-11-28 Thread Kurt Edegger

Hi,

I do have troubles with the tree2 component. I implemented a little demo 
page,
where the data from the example of the source distribution 
(myfaces-1.1.1-src)

is displayed in a tree2 component. The tree is rendered fully functional
(server  side and client side handling), but there's a big optical issue.
Between each row of the tree, there's a gap and the table cells 
containing the

graphical tree representation contain additional borders on their left and
right side.
It seems to be a CSS issue, but I copied the CSS from the source 
distribution.

The CSS is readbecause I can change attributes like font size and color.
How do I get rid of the spacing between the actual tables (each row a 
table on

its own, right?)?

Please find a small image of the rendered response (a pic says more than 
1000

words).

Thank you for your help,

 Kurt