One way to say the goal is: “Use Struts, Tomcat and SQL to replace Apache for content”.
basicPortal is an example of the code needed on 80% of all web projects, implemented using the best practices and design available. It has sample beans, Struts Actions, and DAOs that can be used and extended by developers. It also contains samples XML files with settings for Struts Menus, Validators, and Tiles so that these files do not have to be written from scratch. basicPortal is currently running on http://www.basebeans.com.
basicPortal has a content management system (CMS), allowing administrators to add text or HTML content through an easy web interface. All pages are stored in the system database. The top picture above illustrates the form where an administrator can edit the home page.
Notice that each web page has an identifying tag such as HOME or ABOUT. The bottom picture above shows how any page can be displayed easily by passing basicPortal an HTTP parameter such as content=ABOUT.
Users can register to become members of the site, and administrators can edit their information and privileges.
BasicPortal CMS (Content Management System) is dynamic and stored in SQL and just as fast as hard to manage HTML.
The other is: “A large % of code on a project is common”. Things like J2EEuser authentication, displaying home page, approving content, user sign in etc. That part is common, and we can then just write the parts that are unique to our project.
Also, there is integration of Struts with an application server and IDE and connection pools to SQL. BasicPortal provides those. It comes with a DAO DB layer and configured application server for connections. We all need reporting, so it comes with working and configured Jasper Reports. We all like rich client user interface, so it comes with open source implementation of Flash ActionScript forms. Etc.
So this project is to leverage several of the Apache Foundation’s Jakarta projects into a vertical application suite that:
- is simple (follows the “KISS” principle); the platform will remain as simple as possible while still being a database driven high performance web application suitable for very large sites
- is easy to learn and teach
- demonstrates accepted best practices in Java software design, such as J2EE container managed security, JavaBeans, JavaServer Pages (JSP), the Model-View-Controller paradigm (MVC/Struts), data access objects (DAO), the JSP Standard Tag Library (JSTL), caching, etc.
- demonstrates accepted best practices in web GUI development using standards such as CSS, Struts Tiles and Layouts
- works on multiple application servers (Tomcat, Resin, Orion, etc.)
- works on multiple SQL database servers (PostgreSQL, MySQL, Oracle, etc.)
- does multi-row updates and “CRUD” (database creation, reading, updating, and deletion)
- contains the functionality common to 80% of web projects, and gives developers the ability to customize the platform for their specific needs
- enables very high developer productivity. Experienced coders should be able to produce at least two or three modules per day.
- Open Source means:
o No contracts or cost of ownership
o Enables transfer of software budget to other vital resources
o Freedom from closed, proprietary systems and upgrade fees
o Competitive support - anyone who knows Struts and JSTL can provide support
o Community development - added features from other companies and volunteers
The aim is to provide many of the features found in modern web community and portal systems including news, forums, calendars, web logs (“blogs”), wikis, ecommerce, and email support. It will eventually provide automatic generation of GUI elements such as tabs and image buttons. Additional technical goals include support for large binary objects (BLOBs), integration with iReport/JasperReports, automated stress testing, and automated code generation.
basicPortal, the main software component of the system, is targeted at technical project leads of corporate application development, demonstrating the simplicity of using Struts to build a data driven application. A content management system with sample HTML and XML data is included for users to build upon. The system contains member sign up and administration facilities. Its design is based on Struts, JSTL, and JavaBeans that contain DAO helper classes. basicPortal is packaged with the iBatis SQL database layer for object-relational mapping, but any custom DAO can be implemented by making use of an interface.
THE JASIC DISTRIBUTION
The Jasic distribution is a complete development suite. It includes basicPortal with the required Java framework classes such as Struts and JDBC preconfigured. Also included are the following third-party programs, but you can use any J2EE and SQL DB:
- JRockit 8.1 Java Virtual Machine (VM) from BEA Systems or JDK1.4 from IBM or Sun
- Resin 3 App Server or Tomcat 5 or any JSP 2.0 container
- Eclipse 3 IDE with SolarEclipse web applications plug-in
- PostgreSQL 7.4 database
- pgAdmin II database tool (Windows only)
- iReport visual report designer (Windows only)
Variations on this platform are possible. The Java Development Kits (JDKs) from Sun and IBM can be used instead of JRockit, as long as the JDK 1.4+ compatible versions are used. basicPortal has been tested with Resin, Tomcat, and Orion, but other J2EE application servers compatible with JDK 1.4 and JSP 1.2/2.0 can be used. baseBeans recommends the use of Eclipse with the SolarEclipse plug-in as an IDE, however others such as IntelliJ can be used.
PostgreSQL is the recommended database, but any SQL DB would do.
A database administration interface such as pgAdmin II for PostgreSQL is recommended. SQuirreL is another good tool that works with various databases such as PostgreSQL, Oracle, and MySQL.
Developers are encouraged to make platform choices that best suit their needs and the culture of their organizations. However, developers should keep in mind that variations on the platform will require extra configuration to ensure all pieces work together. Also, some development procedures may vary from those specified in other basicPortal documentation if customizations are made.
The Jasic distribution for Windows 2000 can be downloaded in one zipped file from SourceForge.
Liunx works great and is the ideal platfrom. At this time, users of Linux and other Unix-type systems must CVS source, download, install, and configure all components separately.
For all the platfroms, the latest downloads that you need are on the baseBeans.com downloads page.
First, create a directory such as C:\jasic or D:\jasic. It is good practice to keep the entire platform in one directory tree. This makes the system easy to backup and restore, and makes it easy for developers to duplicate the setup on development computers.
Downloading the Jasic distribution (for all users):
From http://www.sourceforge.net/projects/basicportal, download the latest Jasic distribution. The filename will be of the form jasicxxx.zip. Unzip the downloaded file into your \jasic directory.
AFTER DOWNLOADING
It is recommended that you download and install a Netscape (www.netscape.com) or Mozilla (www.mozilla.org) browser. Some tags that work in Internet Explorer may not work in other browsers, so it is best to test on a variety of platforms.
To minimize the possibility of conflicts, make sure that there is only one Java Development Kit on your server. This can be done in the Control Panel -> Add/Remove Programs interface and by searching for files such as javac.exe outside of the Jasic directory. The Java Virtual Machine that comes bundled with Windows should not cause a problem.
Next, put the Java directories in your system variables. If JRockit will be your JDK, go into the Control Panel -> System -> Advanced -> Environment Variables section and make the following changes:
JAVA_HOME should be C:\jasic\jrockit81
PATH should be %JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%
Note: A frequent error in configuration is not seting the one system evntioment path to %JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%.
If you installed Jasic on a drive other than C:, replace C:\ with the proper drive designation for your system.
Bring up a command prompt by running the program command.com (in Start -> Run). Issue the command:
C:\>java -version
java version "1.4.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1)
BEA WebLogic JRockit(R) Virtual Machine (Native Threads, Generational Concurrent Garbage Collector)
If the outcome of the command is consistent with the JDK you have selected for development, you can proceed to the next steps.
For any component installation question, you can refer to cheat sheet on baseBeans.com Cheat Sheet page.
INSTALLING AND CONFIGURING THE DATABASE
You must have some SQL engine to create the tables on, since data is stored in a SQL DB.
To install the bundled PostgreSQL software, first run the PostgreSQL Windows installer in \jasic\pgSQL. Then run the pgAdmin II installer in the same directory. Accept most defaults in the process, other than the installation directories, which can be set to \jasic\PostgreSQL and \jasic\pgAdmin2.
Once the database programs are installed, make sure the PostgreSQL service is started in
Control Panel -> Administrative Tools -> Services. Then run pgAdmin II from the Windows Start menu. Click the icon in the upper left corner to connect to the database. Click OK at the next dialog box to connect as the default superuser named postgres; you may connect with no password from the local computer.
Under Users in the left panel object tree, right-click on postgres and select Change Properties. Give this user a new password for increased security.
Next, select (right-click) localhost -> Create Object -> User. Create a new user called bpuser. Give this user a secure password, and grant the user the ability to create new databases. Take note of the user’s expiration date and set it far into the future if desired.
Exit pgAdmin II and reconnect as bpuser. Select (right-click) localhost -> Create Object -> Database. Create a database called basicportal (no data entry other than the database name is required in the dialog box). It is a good idea to use all lower case names in PostgreSQL.
You will now have to run some prewritten SQL scripts to create the tables for use with basicPortal and some sample table data. These scripts are located in \jasic\bp\WEB-INF\doco. Under Databases in the left panel object tree, select (right-click) basicportal -> SQL. Select Load, navigate to the file \jasic\bp\
WEB-INF\doco\table_create.sql, then select Open and Execute. The basicPortal tables should then be created. Repeat this step for the file \jasic\bp\WEB-INF\doco\table_sample_data.sql.
Table data can be viewed and edited by right-clicking on the table name and selecting View Data. If you will be writing additional modules for basicPortal, you should familiarize yourself with these tables. The table usr contains user information and passwords, and is used to implement logins and security. The table content is used to enable content management, and contains web page data.
For information on how to manipulate these tables by hand, please see the documentation for PostgreSQL (www.postgresql.org) and pgAdmin II (pgadmin.postgresql.org).
Note: You can save yourself time by testing a JDBC connection via something like http://squirrel-sql.sourceforge.net
STARTING THE APPLICATION SERVER
After database installation, the system is ready to be activated. All other Jasic components are preconfigured for easy use.
If you installed Jasic on a drive other than C:, edit the file \jasic\resin-3\conf\resin.conf. Change the drive letter in the following line:
<web-app id='/' app-dir='c:\jasic\bp'>
Also, change the db connection settings.
<init-param url="jdbc:postgresql://localhost:5432/basicportal?autoReconnect=true"/>
<init-param user="bpuser"/>
<init-param password="changeme"/>
Same is true of other app. servers. There is a sample for Tomcat and Resin
Next, start Resin by running the file \jasic\resin-3\bin\httpd.exe. A terminal window will appear, and Resin should report that it is started and listening.
In your web browser, navigate to http://127.0.0.1/test. This will test the database connection, and should display the contents of one user object and one content object. Then navigate to http://127.0.0.1. A sample basicPortal web site should appear. basicPortal is now installed and running!
You need to customize the content and user rights, but that is easy.
If you are configuring your own container, make sure JDBC driver is in commons/lib.
Ex: JDBC Realm setting
<Realm className="org.apache.catalina.realm.JDBCRealm" debug="99" driverName="org.postgresql.Driver" connectionURL="jdbc:postgresql://localhost:5432/ basicportal?autoReconnect=true" connectionName="bpuser" connectionPassword="changeme" userTable="usr" userNameCol="real_email_id" userCredCol="passwrd" userRoleTable="usr" roleNameCol="role_code" />
Ex: App. Context setting
<<Context path="" docBase="c:/jasic/bPproj/bP" debug="0" reloadable="true" crossContext="true">
<Resource name="bppool" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="bppool">
<parameter><name>url</name> <value>jdbc:postgresql://localhost:5432/basicportal?autoReconnect=true</value> </parameter> <parameter><name>driverClassName</name> <value>org.postgresql.Driver</value> </parameter> <parameter><name>maxIdle</name> <value>3</value></parameter> <parameter><name>username</name> <value>bpuser</value> </parameter> <parameter> <name>maxWait</name> <value>5000</value> </parameter> <parameter><name>maxActive</name> <value>10</value> </parameter> <parameter><name>password</name> <value>changeme</value> </parameter> <parameter> <name>removeAbandoned</name> <value>true</value> </parameter> <parameter> <name>removeAbandonedTimeout</name> <value>20</value></parameter>
</ResourceParams> </Context>
In the case of Tomcat, you will also need to copy the dbcp and commons-jar to common/lib, so that the connection pool will work in Tomcat.
hth, .V
Aaron Goldstein wrote:
I downloaded and installed jasic 0.9.8.5. I followed the configuration instructions but when I try to access the application at:
http://127.0.0.1:8080/test
I receive the following error from Resin:
500 Servlet Exception
WEB-INF/web.xml:21: `com.bP.cms.coreBeans.TestServlet' must have a public,
zero arg constructor. Servlets must have public zero-arg constructors.
I haven’t altered the web.xml that came with the application at all and I am running this JVM:
java version "1.4.1_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_03-b02)
Java HotSpot(TM) Client VM (build 1.4.1_03-b02, mixed mode)
Any help is appreciated. Thanks.
Aaron
_______________________________________________ MVC-Programmers mailing list [EMAIL PROTECTED] http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers