Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

« Newer Snippets
Older Snippets »
6 total  XML / RSS feed 

jsp:include and <%@ include, UTF-8

jsp:include will dynamically detect any changes made to the included file. So in general, it is better to use jsp:include than the include directive.

There is another advantage. If the included file contains UTF-8 characters that are other than ASCII, then using jsp:include will ensure these characters displaying correctly. However, if the included file is a JSP file, you'll need to put this at the beginning:
<%@ page language="java" %>
<%@ page contentType="text/html;charset=UTF-8" %>

wireless linux scan Access point and connect

// description of your code here

$ iwlist scan
$ iwconfig eth1 ESSID <MY_ESSID> mode Managed channel <MY_CHANNEL>


Channels and ESSID can be listed by issuing the command "iwlist scan".

Make your JSP an XHTML

By default, a JSP file won't be considered as an XHTML stream by the web browser. This will make things such as XForms not being rendered since the browser XForms plugins/addons render Xforms only for XHTML pages. To make a JSP file as XHTML, put this at the beginning of the JSP file

<?xml version="1.0" encoding="utf-8"?>
<% response.setContentType("application/xhtml+xml"); %>


Note that the XML declaration has to be in the first line for a valid XHTML. Of course, after doing this, you need to make all your tags valid XML in your JSP as well.

How to use JSTL fmt:message and resource bundle

To use JSTL fmt:message tags with a message bundle, there are two ways.

First, if there is only one properties file, use, the following code in web.xml file.

  <context-param>
    <param-name>javax.servlet.jsp.jstl.fmt.localizationContextparam-name>
    class.path.to.your.resources.bundle</param-value>
  context-param>


Use in the JSP.

Second, if there are multiple properties files, and there are different locales, use
<fmt:setBundle basename="class.path.to.your.resources.bundle"/>

before

Or you can write

<fmt:bundle basename="class.path.to.your.resource.bundle">
  <fmt:message key="your.message.key"/>
fmt:bundle>

Create a virtual CD/DVD using an image on Linux

On Linux, if you have an ISO file and need to create a virtual CD/DVD, just run the command below.

dd if=/dev/cdrom of=/directory/filename.iso

mount -o loop /directory/filename.iso /mountpoint/

Remove CVS directoires and files

When check out the files, use
cvs export

instead of
cvs checkout

can avoid creating those CVS directories

If files already exist, then in bash, do
find . -name CVS -prune -exec rm -rf {} \;
« Newer Snippets
Older Snippets »
6 total  XML / RSS feed