R
Russ Perry Jr
We're working on our first struts application, and having a little
trouble. I've done some searching through the posts here and have
found some tantalizingly similar things to what we need, but
nothing exactly relevant. Perhaps someone can help?
We'd like the mapping.findFoward("failure") to take us to an error
page from the Action class, but we'd also like some relevant
messages to show up.
What I've been trying to do is create a Vector of error messages
and do a request.setAttribute to put it in request scope. Now,
perhaps that's the problem -- does it have to be in session
scope instead? I admit that my understanding of the request
scope is a little hazy...
Once I've come to the JSP page, the logic:iterate tag gives me
some error about pageContext (sadly, I can't give an exact error,
since the project is in a state right with which I can't replicate
the error). Perhaps I have something set up wrong? It looks like
this currently:
<logic:iterate id="errors" name="ErrorReport" scope="request"
type="java.util.Vector">
<bean:write name="errors"/><br />
</logic:iterate>
"ErrorReport" is the attribute name from the Action class:
request.setAttribute("ErrorReport", errorMessages);
"errorMessages" is the Vector of error messages I create in the
Action class.
Does anything here look obviously wrong? Like I said above, I
suspect it may be just that the request scope I'm setting the
Attribute in is different than the request scope when we go to our
errors.jsp page. If so, is there ANY way to forward my vector
without putting it in session scope? For that matter, is there
some way to use the <html:errors /> tag? I'm guessing no, since
that seems to apply only to the ActionForm's validate method, as
far as I understand it.
Perhaps another related question... Currently, I'm running into
this issue on our login process. Basically, we're only validating
the fields from login.jsp in the validate procedure, and then doing
the actual database connection and lookup in our LoginAction.java
class -- but is it better form to put this part in the validation
as well? In this case, we'd just be back to login.jsp with our
errors right there, and perhaps that's a cleaner model, but we'll
run into the error.jsp thing at some point just because that's the
way "they" want it right now...
Anyway, thanks for any help you fine folk can offer...
trouble. I've done some searching through the posts here and have
found some tantalizingly similar things to what we need, but
nothing exactly relevant. Perhaps someone can help?
We'd like the mapping.findFoward("failure") to take us to an error
page from the Action class, but we'd also like some relevant
messages to show up.
What I've been trying to do is create a Vector of error messages
and do a request.setAttribute to put it in request scope. Now,
perhaps that's the problem -- does it have to be in session
scope instead? I admit that my understanding of the request
scope is a little hazy...
Once I've come to the JSP page, the logic:iterate tag gives me
some error about pageContext (sadly, I can't give an exact error,
since the project is in a state right with which I can't replicate
the error). Perhaps I have something set up wrong? It looks like
this currently:
<logic:iterate id="errors" name="ErrorReport" scope="request"
type="java.util.Vector">
<bean:write name="errors"/><br />
</logic:iterate>
"ErrorReport" is the attribute name from the Action class:
request.setAttribute("ErrorReport", errorMessages);
"errorMessages" is the Vector of error messages I create in the
Action class.
Does anything here look obviously wrong? Like I said above, I
suspect it may be just that the request scope I'm setting the
Attribute in is different than the request scope when we go to our
errors.jsp page. If so, is there ANY way to forward my vector
without putting it in session scope? For that matter, is there
some way to use the <html:errors /> tag? I'm guessing no, since
that seems to apply only to the ActionForm's validate method, as
far as I understand it.
Perhaps another related question... Currently, I'm running into
this issue on our login process. Basically, we're only validating
the fields from login.jsp in the validate procedure, and then doing
the actual database connection and lookup in our LoginAction.java
class -- but is it better form to put this part in the validation
as well? In this case, we'd just be back to login.jsp with our
errors right there, and perhaps that's a cleaner model, but we'll
run into the error.jsp thing at some point just because that's the
way "they" want it right now...
Anyway, thanks for any help you fine folk can offer...