Make SEO friendly URL with Struts 2.5 project
1. For example, download and import TDD-Struts-Blank.zip
2. Add following lines to /pom.xml
<dependency> <groupId>javax.servlet</groupId> <artifactId>javax.servlet-api</artifactId> <version>3.1.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet</groupId> <artifactId>jsp-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency>
2. Add following lines to /src/java/struts.xml
<constant name="struts.action.extension" value=","/> <constant name="struts.enable.SlashesInActionNames" value="true"/>
Final struts.xml is as:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.5//EN" "http://struts.apache.org/dtds/struts-2.5.dtd"> <struts> <constant name="struts.enable.DynamicMethodInvocation" value="false" /> <constant name="struts.devMode" value="true" /><constant name="struts.action.extension" value=","/><constant name="struts.enable.SlashesInActionNames" value="true"/><package name="default" namespace="/" extends="struts-default"> <default-action-ref name="index" /> <global-results> <result name="error">/WEB-INF/jsp/error.jsp</result> </global-results> <global-exception-mappings> <exception-mapping exception="java.lang.Exception" result="error"/> </global-exception-mappings> <action name="index"> <result type="redirectAction"> <param name="actionName">Hello</param> <param name="namespace">/</param> </result> </action> </package> <include file="blank.xml"/> <!-- Add packages here --> </struts>
3. Modify /src/java/blank.xml as following:
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"> <struts> <package name="blank" namespace="/" extends="struts-default"> <action name="p/*/*" class="blank.HelloAction"><param name="code">{1}</param><param name="slug">{2}</param><result>/WEB-INF/jsp/blank/Hello.jsp</result> </action> </package> </struts>
4. Modify /src/java/blank/HelloAction.java as following:
package blank; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.opensymphony.xwork2.ActionSupport; public class HelloAction extends ActionSupportimplements org.apache.struts2.interceptor.ServletRequestAware, org.apache.struts2.interceptor.ServletResponseAware{ public String execute() throws Exception { setMessage(getText(MESSAGE)); return SUCCESS; } public static final String MESSAGE = "message"; private String message; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; }private String code;public String getCode() {return code;}public void setCode(String code) {this.code = code;}private String slug;public String getSlug() {return slug;}public void setSlug(String slug) {this.slug = slug;}private HttpServletResponse response;@Overridepublic void setServletResponse(HttpServletResponse response) {this.response = response;}private HttpServletRequest request;@Overridepublic void setServletRequest(HttpServletRequest request) {this.request = request;}}
Tuesday, May 31, 2016
at
3:15 AM
Initiative Struts 2.5 project for test driven development (TDD)
1. Create Dynamic Web project, for example at C:\Startup
2. Convert to Maven project
3. Download and unzip TDD-Struts-Blank.zip, for example at C:\Blank
4. Add following lines to C:\Startup\pom.xml, then build
5. Add following lines to C:\Startup\pom.xml, then build
6. Run following commands, for example on Windows 7
7. Remove current source folder and add 2 new source folder at c:\Startup\src\java and c:\Startup\src\tests
8. Run following commands, for example on Windows 7
2. Convert to Maven project
3. Download and unzip TDD-Struts-Blank.zip, for example at C:\Blank
4. Add following lines to C:\Startup\pom.xml, then build
<dependencies> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-core</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-core</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>org.apache.struts</groupId> <artifactId>struts2-junit-plugin</artifactId> <version>2.5</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> </dependency> </dependencies>
5. Add following lines to C:\Startup\pom.xml, then build
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.6</version> <executions> <execution> <id>copy-dependencies</id> <phase>build</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <overWriteReleases>true</overWriteReleases> <overWriteSnapshots>true</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> </configuration> </execution> </executions> </plugin>
6. Run following commands, for example on Windows 7
md c:\Startup\src\java md c:\Startup\src\tests
7. Remove current source folder and add 2 new source folder at c:\Startup\src\java and c:\Startup\src\tests
8. Run following commands, for example on Windows 7
copy C:\Blank\src\java\* C:\Startup\src\java copy C:\Blank\src\tests\* C:\Startup\src\tests copy C:\Blank\WebContent\WEB-INF\* C:\Startup\WebContent\WEB-INF
Tuesday, May 31, 2016
at
12:28 AM
"The mbstring extension is missing." error when install phpMyAdmin on Ubuntu server 16.04
sudo apt-get install php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0 sudo service apache2 restart
Sunday, May 29, 2016
at
11:37 PM
Skill - Develop java desktop application using test driven development (TDD)
Develop java desktop application using test driven development (TDD) with Swing and SWT [ www.eclipse.org/swt/ ]
Test java swing application in a functional way with FEST-Swing [ code.google.com/archive/p/fest/ ]
Test java swt application in a functional way with SWTBot [ wiki.eclipse.org/SWTBot ]
Set up continuous integration server for java desktop application development with TeamCity, Jenkins
Monday, May 23, 2016
at
8:34 PM
Skill - Develop java web application using test driven development (TDD)
Develop java web application using test driven development (TDD) with Apache Struts [ struts.apache.org ] and Spring [ spring.io ]
Test java web application in a functional way with Arquillian Graphene [ arquillian.org/modules/graphene-extension/ ]
Set up continuous integration server for java web application development with TeamCity, Jenkins
Monday, May 23, 2016
at
8:19 PM
Skill - Develop native android application using test driven development (TDD)
Develop native android application using test driven development (TDD) with Robolectric [ robolectric.org ]
Test native android application in a functional way with Arquillian Droidium [ arquillian.org/modules/droidium-extension/ ]
Set up continuous integration server for native android application development with TeamCity, Jenkins
Articles
Monday, May 23, 2016
at
7:50 PM
Install Android Studio 2.0 on Ubuntu Desktop 16.04
Open terminal and run the commands like this:
sudo add-apt-repository -y ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer oracle-java7-set-default sudo add-apt-repository ppa:paolorotolo/android-studio sudo apt-get update sudo apt-get install android-studio sudo apt-get install lib32stdc++6 cp /usr/share/applications/android-studio.desktop ~/Desktop sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install libncurses5:i386 libstdc++6:i386 zlib1g:i386 sudo apt-get install mesa-utils sudo apt-get install android-tools-adb sudo apt-get install adb
Sunday, May 22, 2016
at
8:29 PM
Trần Đình Thoại on EscapeNotes project
On this project, I used java to:
+ Develop EscapeNotes, a complex tool for migrating data from Lotus Notes to Salesforce and Azure Search
+ I develop whole application.

















+ Develop EscapeNotes, a complex tool for migrating data from Lotus Notes to Salesforce and Azure Search
+ I develop whole application.

















Monday, May 9, 2016
at
12:32 AM
Install and customize Pedatus 1.3 - Micro Search Engine | Tutorial of Orinus - JavaScript Sandbox
1. Download Pedatus 1.3 - Micro Search Engine
2. Unpack pedatus-1.3-micro-search.zip
3. Copy [Unpacked Folder]/search to [Source Folder]/search, eg. C:\Source\search
4. Open web page in browser: http://localhost/system/
a. Domain
This text box stores domain for new engine.
For example, if we change to 'search.paesia.com', we can access new engine by web page: http://search.paesia.com
b. Folder
This text box stores sub-folder for new engine.
For example, if we change to 'search', we can access new engine by web page: http://localhost/search/
c. Quota (in MB)
This text box stores maximum size of data for new engine.
For example, if we change to '1024', no change has been made after data size reach 1GB.
d. Total Run-time (minutes / day)
This text box stores maximum executing time (in minute) per day for spiders.
For example, we change to '102400'.
e. Run Scheduled Scripts
This check box specify that spider can be runned or not.
Please check this box.
8. Click on 'Save' button
a. Replace [Source Folder]/search/logo.png with new one.
b. Check on 'logo.png' row. Click on 'Edit File' button.
a. Modify [Source Folder]/search/en.lang
a. Modify [Source Folder]/search/ads-left.vm
a. Modify [Source Folder]/search/ads-right.vm
a. Modify [Source Folder]/search/analytics.vm
2. Unpack pedatus-1.3-micro-search.zip
3. Copy [Unpacked Folder]/search to [Source Folder]/search, eg. C:\Source\search
4. Open web page in browser: http://localhost/system/
5. Click on "Login" button
6. Click on "Add" button
7. Enter information of new engine
a. Domain
This text box stores domain for new engine.
For example, if we change to 'search.paesia.com', we can access new engine by web page: http://search.paesia.com
b. Folder
This text box stores sub-folder for new engine.
For example, if we change to 'search', we can access new engine by web page: http://localhost/search/
c. Quota (in MB)
This text box stores maximum size of data for new engine.
For example, if we change to '1024', no change has been made after data size reach 1GB.
d. Total Run-time (minutes / day)
This text box stores maximum executing time (in minute) per day for spiders.
For example, we change to '102400'.
e. Run Scheduled Scripts
This check box specify that spider can be runned or not.
Please check this box.
8. Click on 'Save' button
9. Check on 'search.paesia.com / search' row. Click on 'Open' button.
10. Check on 'search.paesia.com'. Click on 'Import' button.
11. Choose pedatus-1.3-micro-search.zip file. Click on 'Import' button.
12. Change logo
a. Replace [Source Folder]/search/logo.png with new one.
b. Check on 'logo.png' row. Click on 'Edit File' button.
c. Choose [Source Folder]/search/logo.png file
d. Change 'Filename' text box to 'logo.png'. Click on 'Save' button.
13. Change site title
a. Modify [Source Folder]/search/en.lang
Please modify 'index_page_title' value
b. Check on 'en.lang' row. Click on 'Edit File' button.
c. Choose [Source Folder]/search/en.lang
d. Change 'Filename' text box to 'en.lang'. Click on 'Save' button.
14. Change ads on left
a. Modify [Source Folder]/search/ads-left.vm
b. Update ads-left.vm similar to 13b -> 13d
15. Change ads on right
a. Modify [Source Folder]/search/ads-right.vm
b. Update ads-right.vm similar to 13b -> 13d
16. Change analytics
a. Modify [Source Folder]/search/analytics.vm
b. Update analytics.vm similar to 13b -> 13d
Monday, May 9, 2016
at
12:08 AM
Install and configure Orinus 1.2 for Linux | Tutorial of Orinus - JavaScript Sandbox
0. Assume:
+ We use Ubuntu
+ We has installed JRE 1.6
+ We has added 'java' to execute path
+ Local IP of server is 192.168.1.113
1. Download Orinus 1.2 for Linux
2. Unpack Orinus-1.2-linux.zip
3. Copy Orinus-1.2-linux/Orinus to application folder, eg. ~/programs/orinus
4. Modify [App Folder]/cfg/config.properties, add following line:
5. Grant execute right for [App Folder]/orinus, eg. ~/programs/orinus/orinus
6. Change current folder to [App Folder], eg. ~/programs/orinus
7. Run Orinus
8. Map 8080 port to 80 port
a. Data Storage Path
This text box stores path to folder saving all data of application. Leave blank for default. Default path is [App Folder]\dat
b. Server Port
This text box stores port that application use for web service. Leave blank for default. Default value is 80.
c. Administration Web Path
This text box stores web folder of administration section of application. Default is 'system'.
For example, if we change to 'admin'. To access administration section, we open web page: http://192.168.1.113/admin/
d. Preserved Domains
This text box stores list of domain for application (separated by '|').
For example, if we change to '|192.168.1.113|www.paesia.com|www.pedatus.com|', we can access administration section by opening following web page:
+ http://192.168.1.113/system/
+ http://www.paesia.com/system/
+ http://www.pedatus.com/system/
e. Administration Password
This text box stores password for accessing administration section. Default is empty password (no password).
13. Click on 'Save' button
14. If we change server port, we need to restart application.
+ We use Ubuntu
+ We has installed JRE 1.6
+ We has added 'java' to execute path
+ Local IP of server is 192.168.1.113
1. Download Orinus 1.2 for Linux
2. Unpack Orinus-1.2-linux.zip
3. Copy Orinus-1.2-linux/Orinus to application folder, eg. ~/programs/orinus
4. Modify [App Folder]/cfg/config.properties, add following line:
port=8080 hosts=|192.168.1.113|
5. Grant execute right for [App Folder]/orinus, eg. ~/programs/orinus/orinus
sudo chmod u+x ~/programs/orinus/orinus
6. Change current folder to [App Folder], eg. ~/programs/orinus
cd ~/programs/orinus
7. Run Orinus
./orinus -silent&
8. Map 8080 port to 80 port
sudo /sbin/iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
9. Open web page in browser: http://192.168.1.113/system/
10. Click on "Login" button
11. Click on "Settings" button
12. Modify settings for application
a. Data Storage Path
This text box stores path to folder saving all data of application. Leave blank for default. Default path is [App Folder]\dat
b. Server Port
This text box stores port that application use for web service. Leave blank for default. Default value is 80.
c. Administration Web Path
This text box stores web folder of administration section of application. Default is 'system'.
For example, if we change to 'admin'. To access administration section, we open web page: http://192.168.1.113/admin/
d. Preserved Domains
This text box stores list of domain for application (separated by '|').
For example, if we change to '|192.168.1.113|www.paesia.com|www.pedatus.com|', we can access administration section by opening following web page:
+ http://192.168.1.113/system/
+ http://www.paesia.com/system/
+ http://www.pedatus.com/system/
e. Administration Password
This text box stores password for accessing administration section. Default is empty password (no password).
13. Click on 'Save' button
14. If we change server port, we need to restart application.
Monday, May 9, 2016
at
12:03 AM
Install and configure Orinus 1.2 for Windows | Tutorial of Orinus - JavaScript Sandbox
1. Download Orinus 1.2 for Windows
2. Unpack Orinus-1.2-win.zip
3. Run Orinus_Installer.exe
a. Data Storage Path
This text box stores path to folder saving all data of application. Leave blank for default. Default path is [App Folder]\dat
b. Server Port
This text box stores port that application use for web service. Leave blank for default. Default value is 80.
c. Administration Web Path
This text box stores web folder of administration section of application. Default is 'system'.
For example, if we change to 'admin'. To access administration section, we open web page: http://localhost/admin/
d. Preserved Domains
This text box stores list of domain for application (separated by '|').
For example, if we change to '|localhost|www.paesia.com|www.pedatus.com|', we can access administration section by opening following web page:
+ http://localhost/system/
+ http://www.paesia.com/system/
+ http://www.pedatus.com/system/
e. Administration Password
This text box stores password for accessing administration section. Default is empty password (no password).
9. Click on 'Save' button
10. If we change server port, we need to restart 'Orinus - JavaScript SandBox' windows service.
2. Unpack Orinus-1.2-win.zip
3. Run Orinus_Installer.exe
4. "Orinus - JavaScript SandBox" windows service has been installed and runned:
5. Open web page in browser: http://localhost/system/
6. Click on "Login" button
7. Click on "Settings" button
8. Modify settings for application
a. Data Storage Path
This text box stores path to folder saving all data of application. Leave blank for default. Default path is [App Folder]\dat
b. Server Port
This text box stores port that application use for web service. Leave blank for default. Default value is 80.
c. Administration Web Path
This text box stores web folder of administration section of application. Default is 'system'.
For example, if we change to 'admin'. To access administration section, we open web page: http://localhost/admin/
d. Preserved Domains
This text box stores list of domain for application (separated by '|').
For example, if we change to '|localhost|www.paesia.com|www.pedatus.com|', we can access administration section by opening following web page:
+ http://localhost/system/
+ http://www.paesia.com/system/
+ http://www.pedatus.com/system/
e. Administration Password
This text box stores password for accessing administration section. Default is empty password (no password).
9. Click on 'Save' button
10. If we change server port, we need to restart 'Orinus - JavaScript SandBox' windows service.
Sunday, May 8, 2016
at
4:02 PM
Blog Archive
-
▼
2016
(29)
-
▼
May
(17)
- Make SEO friendly URL with Struts 2.5 project
- Initiative Struts 2.5 project for test driven deve...
- Struts 2 in Action
- "The mbstring extension is missing." error when in...
- Skill - Develop java desktop application using tes...
- Skill - Develop java web application using test dr...
- Skill - Develop native android application using t...
- Skills of Trần Đình Thoại
- Install Android Studio 2.0 on Ubuntu Desktop 16.04
- Trần Đình Thoại on EscapeNotes project
- Tutorial of Orinus - JavaScript SandBox
- Install and customize Pedatus 1.3 - Micro Search E...
- Install and configure Orinus 1.2 for Linux | Tutor...
- Install and configure Orinus 1.2 for Windows | Tut...
- Create search engine | Tutorial of Orinus - JavaSc...
- Create basic script | Tutorial of Orinus - JavaScr...
- Screenshots of Orinus - JavaScript SandBox
-
▼
May
(17)