JFAQ ver. 1.3

This package lets you build FAQ pages. FAQ here is a set of pairs <question, answer>. What does this tool provide?

a) A schema for your database. This schema is a set of DDL statements that you may use for setting a database with your FAQ lists. JFAQ works with any database through JDBC.
b) A set of custom JSP tags you may use for building your application
c) A simple set of JSP pages (examples for JFAQ taglib or a generic FAQ support application you may use as a base for your development)

So, JFAQ does not dictate a form/design for your pages. You will use custom JSP tags for access to your database and you are free to choose how to use them and how to incorporate tags into your pages.

Database

JFAQ works with any database through JDBC. All connection settings are configurable. So you will provide JDBC settings and names for JFAQ tables. JFAQ distributive contains DDL statements you have to use for creating such tables.

JFAQ will use two tables. You may use any names for them and just describe these names in your configuration file. But all names for fields are fixed of course.

Table1:

Create table your_name (
Id char(30) PRIMARY KEY,
Title char (80))

Table2:

Create table your_name (
Id char(30),
Id1 char(30) PRIMARY KEY,
Question long varchar,
Answer long varchar,
SenderName char(80),
SenderEmail char(80),
Created char(14),
AuthorName char(80),
AuthorEmail char(80),
LastModified char(14),
Hits integer)

So each FAQ has got some unique ID and title (description). FAQ contains questions. Each question has got own unique ID and data fields such as sender name, sender email, answer etc.

You must use the same names for columns but depends on your database you can change the type for Question and Answer columns. These columns (domains) will keep your text data. You may decide to use TEXT for example. Check out your DB manual for supported SQL data types. You may change also types from CHAR to VARCHAR.

Custom JSP tags.

A set of custom JSP tags lets you create/open new FAQ, add question, add/modify answers etc.

This distributive contains also a set of examples how to use them. You may threat this set as a generic FAQ application.

Configuration

All settings should be described in the one text file. Each line describes one parameter in the form of: Parameter_name=value.

Empty lines and any line starts with # or // are ignored. Parameters are:

# JDBC settings

# JDBC driver
driver=your_jdbc_driver

# db URL
url=your_db_url

# JNDI name for datasource
# you must set this parameter or (driver,url) pair
jndiname=your_data_source

# user name for JDBC connection. You can omit this parameter.
user=db_user

# password for JDBC connection. You can omit this parameter.
password=db_user's_password

# FAQ tables
table1=your_db_table
table2=your_db_table

Taglib

JFAQ taglib is a rich collection of custom JSP tags. These tags let you to perform various actions with JFAQ database such as create FAQ, add questions, add/modify answers, etc. So JFAQ tags do all business logic and what do you need is just add an any appropriate design at the front end.

Tags usage (see downloading section for taglib.tld and jfaqtag.jar):

<%@ taglib uri="taglib.tld" prefix="jfaq" %>

on the each page with JFAQ tags at the first hand you have to use tag setConfig. With this tag you must describe your configuration file. E.g.

<jfaq:setConfig configFile="c:/mydata/jfaqconf.txt"/>

Tags for business logic are:

1) createFAQ. This tag creates a new FAQ. Parameters are:

  a) title describes a title for your FAQ
  b) id describes a page scope variable name. This variable (type is java.lang.String) will keep ID for new created FAQ.
  See examples: HTML form createFAQ.htm  JSP action createFAQ.jsp

2) deleteFAQ. This tag deletes a FAQ. Parameters are:

  a) id describes an ID for your FAQ

3) editFAQ This tag updates a title for the given FAQ. Parameters are:

  a) id describes an ID for your FAQ
  b) title describes a new title for your FAQ
  See examples: HTML form editFAQ.htm  JSP action: editFAQ.jsp

4) getFAQ reads FAQ's. Parameters are:

  a) id describes a name for page scope variable. Type is com.cj.jfaq.FAQbean[].
  See examples: getFAQ.jsp

5) getTitle reads a title for your FAQ. Parameters are:

  a) idFAQ describes an ID for your FAQ
  a) id Optional parameter. Describes a page scope variable (type is java.lang.String) for your data. Without this parameter tag just prints a title.

6) postQuestion Creates a new question or question-answer pair. Parameters are:

  a) idFAQ describes an ID for your FAQ
  b) question describes a question
  c) senderName Optional parameter. Describes a name for author
  d) senderEmail Optional parameter. Describes a e-mail for author
  e) answer Optional parameter. Describes an answer for this question
  f) authorName Optional parameter. Describes a name for answer's author
  g) authorEmail Optional parameter. Describes an email for answer's author
  h) id - describes a page scope variable. This variable will keep ID for new created FAQ (type is java.lang.String).
  See examples: HTML form postQuestion.htm  JSP action: postQuestion.jsp

7) deleteQuestion. This tag deletes a question. Parameters are:

  a) id describes ID for your question

8) editQuestion Updates existing question or question-answer pair. Parameters are:

  a) id describes an ID for your question
  b) question Optional parameter. Describes a question (a new value).
  c) senderName Optional parameter. Describes a name for author (a new value)
  d) senderEmail Optional parameter. Describes an email for author (a new value)
  e) answer Optional parameter. Describes an answer for this question (a new value)
  f) authorName Optional parameter. Describes a name for answer's author (a new value)
  g) authorEmail Optional parameter. Describes an email for answer's author (a new value)

9) getQuestions reads questions. Parameters are:

  a) idFAQ describes an ID for your FAQ
  b) id describes a page scope variable. This variable will keep an array with the retrieved data. Type is com.cj.jfaq.QuestionBean[]
  See example: getQuestions.jsp

10) getAnswer reads one answer

  a) idQuestion describes an ID for some question
  b) id describes a page scope variable name. This variable will keep a bean with the retrieved data. Type is com.cj.jfaq.AnswerBean
  See example: getAnswer.jsp

11) getData reads pairs question/answer. Parameters are:

  a) idFAQ describes an ID for your FAQ
  b) id describes a page scope variable name. This variable will keep an array with the retrieved data. Type is com.cj.jfaq.DataBean[].
  See example: getData.jsp

12) getDataXML outputs existing data (FAQ) in XML format. Parameters are:

  a) idFAQ describes an ID for your FAQ
  b) idQuestion Optional parameter. Describes an ID for your question.
 

    For downloading:   taglib.tld  jfaqtag.jar
    Sample of configuration file:  sample.txt   DDL:  ddl.txt

 © Coldbeans     Comments?

See also JSOS - the largest collection of servlets and filters.
See also Coldtags suite - the largest collection of custom JSP tags.