Query :
update mds_dc_weekly set `TARGET_WEEKLY`= replace( replace(`TARGET_WEEKLY`, ',', ''), '"', '' )
$once=$data1['calculategiga'];
$calculategiga = str_replace(",","",$once);
ORACLE-PHP
Jumat, 23 Mei 2014
Rabu, 18 Desember 2013
Virtual Host Local
pada file tsb
#NameVirtualHost *:80 dihilangkan # menjadi NameVirtualHost *:80
dan ketikkan virtual host spt dibawah :
<VirtualHost *:80>
ServerAdmin admin@localhost
DocumentRoot C:/xampp/htdocs
ServerName localhost
<Directory "C:/xampp/htdocs">
Options indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@localhost
DocumentRoot C:/xampp/htdocs/main_portal/
ServerName sla
<Directory "C:/xampp/htdocs/main_portal">
Options indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
2. httpd.conf - tidak ada yang dirubah
3. system32 - drivers - etc - hosts
#127.0.0.1 localhost menjadi 127.0.0.1
127.0.0.1 sla -> sesuaikan dengan server name yang di set pada virtual host
output nya :
sebelumnya menggunakan ip, http://localhost/main_portal/
Senin, 02 Desember 2013
Membuat java class
package examples;
/**
*
* @author Praktek
*/
public class TestBean implements java.io.Serializable
{
}
Index.jsp
<%--
Document
: index
Created on : Dec 1, 2013, 4:38:17 PM
Author
: Praktek
--%>
<%@page
contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<body>
<%-- Create an instance of the
bean --%>
<jsp:useBean
id="myBean" class="examples.TestBean"
scope="session"/>
<%
myBean.setFirstName("Novetri");
myBean.setLastName("Yelia");
myBean.setAge(23);
%>
<jsp:setProperty
name="myBean" property="age" value="23"/>
<%-- Copy the parameters into
the bean --%>
<jsp:setProperty
name="myBean" property="*"/>
The bean values are:<br>
First Name: <jsp:getProperty
name="myBean" property="firstName"/><br>
Last Name: <jsp:getProperty
name="myBean" property="lastName"/><br>
Age: <jsp:getProperty
name="myBean" property="age"/><br>
<jsp:forward
page="/halamanbaru.jsp"/>
</body>
</html>
TestBean.java
/*
* To change this template, choose Tools |
Templates
* and open the template in the editor.
*/
package examples;
/**
*
* @author Praktek
*/
public class TestBean implements
java.io.Serializable {
protected String firstName;
protected String lastName;
protected int age;
public TestBean() {
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String aFirstName)
{
firstName = aFirstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String aLastName) {
lastName = aLastName;
}
public int getAge() {
return age;
}
public void setAge(int anAge) {
age = anAge;
}
}
Halamanbaru.jsp
<%--
Document
: halamanbaru
Created on : Dec 1, 2013, 5:50:38 PM
Author
: Praktek
--%>
<%@page
contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
Halaman Baru
<%
HttpSession sesi = request.getSession();
examples.TestBean kacangku =
(examples.TestBean)sesi.getAttribute("myBean");
out.print("<br>" +
kacangku.getFirstName());
out.print("<br>" +
kacangku.getLastName());
out.print("<br>" +
kacangku.getAge());
%>
</body>
</html>
Output:
Menghitung Luas Segitiga dengan Java
menghitung segitiga
1.
Form Segitiga (index.jsp)
<%--
Document : index
Created on : Nov 24, 2013, 4:52:08 PM
Author : Praktek
--%>
<%@page
contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD
HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="hasil.jsp" method="POST">
<table border="1">
<tbody>
<tr>
<td>Alas</td>
<td><input
type="text" name="txtalas" value=""
/></td>
</tr>
<tr>
<td>Tinggi</td>
<td><input
type="text" name="txttinggi" value=""
/></td>
</tr>
<tr>
<td></td>
<td><input
type="submit" value="Luas" /></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
2.
Class Segitiga (Segitiga.java)
/*
* To change this template, choose Tools |
Templates
* and open the template in the editor.
*/
package tes.segitiga;
/**
*
* @author Praktek
*/
public class Segitiga
{
private double alas,
tinggi;
public Segitiga(){
}
public Segitiga(String a, String t){
alas = Double.parseDouble(a) ;
tinggi = Double.parseDouble(t) ;
}
public void isiAlas(String a){
alas = Double.parseDouble(a) ;
}
public void isiTinggi(String t){
tinggi = Double.parseDouble(t) ;
}
public double luas(){
return alas*tinggi/2;
}
public String toString(){
String hasil;
hasil = "Alas: "+ alas +
"<br>Tinggi:" + tinggi;
hasil += "<br> Luas :" +
String.valueOf(luas());
return hasil;
}
}
3. Hasil.jsp
<%--
Document : hasil
Created on : Nov 24, 2013,
5:22:55 PM
Author : Praktek
--%>
<%@ page import="tes.segitiga.Segitiga" %>
<%@page contentType="text/html"
pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta
http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>JSP
Page</title>
</head>
<body>
<%
String sAlas =
request.getParameter("txtalas");
String sTinggi =
request.getParameter("txttinggi");
Segitiga tiga = new
Segitiga(sAlas,sTinggi);
out.print(tiga);
%>
</body>
</html>
Langganan:
Postingan (Atom)


