Hi Stripe users,

I need some help from more experienced Stripe users please, I just started
my first project and became stuck on that simple problem:
I want to write a form to read from and write into a database.
So I started with to prepopulate a field but do not understand the correct
Stripe-way to do it.
Instead of a prepopulation I got an override of my input, so I am quite
confused.
I want to have a field populated before it is shown to the user and then
save the new input (as everybody expects it).
What do I miss? How should I change the code beollow?
Thank you in advance!

Here is my code:

PersonActionBean:
-----------------
public class PersonActionBean implements ActionBean {
        private String person;
        private ActionBeanContext context;
  
        @Before void init() {
                person = "test";
        }
        
        @DefaultHandler
        public Resolution show() {
                return new ForwardResolution("/show.jsp");
        }

        public Resolution save() {
                return new ForwardResolution("/save.jsp");
        }

        @Override
        public ActionBeanContext getContext() {
                return context;
        }

        @Override
        public void setContext(ActionBeanContext context) {
                this.context = context;
        }

        public String getPerson() {
                return person;
        }

        public void setPerson(String person) {
                this.person = person;
        }
}

show.jsp:
---------
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%>
<%@ taglib prefix="stripes" ...%>
<!DOCTYPE html PUBLIC>
<html>
<head></head>
</body>
        <stripes:form beanclass="test.PersonActionBean">
        <stripes:text name="person"  value="${actionBean.person}" />
        <stripes:submit name="save" value="Save" />
        <stripes:errors />
        </stripes:form>
<body>
</html>


save.jsp:
---------
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"; prefix="c"%>
<%@ taglib prefix="stripes" ...%>
<!DOCTYPE html PUBLIC>
<html>
<head>
</head>
<body>
<p>person: ${actionBean.person}</p>
</body>
</html>




------------------------------------------------------------------------------
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to