printwriter

Servlet Properties Scope

Attribute is present in three Servlet API objects (ServletContext, HttpSession and HttpServletRequest) object in the collection. Simply put, we can consider that they are a collection of key-value pairs. There is also scope for property 3, the Contex

Download function, when the user clicks to download, pop-up "Save, Cancel" box, if a user without any click, point, the server will not hold live out.write the servlet

package com.demo; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.ht

DOM to create the node (switch)

package com.inspur.java.xml; import java.io.File; import java.io.PrintWriter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform

birt debugging sql statement

First, click the dataset you want to debug. In the script beforOpen event fill out the following code. importPackage( Packages.java.io ); out = new PrintWriter( new FileWriter("c:/debuginfo.txt", true ) ); out.println("queryText:-->"+ this.queryTe

Send post data through the java simulation

public static String sendPost(String url, List<PostValue> parameters) { String result = "";// The results returned by BufferedReader in = null;// Read the response input stream PrintWriter out = null; StringBuffer sb = new StringBuffer();// Pro

webwork / Struts 2 to achieve multi-file upload without refresh page

This demo is implemented using webwork, and in principle the same as with Struts 2. Multi-file upload and page refresh no effect, with iframe technology without refresh the page. Upload is successful, the success of the background to the front desk upload

Use commons-fileupload iframe without refreshing the page to achieve multi-file upload

The use of commons-fileupload-1.2.2.jar and commons-io-2.0.1.jar two components. Background UploadServlet.java: package upload; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Iterator; import java.util.List;

BufferedOutputStream

First, let me look at the volume, refers to the amount of data on tens of millions. Example: SMS has a history table, the data has tens of millions of pieces of data to back up data to a text file, that is, execute the following SQL result set and then wr

mysql local backup to solve garbage problem

public void dump (String ip, String subarea) throws IOException {/ / Local backup SimpleDateFormat format = new SimpleDateFormat ("yyyy-MM-dd"); String sAccount = "-uroot"; / / Account String sPassword = "-proot"; / / pa

small example servlet

web.xml adding <servlet> <servlet-name>HelloWorld</servlet-name> <servlet-class>com.kong.rd.ivr.memcached.monitor.MemcachedMonitorAction</servlet-class> </servlet> <servlet-mapping> <servlet-name>HelloW

socket, nio socket and nio socket MINA framework summary

Transfer http://blog.csdn.net/lcllcl987/archive/2007/04/16/1566114.aspx nio learning: Recently spent time to study a little nio, and its open-source framework MINA, the experience is summarized as follows: 1: Traditional socket: blocking traffic every tim

With a custom tag library page in English

Choose a different language for JSP pages <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <html> <head> <title>welcome to hello jsp</title> </head> <body> <p><font size=7>Welc

jquery + json - to take back a jsonObject object

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Untitled Document</title> <script ty

Flex and servlet communication (Httpservice)

Prior to flex and java communication has been used remoteobject, today tried it Httpservice, specific method, please read on: 1 Open the eclipse, the new web project engineering, named servletTest 2 Add the following code inside the web.xml file <servl

Struts2 + JSON ExtJS development

I started to want to use struts2 the json-plugin, but with the Internet Some say json json-plugin data format generated some problems, it is recommended to use the json-lib plugin, I have not much time to verify the json-plugin in the end Can, So the

ExecutorService the way for multi-thread pool thread

ExecutorService using Java 5's the way the thread pool for multi-threaded, multi-user simulated the client sends a request to the same server .1. Server package sterning; import java.io.BufferedReader; import java.io.IOException; import java.io.InputS

ascii java implementation and Chinese Huzhuan

package demo; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; / ** * @ Date 2009-3-11 * @ Author Xing, Xiudong * @ Email: xingxiuodng [at] gmail.com * @ Index: http://blog.csdn.net/xxd851116 * /

The Ajax framework jquery garbled solution

1. The following code for the server-side access to request information Servlet, real time may be used struts, etc. package com.adu; import java.io.IOException; import java.io.PrintWriter; import java.net.URLDecoder; import javax.servlet.ServletException;

(Json learning b) need to import the jar using the json package _Json

"Greenboy:" json need to import the jar using the package (the need to understand, avoid, when writing the project, there are many issues for two hours debugging my own sad hey ah) json-lib-2.3-jdk15.jar commons-beanutils-1.7.0.jar commons-httpc

JSON Learning III -> Online Authentication (via)

Server-side: Eclipse + tomcat / * @ Author: LKP * Company: mobiscloud * 2011-5-16 * / public class JSONDemoServlet extends HttpServlet { / ** * * / private static final long serialVersionUID = 12323L; private List <User> list; / ** * Processing the

servlet dispatcher Chinese garbled jump page

Today, Oracle database, do a test, a personnel management system by writing to use the Oracle database. When writing the page, would like to login, get the page to jump to the entry of personnel information page, but log entry after the jump to the p

In the jsp page using JFreeChart draw Gantt

Recently the project requirements, the need to generate a Gantt chart web page, browse the data, the final JFreeChart achieved by drawing in the jsp page Gantt chart. Here to share with you some of my harvest. First, sticking out of the important code for

jquery.form upload files, does not perform seccess function, not receiving the returned json solution

js code $(function() { // Initialize ajaxForm $('#upForm').ajaxForm({ dataType:'text', type:'POST', clearForm:true, // clear all form fields after successful submit resetForm:true, // reset the form after successful submit beforeSubmit:check, success:func

How the statistics of visits to your site and get JAVA visitor IP

package com.eaie.system; import java.io.FileOutputStream; import java.io.InputStream; import java.io.PrintWriter; import java.net.MalformedURLException; import java.net.URL; import java.util.Enumeration; import java.util.Set; import javax.servlet.Req

Can not be configured in the web.xml problem

Custom tag library, can not be configured in the web.xml <taglib> problem because: The configuration does not require servlet 2.3 <jsp-config> label, servlet 2.4 container <taglib> <jsp-config> in need. (In fact, the distinction be

Infinite pole of the fully automated configuration menu platform (to be optimized in the .. Please wait message)

Keywords: infinite pole configuration menu of the fully automated platform How to use: the application server starts automatically load the method, the purpose is to generate menus.txt and menus.bat file. Change the menu every time when the contents

Facebook BigPipe Technology

Application on the web, from html to produce, to the client browser rendering, there are three important components: 1.html generated in the service side 2. Network transmission 3. Browser rendering Html generated in the process, may be used in cache

java set file attributes

package com.wujc.hidden; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; /** * * 1. When in Java.io , If an operation, and determine whether to hide the use File.ishiden() Determine whether the

$. GetJSON. Callback function is not valid

Jquery out a bit today, the $. GetJSON (sUrl, mData, fCallback); This can be cross-domain request Reference jquery api demo is very easy to get However, their action in the request is invalid when the callback function js $ ("# Btn_json"). Click

Exception in thread "main" java.lang.NullPointerException

import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Collections; import j

phprpc connected simple java and flex examples

Online heard phprpc, Oh, and instead want to use it to connect java with flex, I am relatively poor perception of code, carrying the sword in the mountains, andot, origin edge off, network Weiwei, under the guidance of people such as cattle When he f

Ajax Learning (xml application)

/ / Server ................ public class AJAXXmlServer extends HttpServlet { protected void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //============= Written text / xml response.setContentType

Multithreaded Java Socket Programming Example

This as a learning Sun Weiqin <<Java Network programming with >> study notes it. ExecutorService them to use Java 5 in a way that the thread pool for multi-threaded, multi-user simulated the client sends a request to the same server. 1. S

First test jquery AJAX

At school, with our teacher was using jquery. At that time felt that a good simple, but that is the node function The nodes -> nodes corresponding to the operation -> return value. : ~ ~ Thinking is clear, but the reality is that I get a little

common-fileupload to upload and download files

Use common-fileupload form for file uploading and downloading functions, the class encapsulates a WebFileService import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.P

Upload files using common fileupload

1.upload.java File : package test; import java.io.File; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import java.util.Iterator; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpS

common-fileupload Help

common-fileupload Jakarta project team is developing a very powerful file upload component The following describes the first to upload files to the server ( Multiple file upload ): import javax.servlet.*; import javax.servlet.http.*; import java.io.*; imp

The use of the servlet3 tomcat7

In tomcat7 in web.xml file structure can not, while the servlet can be configured by annotations. Here is a simple example. Servlet3.0 while eclipse3.6 also supports automatic statement. And servlet3.0 using asynchronous processing, performance has i

Using XMLHttpRequest object is receiving and processing XML data

1. Create a new html file. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>ajaxxml.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv=

About positioned update are not supported exception summary

Today, the project encountered a positioned update are not supported this exception Look at the source code it UserAction.java public class UserAction extends ActionSupport { private String password; private User user; private String validateCode; private

ajax development and application of

ajax in the eyes of many programmers is a very complex or unfamiliar words, in fact, AX is not complicated, since the AJAX technology came out, have introduced the framework of hype, and made technical developers can not start, baidu google there are many

An example program Java Socket

Communication through the TCP protocol Java programming through Socket, will not be difficult, the general common is the following small example. Probably will be able to understand Socket programming methods. import java.io. *; import java.net .*; p

Simple example of network communication

Example comes from thinking in Java import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.Scanner; import com.sun.org.ap

jasperreports generated html

public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try{ GetAndPostExample sqlConn = new GetAndPostExample(); String path = "D:\\bems\\workspace\\flex_html\\src\\jspreport\\flexhtml.jasp

Servlet's doGet () and doPost () difference

doGet () will display the string in the url behind such http://localhost:8080/test?username=zhangsan&password=lisi. This is very unsafe. The doPost () will not. The advantage and get the page is submitted through history.back (). However, the dat

LINUX TOMCAT application to modify the server IP environment

public class ChangeIp extends HttpServlet { protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Process proc = Runtime.getRuntime().exec("/bin/bash", null, new File("/bin")); PrintWriter out

LINUX environment TOMCAT application server IP change

public class ChangeIp extends HttpServlet { protected void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { Process proc = Runtime.getRuntime().exec("/bin/bash", null, new File("/bin")); PrintWriter out

Client, Server socket-based image upload (WEB)

Server-side: <servlet> <description> This is the description of my J2EE component </description> <display-name> This is the display name of my J2EE component </display-name> <servlet-name>InitServlet</servlet-name

JAVA LINUX command execution

public static void main(String[] args) throws Exception { Process proc = Runtime.getRuntime().exec("/bin/bash", null, new File("/bin")); BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream())); PrintWriter out = new Print

JDBC data source (DataSource) simple implementation of

Data source database technology is a Java operating key technology, the popular persistence frameworks are inseparable from the data source applications. Data source provides a simple way to get database connection, and by a pool in the internal mech
Recent
Recent Entries
Tag Cloud
Random Entries