編碼問題
JSP:
<%@ page language= "java " pageEncoding= "BIG5 "%>
<%@ taglib uri= "http://struts.apache.org/tags-bean " prefix= "bean "%>
<%@ taglib uri= "http://struts.apache.org/tags-html " prefix= "html "%>
<%@ taglib uri= "http://java.sun.com/jsp/jstl/core " prefix= "c "%>
<html>
<head>
<title> JSP for InputForm form </title>
</head>
<body>
<html:form action= "/input ">
data : <html:text property= "data "/> <html:errors property= "data "/> <br/>
<html:submit/> <html:cancel/>
</html:form>
<c:out value= "${data} "/>
</body>
</html>
FromBean:
package com.pan.struts.form;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.
ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
/**
* MyEclipse Struts
* Creation date: 09-14-2007
*
* XDoclet definition:
* @struts.form name= "input "
*/
public class InputForm extends ActionForm {
/*
* Generated fields
*/
/** data property */
private String data;
/*
* Generated Methods
*/
/**
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}
/**
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}
/**
* Returns the data.
* @return String
*/
public String getData() {
return data;
}
/**
* Set the data.
* @param data The data to set
*/
public void setData(String data) {
this.data = data;
}
}
Action:
mport javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMappin