Archive

Posts Tagged ‘J2EE’

Coldfusion and J2EE

August 25, 2008 ppshein Leave a comment

Normally, different language of web programmings are not easy to integrate in the same web page. Although you want to integrate two programming languages in the same webpage, you gotta separate such coding in different portion in <iframe> tag or something else. In CFMX, you don’t need to do like anymore. If you wanna embed in J2EE tags in CFM page, use <cfimport> tag then. Here is simple coding :

<cfimport taglib=”/WEB-INF/lib/random.jar” prefix=”myrand”>
<myrand:number id=”randPass” range=”000000-999999″ algorithm=”SHA1PRNG” provider=”SUN” />
<cfset myPassword = randPass.random>
<cfoutput>
Your password is #myPassword#<br>
</cfoutput>

Big Credit to : http://livedocs.adobe.com/coldfusion/6/Developing_ColdFusion_MX_Applications_with_CFML/Java3.htm#1134309

Categories: J2EE, coldfusion Tags: , ,

The beginning of JSP

August 25, 2008 ppshein Leave a comment

There are so many extension-less web programming in Web developement environment such as Ruby, PHP, JSP and so on. Among them, I want to tell about the simple coding of JSP. Honestly, I’m just beginner to learn JSP, especially J2EE. Because, I just want to know some applications based on Sun Java. Ok, let’s go…

Here is simple JSP file and named as greeting.jsp

<html>
<body>
Hello World!
<br>
Current time is <%= new java.util.Date() %>
</body>
</html>

And create web.xml file and here is coding needed to be in this file.

<?xml version=”1.0″ encoding=”ISO-8859-1″?>
<!DOCTYPE web-app PUBLIC ‘-//Sun Microsystems, Inc.//DTD Web
Application 2.3//EN’ ‘http://java.sun.com/dtd/web-app_2_3.dtd’>
<web-app>
<display-name>Hello2</display-name>
<description>no description</description>
<servlet>
<servlet-name>greeting</servlet-name>
<display-name>greeting</display-name>
<description>no description</description>
<jsp-file>/greeting.jsp</jsp-file> <!– what gets called –>
</servlet>
<servlet-mapping>
<servlet-name>greeting</servlet-name>
<url-pattern>/greeting</url-pattern> <!– URL from browser –>
</servlet-mapping>
</web-app>

Then, open tomcat manager and create folder name as hello. Create build folder, then copy above greeting.jsp file in this folder, then create WEB-INF folder in build folder. Finally, web.xml file into WEB-INF.

Open your Internet Explorer or Firefox, and can run as http://localhost:8080/hello/greeting. How? It’s quite simple, right?

Categories: J2EE Tags: , ,