The question is a bit long but i feel its interesting. Kindly have a look plz. I have a jsp called "Menubaruser.jsp" as follows:
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<div id='cssmenu'>
<ul>
<s:url id="userhome" value="/login.action?login.username=%{#session.username}&login.password=%{#session.password}"></s:url>
<li><sj:a id="user_home" href="%{userhome}" targets="mainContent"><span>Home</span></sj:a></li>
<%-- <li><s:a action="#"><span>Home</span></s:a></li> --%>
<s:url id="showProfile" value="/profile.action"></s:url>
<li><sj:a id="profile_show" href="%{showProfile}" targets="mainContent"><span>Show Profile</span></sj:a></li>
<s:url id="editProfile" value="/editProfileLink.action"></s:url>
<li><sj:a id="profile_edit" href="%{editProfile}" targets="mainContent"><span>Update Profile</span></sj:a></li>
<s:url id="signout" value="/logout.action"></s:url>
<li><sj:a id="signout" href="%{signout}" targets="mainContent"><span>Sign Out</span></sj:a></li>
<%-- <li class='last'><s:a action="#"><span>Contact Us</span></s:a></li> --%>
</ul>
</div>
What actually happens is, when a user log in, username and password are set as session variables with their values. Now user can do whatever he wishes like update profile, show profile etc. Now what i want is when user click on home then the home page of user must appear i.e. the page that appears when user logs in. That page is named as loginSuccess.jsp and it is opened corresponding to login.action as shown in following struts.xml:
<action name="login" class="com.view.LoginAction" method="checkLogin">
<result name="input">/loginPage.jsp</result>
<result name="loginSuccessUser" type="chain">userHistory</result>
<result name="loginSuccessAdmin">/loginSuccessAdmin.jsp</result>
<result name="loginClicked">/loginPage.jsp</result>
</action>
<action name="userHistory" class="com.view.HistoryAction" method="UserHistory">
<result name="showHistory">/loginSuccess.jsp</result>
</action>
loginSuccess.jsp contains some dynamic content that comes through userhistory action. What i wish is that content is also loaded when home is clicked. Now whats happening is when user click home, then action login.action is called with the querystring sent by me corresponding to click as shown in "menubaruser.jsp" but the o/p shown is that it is not loading the password field. It returns "input" that shows me server side validation error for password as "Password is required".
The desired jsp to be rendered is named loginSuccess.jsp and is coded as follows:
<%@ taglib prefix="s" uri="/struts-tags"%>
<jsp:include page="menubaruser.jsp"></jsp:include>
<div style="width:898px"><br><center>Welcome Mr. <b><s:property value="#session.name"/> </b></center> </div>
<div id="ajaxdiv">
<div id="ContentLeft">
<jsp:include page="search.jsp"></jsp:include>
</div>
<div id="contentRight">
<jsp:include page="topdeals.jsp"></jsp:include>
</div>
</div>
<br>
<div>
<jsp:include page="userHistoryWidget.jsp"></jsp:include>
</div>
UserHistoryWidget.jsp is as follows:
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<div id="searchHeaderHistory">Booking History</div>
<div class="CSSTableGenerator">
<table>
<colgroup>
<col span="1" style="width: 5%;">
<col span="1" style="width: 10%;">
<col span="1" style="width: 8%;">
<col span="1" style="width: 15%;">
<col span="1" style="width: 15%;">
<col span="1" style="width: 6%;">
<col span="1" style="width: 6%;">
<col span="1" style="width: 17%;">
<col span="1" style="width: 18%;">
</colgroup>
<tr>
<td>Ticket ID</td>
<td>Booking Date</td>
<td>Flight ID</td>
<td>From</td>
<td>To</td>
<td>Total Fare</td>
<td>Net Fare</td>
<td></td>
<td></td>
</tr>
<s:iterator value="ticketsList" var="ticket" status="stat">
<tr>
<td align="center"><s:property value="#ticket.tid" /></td>
<td align="center"><s:property value="#ticket.bookingdate" /></td>
<td align="center"><s:property
value="#ticket.scheduleDetails.flightDetails.fid" /></td>
<s:if test="#ticket.flag==3">
<td><s:property
value="#ticket.scheduleDetails.flightDetails.routeDetails.via" /><br>
<s:property value="#ticket.scheduleDetails.via_dep_date" /> <s:property
value="#ticket.scheduleDetails.via_dep_time" />hrs</td>
</s:if>
<s:if test="#ticket.flag==1 ||#ticket.flag==2||#ticket.flag==4">
<td><s:property
value="#ticket.scheduleDetails.flightDetails.routeDetails.source" /><br>
<s:property value="#ticket.scheduleDetails.source_dep_date" /> <s:property
value="#ticket.scheduleDetails.source_dep_time" />hrs</td>
</s:if>
<s:if test="#ticket.flag==1 ||#ticket.flag==2||#ticket.flag==3">
<td><s:property
value="#ticket.scheduleDetails.flightDetails.routeDetails.destination" /><br>
<s:property value="#ticket.scheduleDetails.dest_arr_date" /> <s:property
value="#ticket.scheduleDetails.dest_arr_time" />hrs</td>
</s:if>
<s:if test="#ticket.flag==4">
<td><s:property
value="#ticket.scheduleDetails.flightDetails.routeDetails.via" /><br>
<s:property value="#ticket.scheduleDetails.via_arr_date" /> <s:property
value="#ticket.scheduleDetails.via_arr_time" />hrs</td>
</s:if>
<td align="center"><s:property value="#ticket.fare" /></td>
<td align="center"><s:property value="#ticket.dealFare" /></td>
<td style="width: 150px" align="center">
<s:url id="getPassengers" value="/getPassengers.action">
<s:param name="Tid" value="#ticket.tid" />
</s:url>
<sj:a id="link_%{#stat.index}" href="%{getPassengers}" targets="ajaxdiv" cssClass="orangebuttonsmall">
View Details
</sj:a>
</td>
<td style="width: 150px" align="center">
<s:a action="cancel" id="button1" style="float:left" cssClass="orangebuttonsmall">Cancel Ticket
<s:param name="Tid" value="#ticket.tid"></s:param>
</s:a>
</td>
</tr>
</s:iterator>
</table>
</div>
Now what i wish is whenever this loginSuccess.jsp opens the userHIstoryWidget.jsp content is loaded. So When i click Home in menubaruser.jsp, i want the "login" to be called with value of username and password to be set with values present in session. If this happens successfully then due to action chaining , the "userhistory" action gets called and displays loginSuccess.jsp with required data.
Problem is that when i send the query string with value of username and password, it doesn't set the value of password and it takes password as empty and hence return "input" which renders loginPage.jsp with actionerror "Password empty". I also tried sending a constant value instead of session value in password, but still the problem persist. It set the value of username but fails for password.
LoginPage.jsp is as follows:
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<jsp:include page="menubar.jsp"></jsp:include>
<br><br><br><br><br><br>
<s:form action="login" method="post" theme="css_xhtml" cssClass="form1" style="margin:0 211px">
<div class="searchHeader">LOGIN</div>
<div id="error">
<s:property value="errormsg"/>
</div>
<s:textfield label="Username" name="login.username" />
<s:textfield label="Password" name="login.password" />
<div class="submitButton">
<sj:submit value="SUBMIT" targets="mainContent"/>
</div>
</s:form>
Kindly help ...