以下是一个简单的JSP Struts2 OGNL实例,展示了如何在JSP页面中使用OGNL表达式来访问Action中的属性。
创建一个Struts2的Action类,名为`UserAction`:

```java
package com.example.action;
import com.opensymphony.xwork2.ActionSupport;
public class UserAction extends ActionSupport {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
```
然后,在struts.xml中配置这个Action:
```xml
文章链接:http://tlqpw.cn/nLIwAv_FJkGCjOCCRWmBu







