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

how do i turn URLs into hyperlinks in JSF page?

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on an app that displays hyperlinks in JSF page  from URLs and text from my database. I've  created connection to database in a bean class. I could retrieve URLs and Text  from database like this:

how do I go about turning LinkName and Text into hyperlink on my JSF page?
Happy new year!
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That won't work. You need to study up on JavaBean naming conventions.

For example, to expose the property "lname" you'd need to name its "get" function "getLname", not "getlname".

If you set up your bean properly, you can emit hyperlinks like this:

 
Victor Ade
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:That won't work. You need to study up on JavaBean naming conventions.

For example, to expose the property "lname" you'd need to name its "get" function "getLname", not "getlname".

If you set up your bean properly, you can emit hyperlinks like this:


How do you suggest i do this Tim? i have my connection in a bean class as Thus:



 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's going to be a long journey.

First, as I said, you'll need to learn about JavaBeans. JavaBeans are a very important concept in Java and are the basis for many Java services, including JSF.

Secondly, you'll need to cache the results of your database fetch operation. JSF may call a "get" method up to 6 times per page request. So you wouldn't want to fetch the data 6 times. Aside from the overhead of a database fetch, you have the issue of idempotency. Meaning that if you don't get EXACTLY the same set of items in the same order each time you make the query, then JSF can get messed up.

Thirdly, you should learn about database connection pools. Java is an expensive language to program in, and so it's best used for high-performance apps. Connection pools make more efficient use of your database resources in a multi-user application (which most webapps are).
 
Victor Ade
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:It's going to be a long journey.

First, as I said, you'll need to learn about JavaBeans. JavaBeans are a very important concept in Java and are the basis for many Java services, including JSF.

Secondly, you'll need to cache the results of your database fetch operation. JSF may call a "get" method up to 6 times per page request. So you wouldn't want to fetch the data 6 times. Aside from the overhead of a database fetch, you have the issue of idempotency. Meaning that if you don't get EXACTLY the same set of items in the same order each time you make the query, then JSF can get messed up.

Thirdly, you should learn about database connection pools. Java is an expensive language to program in, and so it's best used for high-performance apps. Connection pools make more efficient use of your database resources in a multi-user application (which most webapps are).


First of Tim, thanks for your reply. although i'm on "JAVA EE 6 DEVELOPMENT WITH NETBEANS 7"  i'll definitely readup more on java bean from SUN. I know a little about caching too. but i dont think i know the process involved in building this webapp. did i tell you i am self learning java? yes. This is my first venture into programming and i want to build a single page webapp to display a group of link from database as hyperlink to other site on a JSF webpage. IF you were to be in my position, how would you go about building this APP? i understand i'll have to cache results, but then i'll also want results to be fresh as data in database change frequently.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic