Thursday, April 18, 2013
Send JSON data to struts2
Send JSON data to struts2
I found a nice article which points out how the struts2 receives json data from UI and returns the json data as response.
We need to add a dependency in pom.xml
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>${struts2-json-plugin.version}</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>${struts2-json-plugin.version}</version>
</dependency>
In action class just add the interceptor which maps the json data to the actions class.
<action name="jsonTest" class="com.blah.action.JsonTestAction"> <interceptor-ref name="json"> <param name="contentType">application/json</param> </interceptor-ref> <result type="json"/> </action>
Json data can be returned from strust2 action to View in the form of
<action name="jsonTest" method="jsonTest" class="com.blah.action.JsonTestAction">
<result type="json"/>
</action>
<action name="jsonTest" method="jsonTest" class="com.blah.action.JsonTestAction">
<result type="json"/>
</action>
Happy Coding.
--
Thank you.
Regards,
Kaleeswaran.S
Thank you.
Regards,
Kaleeswaran.S
Wednesday, April 17, 2013
Confluence Publisher Plugin with Jenkins
Confluence Publisher Plugin with Jenkins
I integrated confluence publisher plugin with Jenkins. Here are the steps, it may be helpful to some one.
I followed the doxumentation at
https://wiki.jenkins-ci.org/display/JENKINS/Confluence+Publisher+Plugin
1) First I installed the confluence publisher plugin in jenkins. https://wiki.jenkins-ci.org/display/JENKINS/Confluence+Publisher+Plugin
Tuesday, April 16, 2013
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure on Mysql, MAMP and MAC OS
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure on Mysql, MAMP and MAC OS
<!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<!-- MySQL database driver -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.24</version>
</dependency>
public void testTheApp() throws Exception {
Connection conn = null;
try {
// WARNING: Could not obtain connection metadata
// java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:
System.out.println("AppTest started.... ");
Class.forName("com.mysql.jdbc.Driver");
Properties connectionProperties = new Properties();
connectionProperties.put("user", "java");
connectionProperties.put("password", "java");
conn = DriverManager.getConnection("jdbc:mysql://0.0.0.0:8889/java", connectionProperties);
System.out.println("Connection success ...... ");
} catch (Exception e) {
e.printStackTrace();
} finally
{
if (conn != null)
{
try
{
conn.close ();
System.out.println ("Database connection terminated");
}
catch (Exception e) { /* ignore close errors */ }
}
}
}
jdbc:mysql://0.0.0.0:8889/java (Works)jdbc:mysql://172.16.23.59:8889/java (Works)
jdbc:mysql://172.0.0.1:8889/java (Wont work)
Happy Coding :)
Wednesday, April 10, 2013
package javax.servlet does not exist
package javax.servlet does not exist
Add a dependency <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
Happy Coding :)
--
Thank you.
Regards,
Kaleeswaran.S
Thank you.
Regards,
Kaleeswaran.S
html5 chart library
HTML5 chart library
HTML5 and JS library rocks on graphs. Earlier it was little difficult to implement. Now it is very easy.
Highcharts
http://www.highcharts.com/demo/line-time-series/grid
RgraphHTML5 and JS library rocks on graphs. Earlier it was little difficult to implement. Now it is very easy.
Highcharts
http://www.highcharts.com/demo/line-time-series/grid
I have used the RGraph, it is very easy to implement. Refer the doc. There are variety of graphs are available.
http://www.rgraph.net/
http://www.rgraph.net/
amCharts
Chart.js
Float
Tuesday, April 9, 2013
JSON generator on JAVA
JSON generator on JAVA,
http://java.dzone.com/articles/java-api-json-processing-jsr
--
Thank you.
Regards,
Kaleeswaran.S
Interact with Jenkins through Jenkins.jar
Interact with Jenkins through Jenkins.jar
To get the help commands from Jenkins,
java -jar /Users/users/Downloads/jenkins-cli.jar -s http://localhost:8080/jenkins/ help
Results will be likeTo get the help commands from Jenkins,
java -jar /Users/users/Downloads/jenkins-cli.jar -s http://localhost:8080/jenkins/ help
Ref :
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
http://localhost:3579/ci/env-vars.html
https://issues.jenkins-ci.org/browse/JENKINS-11691
https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+CLI
http://localhost:3579/ci/env-vars.html
https://issues.jenkins-ci.org/browse/JENKINS-11691
Trigger a build from terminal
java -jar /Users/user/Downloads/jenkins-cli.jar -s http://localhost:8080/jenkins/ build DemoJob
Jenkins-cli jar can be downloaded from http://localhost:8080/jenkins/cli
Environment variable values can be accessed from shell($FOO, %FOO%) and Ant ( ${env.FOO} ) like
The parameter are available as environment parameters. So e.g. a shell ($FOO, %FOO%) or Ant ( ${env.FOO} ) can access these values.
https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build
Parameterized Comparisions can be specified like ,
http://stackoverflow.com/questions/7908043/jenkins-how-to-decide-which-of-the-following-jobs-should-be-executed
http://stackoverflow.com/questions/7908043/jenkins-how-to-decide-which-of-the-following-jobs-should-be-executed
Instead of Shell command we can use maven or ant as well.
http://stackoverflow.com/questions/11548285/need-ant-condition-example
http://blog.stefanjaeger.ch/2008/02/05/ant-contrib/
http://stackoverflow.com/questions/11548285/need-ant-condition-example
http://blog.stefanjaeger.ch/2008/02/05/ant-contrib/
--
Thank you.
Regards,
Kaleeswaran.S
Monday, April 8, 2013
Subscribe to:
Posts (Atom)