Saturday, June 7, 2008

Free Java Technology Cources!

Dear Readers,
If you are interested with free online courses on java technologies, could be a good platform for you. Shan Shin teaches the courses. Sang Shin is presently working for Sun Microsystems as a Technology architect, consultant, and evangelist. After a successful completion of any courses you are awarded with the Certificate from java passion. I suggest you all to register for at least one source at a time. Detail about the schedule and courses can be seen at the course home page. Currently he is offering the following courses and all are totally free.

  • Java Programming (with Passion!)
  • Performance, Debugging, Testing, Monitoring, and Management (with Passion!)
  • Java EE Programming (with Passion!)
  • Ajax Programming (with Passion!)
  • Web Services Programming (with Passion!)
  • Sun Java System Identity Manager (with Passion!)
  • Java FX Programming (with Passion!)
  • JRuby on Rails (with Passion!)
  • Groovy and GRails (with Passion!)
  • Java ME Mobility Programming (with Passion!)


Friday, May 9, 2008

How to read a Java Session Back bean of a JSF page from JSP pages

In this section I am describing about accessing a JSF back bean from a JSP page.
Lets us take an example of a java back bean ServerInfo for a JSF page

// File Name :
public class ServerInfo {
String server;
String environment;

public String getServer() {
return server;

public void setServer(String server) {
this.server = server;

Bean is defined on faces-config.xml as following


Now lets take an example of JSF page section that sets up the java bean ServerInfoBean from the input text of the form as shown below

//File name: index.jsp
<h:form id="serverForm">
<h:outputLabel for="serverName">
<h:outputText value="Enter the Server Name"/>
<h:inputText id="serverName" value="#{ServerInfoBean.server}" required="true"/>
<h:message for="serverName"/>
<h:outputLabel for="environment">
<h:outputText value="Select Environment"/>

Now in process.jsp the back bean can be accessed as shown below

File name : process.jsp
ServerInfo mbean = (ServerInfo) request.getSession().getAttribute("ServerInfoBean");
String server = mbean.getServer();
Out.print(“server name read from the jsf back bean =” +server)



Wednesday, May 7, 2008

Read custom created XML file from a Groovy/Java class in a J2EE Web Application

I have a following xml file that I created to store the application name and Application Owner email address

//File name: EmailInfo.xml

< emailInfo>
< application> < name> Saleways < /name> < email>< /email> < /application>
< application> < name> Mercantile House< /name> < email>< /email> < /application>
< application> < name> BishowShop< /name> < email>< /email> < /application>
< /emailInfo>

Now I have a J2EE application that contains a Groovy or a Java class that access the above XML file. The method to access above html file using Groovy is presented below. Note that the xml file resides on the same location where the class exists.

def appName=[]
def appEmail=[] url= this.getClass().getClassLoader().getResource("EmailInfo.xml"); uri = new URI(url.toString())
File f=new File(uri)
def emailInfo = new XmlSlurper().parse(f) //Specific to groovy {appName += it} //specific to groovy {appEmail += it} // specific to groovy

You simply can modify the above code for java classes. The final result for the above code is that appName contains the list of the Name and appEmail contains the list of the Email address. You can put it into hash map as below.

def emailMap=[:] //define an empty map
for(i in 0 .. appName.size()-1)

Now you simply can access the email address of a person as shown below

println emailMap[“Mercantile House”] //prints


Welcome to my Technical Blog!

I create this blog so that i can share all the technical stuffs that i came across as a software engineer in J2EE Technologies. I will be glad to receive your feedback for every post and share your idea on the postings.
Welcome you all.


 © 2006-2010