repkin
Mar 21st, 2006, 10:01 AM
my question is in the attached file, you can read from there.
----------------------------------------------------------
152
Question
---------
My page is formed with two different pages which they are including two different form.
welcome.jsp
-----------
<html>
<body>
<center>
<table width="0" border="0" cellspacing="0">
<tr>
<td rowspan="2" width="0" align="right" valign="top">
<jsp:include page="login.htm" flush="true"></jsp:include>
<jsp:include page="search.htm" flush="true"></jsp:include>
</td>
</tr>
</table>
</center>
</body>
</html>
login.jsp
--------
<form method="post" >
<spring:hasBindErrors name="loginCommand">
<core:forEach var="err" items="${errors.globalErrors}">
<span class="error"><core:out value="${err.defaultMessage}"/></span><br/>
</core:forEach>
</spring:hasBindErrors>
<spring:bind path="loginCommand.nickname">
Enter Nickname: <input type="text" name="nickname" value="<core:out value="${status.value}"/>" size="15" maxlength="40" style="width:80;Height:18;font-size: 9px;">
<span class="error"><core:out value="${status.errorMessage}"/></span>
</spring:bind>
<spring:bind path="loginCommand.password">
Enter Password: <input type="text" name="password" value="<core:out value="${status.value}"/>" size="15" maxlength="40" style="width:80;Height:18;font-size: 9px;">
<span class="error"><core:out value="${status.errorMessage}"/></span>
</spring:bind>
</form>
search.jsp
----------
<form method="post" >
<spring:hasBindErrors name="searchCommand">
<core:forEach var="err" items="${errors.globalErrors}">
<span class="error"><core:out value="${err.defaultMessage}"/></span><br/>
</core:forEach>
</spring:hasBindErrors>
<spring:bind path="searchCommand.searchString">
Enter Search String: <input type="text" name="searchString" value="<core:out value="${status.value}"/>" size="15" maxlength="40" style="width:80;Height:18;font-size: 9px;">
<span class="error"><core:out value="${status.errorMessage}"/></span>
</spring:bind>
</form>
This is the what I want to do.
if there is any error in login.jsp
welcome.jsp
-----------
------------------------------
| | |
| | |
| | |
| login.jsp | search.jsp |
| with errors | |
| messages | |
| | |
------------------------------
else,
if there is any error in search.jsp
welcome.jsp
-----------
------------------------------
| | |
| | |
| | |
| login.jsp | search.jsp |
| | with errors |
| | messages |
| | |
------------------------------
if there is no error,
loged.jsp
-----------
---------------------------------------
| | |
| | |
| | |
| loginResult.jsp | search.jsp |
| | |
| | |
| | |
---------------------------------------
or
searched.jsp
-----------
---------------------------------------
| | |
| | |
| | |
| login.jsp | seacrhResult.jsp |
| | |
| | |
| | |
---------------------------------------
I want to do this, the included jsps are independent from the page, which this page is including they
anyOther.jsp
-----------
------------------------------
| | |
| | |
| #include | #include |
| login.jsp | seach.jsp |
|(with errors or (with errors|
| messages) | messages) |
| | |
------------------------------
I suppose something like these
<bean id="simpleUrlMapping" class = "org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name ="mappings">
<props>
<prop key ="login.htm">loginController</prop>
<prop key ="search.htm">searchController</prop>
<prop key ="welcome.htm">indexController</prop>
</props>
</property>
</bean>
<bean id="loginController" class="javaCode.controllers.LoginController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>loginCommand</value></property>
<property name="commandClass"><value>javaCode.commands.LoginCommand</value></property>
<property name="validator" ref="loginValidator"></property>
<property name="loginService"><ref bean="loginService"/></property>
<property name="formView"><value>? it nees to redirect where it came from with login.jsp</value></property>
<property name="successView"><value>loged</value></property>
</bean>
<bean id="searchController" class="javaCode.controllers.SearchController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>searchCommand</value></property>
<property name="commandClass"><value>javaCode.commands.SearchCommand</value></property>
<property name="validator" ref="searchValidator"></property>
<property name="searchService"><ref bean="searchService"/></property>
<property name="formView"><value>? it needs to redirect where it came from with search.jsp</value></property>
<property name="successView"><value>searched</value></property>
</bean>
<bean id="indexController" class="javaCode.controllers.IndexController">
</bean>
<bean id="viewResolver" class = "org.springframework.web.servlet.view.ResourceBundl eViewResolver">
<property name="basename"><value>views</value></property>
</bean>
return new ModelAndView(getSuccessView()--> this is defined,"memberDetail",memberDetail);
return showForm(request, response, errors); --> this is not defined, it will change where it is caming from.
------------------------------------------------------------------------------------------------------------------
welcome.class=org.springframework.web.servlet.view .JstlView
welcome.url=........./welcome.jsp
login.class=org.springframework.web.servlet.view.J stlView
login.url=........./login.jsp
loged.class=org.springframework.web.servlet.view.J stlView
loged.url=........../loged.jsp
search.class=org.springframework.web.servlet.view. JstlView
search.url=........./search.jsp
searched.class=org.springframework.web.servlet.vie w.JstlView
searchResult.url=........../searchResult.jsp
public class IndexController extends AbstractController
{
protected ModelAndView handleRequestInternal( HttpServletRequest request, HttpServletResponse response ) throws Exception
{
return new ModelAndView("welcome");
}
}
my first question is that is it possible to do this kind of an application. second one how can I do that, please help me.
----------------------------------------------------------
152
Question
---------
My page is formed with two different pages which they are including two different form.
welcome.jsp
-----------
<html>
<body>
<center>
<table width="0" border="0" cellspacing="0">
<tr>
<td rowspan="2" width="0" align="right" valign="top">
<jsp:include page="login.htm" flush="true"></jsp:include>
<jsp:include page="search.htm" flush="true"></jsp:include>
</td>
</tr>
</table>
</center>
</body>
</html>
login.jsp
--------
<form method="post" >
<spring:hasBindErrors name="loginCommand">
<core:forEach var="err" items="${errors.globalErrors}">
<span class="error"><core:out value="${err.defaultMessage}"/></span><br/>
</core:forEach>
</spring:hasBindErrors>
<spring:bind path="loginCommand.nickname">
Enter Nickname: <input type="text" name="nickname" value="<core:out value="${status.value}"/>" size="15" maxlength="40" style="width:80;Height:18;font-size: 9px;">
<span class="error"><core:out value="${status.errorMessage}"/></span>
</spring:bind>
<spring:bind path="loginCommand.password">
Enter Password: <input type="text" name="password" value="<core:out value="${status.value}"/>" size="15" maxlength="40" style="width:80;Height:18;font-size: 9px;">
<span class="error"><core:out value="${status.errorMessage}"/></span>
</spring:bind>
</form>
search.jsp
----------
<form method="post" >
<spring:hasBindErrors name="searchCommand">
<core:forEach var="err" items="${errors.globalErrors}">
<span class="error"><core:out value="${err.defaultMessage}"/></span><br/>
</core:forEach>
</spring:hasBindErrors>
<spring:bind path="searchCommand.searchString">
Enter Search String: <input type="text" name="searchString" value="<core:out value="${status.value}"/>" size="15" maxlength="40" style="width:80;Height:18;font-size: 9px;">
<span class="error"><core:out value="${status.errorMessage}"/></span>
</spring:bind>
</form>
This is the what I want to do.
if there is any error in login.jsp
welcome.jsp
-----------
------------------------------
| | |
| | |
| | |
| login.jsp | search.jsp |
| with errors | |
| messages | |
| | |
------------------------------
else,
if there is any error in search.jsp
welcome.jsp
-----------
------------------------------
| | |
| | |
| | |
| login.jsp | search.jsp |
| | with errors |
| | messages |
| | |
------------------------------
if there is no error,
loged.jsp
-----------
---------------------------------------
| | |
| | |
| | |
| loginResult.jsp | search.jsp |
| | |
| | |
| | |
---------------------------------------
or
searched.jsp
-----------
---------------------------------------
| | |
| | |
| | |
| login.jsp | seacrhResult.jsp |
| | |
| | |
| | |
---------------------------------------
I want to do this, the included jsps are independent from the page, which this page is including they
anyOther.jsp
-----------
------------------------------
| | |
| | |
| #include | #include |
| login.jsp | seach.jsp |
|(with errors or (with errors|
| messages) | messages) |
| | |
------------------------------
I suppose something like these
<bean id="simpleUrlMapping" class = "org.springframework.web.servlet.handler.SimpleUrlH andlerMapping">
<property name ="mappings">
<props>
<prop key ="login.htm">loginController</prop>
<prop key ="search.htm">searchController</prop>
<prop key ="welcome.htm">indexController</prop>
</props>
</property>
</bean>
<bean id="loginController" class="javaCode.controllers.LoginController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>loginCommand</value></property>
<property name="commandClass"><value>javaCode.commands.LoginCommand</value></property>
<property name="validator" ref="loginValidator"></property>
<property name="loginService"><ref bean="loginService"/></property>
<property name="formView"><value>? it nees to redirect where it came from with login.jsp</value></property>
<property name="successView"><value>loged</value></property>
</bean>
<bean id="searchController" class="javaCode.controllers.SearchController">
<property name="sessionForm"><value>true</value></property>
<property name="commandName"><value>searchCommand</value></property>
<property name="commandClass"><value>javaCode.commands.SearchCommand</value></property>
<property name="validator" ref="searchValidator"></property>
<property name="searchService"><ref bean="searchService"/></property>
<property name="formView"><value>? it needs to redirect where it came from with search.jsp</value></property>
<property name="successView"><value>searched</value></property>
</bean>
<bean id="indexController" class="javaCode.controllers.IndexController">
</bean>
<bean id="viewResolver" class = "org.springframework.web.servlet.view.ResourceBundl eViewResolver">
<property name="basename"><value>views</value></property>
</bean>
return new ModelAndView(getSuccessView()--> this is defined,"memberDetail",memberDetail);
return showForm(request, response, errors); --> this is not defined, it will change where it is caming from.
------------------------------------------------------------------------------------------------------------------
welcome.class=org.springframework.web.servlet.view .JstlView
welcome.url=........./welcome.jsp
login.class=org.springframework.web.servlet.view.J stlView
login.url=........./login.jsp
loged.class=org.springframework.web.servlet.view.J stlView
loged.url=........../loged.jsp
search.class=org.springframework.web.servlet.view. JstlView
search.url=........./search.jsp
searched.class=org.springframework.web.servlet.vie w.JstlView
searchResult.url=........../searchResult.jsp
public class IndexController extends AbstractController
{
protected ModelAndView handleRequestInternal( HttpServletRequest request, HttpServletResponse response ) throws Exception
{
return new ModelAndView("welcome");
}
}
my first question is that is it possible to do this kind of an application. second one how can I do that, please help me.