Hey all,
I'm currently evaluating a few different (request-based) Java frameworks
for use in a new project. I really like the look of Stripes, I've read
some good things about it. I haven't studied much of the architecture of
the system nevertheless I've been trying to get a very simple example
working... and seem to be stuck.
What I want to do is display the name from my user object when the page
loads. I am not sure how to dispatch some sort of page load event to my
ActionBean so instead I thought I'd try it with a link.
This is my code so far (note: I use project lombok so ignore some of the
annotations):
------------------------------------------------------------------------
// User.java
public class User {
@Getter @Setter
private String name;
public User(final String name) {
this.name = name;
}
}
------------------------------------------------------------------------
// MainBean.java
public class MainBean implements ActionBean {
@Getter @Setter
private ActionBeanContext context;
@Getter
private User user;
@DefaultHandler
public Resolution view() {
this.user = new User("Chris");
return new ForwardResolution("/index.jsp");
}
}
------------------------------------------------------------------------
// index.jsp
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="stripes"
uri="http://stripes.sourceforge.net/stripes.tld" %>
<html>
<head/>
<body>
<p>Welcome, ${actionBean.user.getName()}</p>
<stripes:link beanclass="MainBean">Say Hello!</stripes:link>
</body>
</html>
------------------------------------------------------------------------
There really isn't much code, at the moment though clicking on the
stripes:link sends the event to the Main.action handler that renders the
index.jsp but the JSP EL expression displayed appears as plain text e.g.
"${actionBean.user.getName()}".
Any help is appreciated,
Chris
------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users