In my application, I had 2 versions of a login.jsp(both quite simple)
one is:
//////////////////////////////////////////////////////
<%@ taglib prefix="ww" uri="webwork"%>
<html>
<style type="text/css">
.errorMessage {
color: red;
}
</style>
<body>
<ww:if test="hasFieldErrors()">
<span class="errorMessage">
<b>Errors:</b><br>
<ww:iterator value="fieldErrors">
<li><ww:property/></li>
</ww:iterator>
</span>
</ww:if>
<form action="/login.action">
<p align="center">
Login<br>
<ww:if test="message != null">
<font color="red">
<ww:property value="message"/>
</font>
</ww:if>
<ww:if test="errorMessage != null">
<font color="red">
<ww:property value="errorMessage"/>
</font>
</ww:if>
</p>
username:
<input type="text" name="model.username" />
<br>
password
<input type="password" name="model.password" />
<br>
<p align="center">
<input type="submit" value="submit" name="B1"/>
</p>
</form>
</body>
</html>
////////////////////////////////////////////////////////
this one works well.
then I try to updated it with ui tags, as:
///////////////////////////////////////////////////////
<%@ taglib prefix="ww" uri="webwork"%>
<html>
<style type="text/css">
.errorMessage {
color: red;
}
</style>
<body>
<ww:form name="'login'" action="'/login.action'" method="'post'">
<p align="center">
Login<br>
<ww:if test="message != null">
<font color="red">
<ww:property value="message"/>
</font>
</ww:if>
<ww:if test="errorMessage != null">
<font color="red">
<ww:property value="errorMessage"/>
</font>
</ww:if>
</p>
<ww:textfield label="'username'" name="'model.username'" />
<br>
<ww:textfield label="'password'" name="'model.password'" />
<br>
<p align="center">
<ww:submit value="'submit"/>
</p>
</ww:form>
</body>
</html>
//////////////////////////////////////////////////////////////////
this one failed.
if I restart tomcat, and access the first one . then goto the second one.
all seemed quite good, the second page can work.
but if I access the second page directly after restart tomcat.
then we will see:
Fatal exception caught in com.opensymphony.webwork.views.jsp.ui.TextFieldTag tag class, doEndTag: null
I am quite confused, it seemed the second one need the first one
to do some pre-work, is it?
I had upload my Application as a rar file to my website.
http://www.xiaxin.net/ROOT.rar
Thanks for any comment for this issue.
The DispatcherServlet initialize the velocitymanager in init() method.
when the first jsp post request,the DispathcherServlet will be
initialized.
If a page with ui tag be accessed fist restart after tomcat .
the velocitymanager had not been initialed.
So when build the jsp page,we will get a NullPointException.
simple solution.
add a <load-on-startup>1</load-on-startup> to DispatcherServlet
configuration.
Suggest the webwork team to add this item in example web.xml.
Issue closed.