package com.action;import java.util.Date;import javax.servlet.http.HttpServletRequest;import org.apache.struts2.ServletActionContext;import com.opensymphony.xwork2.ActionSupport;public class ActionInfo extends ActionSupport{
private point point;
private String username;
private int age;
private Date brithday;
public point getPoint() {
return point;
}
public void setPoint(point point) {
this.point = point;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getBrithday() {
return brithday;
}
public void setBrithday(Date brithday) {
this.brithday = brithday;
}
@Override
public String execute() throws Exception {
System.out.println("请求leaction ");
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("point", point);
return SUCCESS;
}
// public void validate() {
// // TODO Auto-generated method stub
// super.validate();
} package com.action;import java.util.Map;import org.apache.struts2.util.StrutsTypeConverter; public class converter extends StrutsTypeConverter{ @Override
public Object convertFromString(Map arg0, String[] str, Class arg2) {
String[] string =str[0].split("-");
// String[] string=arg1[0].split("-");
point point = new point();
point.setX(Integer.parseInt(string[0]));
point.setY(Integer.parseInt(string[1]));
point.setZ(Integer.parseInt(string[2]));
return point;
} @Override
public String convertToString(Map arg0, Object ob) {
point point= (point)ob;
int x= point.getX();
int y= point.getY();
int z = point.getZ();
return "[x="+x+","+"y="+y+","+"z="+z+"]";
}}
package com.action;public class point {
private int x;
private int y;
private int z;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
// public String toString()
// {
// return "[x="+x+","+"y="+y+","+"z="+z+"]";
// }
}
private point point;
private String username;
private int age;
private Date brithday;
public point getPoint() {
return point;
}
public void setPoint(point point) {
this.point = point;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public Date getBrithday() {
return brithday;
}
public void setBrithday(Date brithday) {
this.brithday = brithday;
}
@Override
public String execute() throws Exception {
System.out.println("请求leaction ");
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("point", point);
return SUCCESS;
}
// public void validate() {
// // TODO Auto-generated method stub
// super.validate();
} package com.action;import java.util.Map;import org.apache.struts2.util.StrutsTypeConverter; public class converter extends StrutsTypeConverter{ @Override
public Object convertFromString(Map arg0, String[] str, Class arg2) {
String[] string =str[0].split("-");
// String[] string=arg1[0].split("-");
point point = new point();
point.setX(Integer.parseInt(string[0]));
point.setY(Integer.parseInt(string[1]));
point.setZ(Integer.parseInt(string[2]));
return point;
} @Override
public String convertToString(Map arg0, Object ob) {
point point= (point)ob;
int x= point.getX();
int y= point.getY();
int z = point.getZ();
return "[x="+x+","+"y="+y+","+"z="+z+"]";
}}
package com.action;public class point {
private int x;
private int y;
private int z;
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public int getZ() {
return z;
}
public void setZ(int z) {
this.z = z;
}
// public String toString()
// {
// return "[x="+x+","+"y="+y+","+"z="+z+"]";
// }
}
解决方案 »
- 问题大了,高手不快看看吧~~~
- struts的一个比较奇怪的问题
- 【调查】做J2EE的项目开发时,在使用windows操作系统的文件系统的时候,特别不爽,有同感的进来领分
- 用request.getParameter("xxx")接收 如果是一个中文值 发生乱码的问题求解决
- 为什么输出是null???
- 怎样用Jbuild9打包jsp文件?
- 在JSP中TreeView是如何实现的?
- 为什么在外网访问不了我的系统啊?(服务器为教育网)
- 在TOMCAT服务器下,JAVABEAN应该放在哪里?
- 烦人的乱码问题
- TOMCAT6可以同时部署几个JSP网站?
- Non-Blocking socket多线程下selector的socketchannel注册读事件问题
converter是什么意思啊?