日期:2014-05-20  浏览次数:20757 次

关于struts2中ognl的问题

import com.opensymphony.xwork2.ActionSupport;


public class OGNL extends ActionSupport{

private static final long serialVersionUID = 1L;
private String username;
private user user;
private Cat cat;
private String password;

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public Cat getCat() {
return cat;
}

public void setCat(Cat cat) {
this.cat = cat;
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public user getUser() {
return user;
}

public void setUser(user user) {
this.user = user;
}

public String mm(){
return "mm";
}
public String execute() throws Exception {

return SUCCESS;
}

}
小弟定义了这样一个类,其中有个Cat类,定义如下:

package com.bjsxt.struts2.ognl;

public class Cat {

private Dog friend;

public Dog getFriend() {
return friend;
}

public void setFriend(Dog friend) {
this.friend = friend;
}

public String miaomiao() {
return "miaomiao";
}
}
然后我在相应的jsp中写入如下语句:
<s:property value="cat.miaomiao()" />

然后我在浏览器中输入了http://localhost:8888/Struts_2/theme/theme这个东西
但是视频中浏览器里输入的东西被挡住了,我知道在地址后面还有东西,但是不知道输入什么,不知道哪位大哥、大姐可以告诉我啊!谢谢!


------解决方案--------------------
探讨
http://localhost:8888/Struts_2/theme/theme这个东西

------解决方案--------------------
链接中好像只能传递参数吧
------解决方案--------------------
- -把你配置文件发来看看就知