Bruce Riches

+ Follow
since Apr 24, 2006
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bruce Riches

BTW: Both the menu and the body page display and behave correctly when rendered without using tiles.
14 years ago

In a MyFaces/Tomahawk application I have a Tiles (version 2.1.2) template that defines 4 tiles, a header, a menu, a body and a footer.
My problem concerns navigation. I cannot seem to identify the 'from-view-id' name correctly. I've used the name of the jsp that represents the body and from where the action is specified as a command button attribute. Also, I've specified the template name. Neither works correctly.
I also cannot get the jscookmenu to render in the 'menu tile', although I see it's generated code in the page source.
Any ideas very welcome.
14 years ago
Thanks for all your suggestions. I've finally resolved this issue and gotten 'JSF wiser' in the process. My link now looks like this:
<h:commandLink title="Show member detail"
immediate="true" />
So, the backing bean method is called and gets the current row number by using the 'getRowData()' of the HtmlDataTable class.
The 'Member' instance is created, and set into an ArrayList.
That's pretty much it.
I sometimes think that JSF is overly complex and the learning curve is fairly steep, but it does get the job done.
Has anyone evaluated Wicket?
14 years ago
Remember the managedbean's default constructor is called automatically by the JSF engine at application startup. So you can initialize, call methods etc from the constructor.

14 years ago
This may help you.
Wrap the row in your table like this:
<h:commandLink title="Show member detail" action="#{linkBean.linker}" immediate="true" >
<h:outputText value="#{memberlist.memberFullName}" />
<f:param name="arg1" value="#{memberlist.memberId}" />


linkBean is a managed bean with 1 property - arg1.
memberlist is also a managedbean (of course).
linker is a method on the linkbean that returns a String indicating a 'from-outcome' in the navigation rules for the bean.

The 'faces-config' file defines these link props so:

Now all you have to do in your target page is to reference the linkbean arg value - in my case memberid - to in turn reference the row in your collection from the source page.
Hope this helps.
14 years ago
Can anyone solve this?
I have an expression that looks like this: #{backingBean.someproperty[linkBean.arg1]} which causes an EL parsing error.
I've tried some variations such as: #{backingBean.someproperty[#{linkBean.arg1}]} and
#{backingBean[linkBean.arg1].someproperty}. These cause parsing errors also.
I've verified that both backingBean.someproperty and linkBean.arg1 have valid values.
These expressions in part implement a link as in <h:commandLink... on a master list which grabs the current datatable row and renders the row details on the next page - or at least it's supposed to!
What am i missing here?
Help appreciated.

14 years ago
Actually, it turns out that that was what I was doing finally, just had made a mistake in implementing it.
Thanks anyway - at least I now know that that's the way to do this.
14 years ago
I've asked this question previously and I think that I phrased it badly.
So, here goes again.
This web app's welcome page contains a single <h:commandLink> that routes to a page upon which I need to display a list of db rows.
I retrieve the rows using a listener class defined in the web.xml file. I get the rows ok and I assign the rows (as a List object) to a managed bean - patientBackingBean - that has a property - patientList -that corresponds to the list.
However, when I use <h:dataTable in my jsp I see no results. The datatable tag looks like this-

><h:dataTable id="patlistid"

<f:facet name="header">
<h:outputText value="Select"/>
<h:selectBooleanCheckbox onclick="this.form.submit();" />

<h:column rendered="#{patient.patientId}">
<f:facet name="header">
<h:outputText value="#{res[\'patient.patientid\']}"/>
<h:outputText value="#{patlist.patientId}"/>

and so on for each column.

I know that FacesContext is initialized at this point.
Any one have an answer?
14 years ago
I am using a ContextListener to build a list containing domain objects during the application's context initialization.
Now I want to display this list (which represents DB table rows) in the first page that renders.
I have assigned this list to the Servlet Context and I have referenced this context in my page like this:
FacesContext fc = FacesContext.getCurrentInstance();
ServletContext sc = (ServletContext) fc.getExternalContext().getContext();
List patients = sc.getAttribute("PATIENT_LIST");
The PATIENT_LIST attribute is set in the context listener.

First, is this a sensible way to initialize such a list in a JSF environment?
Second, because I have not used a backing bean to hold the list, how do I use the JSF tags such as <h:dataTable...> to render the contents of this list?
(Using JSTL for this is easy but I need to use JSF tags.)
Afterthought, perhaps I should implement a backing bean and assign the list to that bean during initialization and dispense with the Servlet Context approach.
14 years ago

As a Java developer that's looking for 'new territory' I'd like to start developing some Android apps.
My problem though is my apparent lack of imagination - I can't come up with an idea for an app that hasn't been previously developed.
There are calendaring, financial, search, entertainment, social apps and so on. Where does someone go to find a niche or mainstream opportunity?
Or do I build apps with little commercial value, or apps that have already been done, or do it just for fun?
Oh, wait a sec - here's an idea. What about a web app that 'directs' people to web sites that would pay to have people directed to them. These exist in the 'desktop' world eg; Google Payday, but maybe not in the micro-platform world.
14 years ago
I'm running TC 6.0.13 and have deployed a webapp to a std directory structure ie;

In my JSP I have a tag like <SCRIPT type="text/javascript" src="js/runner.js" ></SCRIPT>
Similarly I have a another tag like <link rel="stylesheet" type="text/css" href="css/styles.css">

In both cases the external script file and the style sheet are not found. Of course if I make these things 'inline' there's no problem. I have tried referencing these files like WEB-INF/js/runner.js, /WEB-INF/js/runner.js, /js/runner.js and the files are still not found.
Any ideas appreciated...
16 years ago
Web services as a technology has achieved wide-spread adoption. Personally, I have been involved in 2 projects in the last 12 months that integrated WS into an existing application. These projects used different flavors of WS - RPC and JAX-WS - and both were successful.
WS is not going to be around for ever - new technologies are being developed continuously.
For the moment it's here, who knows about tomorrow?
16 years ago
Right after posting this I fixed the problem - but not in the best way. I simply co-located the log4j jar with my executable jar. Now the log4j jar is found by my exec jar. So, clearly it is a class loading issue and there must be something really funky about the Class-Path spec in the manifest.
Any comments welcome...
17 years ago
Sorry if this is the wrong forum for this question.
I am using Eclipse IDE to build and export an executable jar file. I have a manifest file containing name of Main Class and Class Path. In my simple test case the only jar that needs to be on the class path is the log4j jar. So this is what the Class-Path entry in the manifest contains. Class-Path: log4j-1.2.9.jar
Now, when I disable the refs to log4j in my code, the jar executes correctly ie; it finds the main class and executes it. When I enable the log4j references in this class, I get a NoClassDefFoundError, pointing to the log4j class (org.apache.log4j.Logger) I'm referencing. The log4j jar file is included in the executable jar file.
I have tried building my jar using an ant script and have the same problem.
In reality ant builds a manifest with headings that prevent the VM from finding the main class. That is the reason for my using the Eclipse export feature. BTW: The only header line needed is Manifest-Version: - all the others generated by default by ant, cause the problems mentioned above.
There are a million and one instances found by Googling on this issue, but none provide much guidance on this classnofound error.
Any help appreciated...
17 years ago