Dear All,
Can somebody please help me with this problem? I am deploying war file on Weblogic. The application is done with Struts,
struts-config
<action-mappings>
<action path="/welcomeAction" type="com.refdata.welcome.WelcomeAction">
<forward name="welcomePage" contextRelative="true" path="/resources/jsp/common/index.jsp"/>
</action>
WelcomAction.java
/**
* <p><component description>.
* </p>
* <br><br>
*
* Name Date Description
* ----------------------------------------------------------<br>
*
*/
package com.refdata.welcome;
import com.refdata.common.Constants;
import com.refdata.common.RDMException;
import com.refdata.common.SessionInfo;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
public class WelcomeAction extends Action {
final Log log = LogFactory.getLog("com.refdata.welcome");
public WelcomeAction() {
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException {
System.out.println("I am in WelcomeAction");
SessionInfo sessionInfo = new SessionInfo();
HttpSession session = request.getSession(false);
// HttpSession session = null;
ActionErrors errors = new ActionErrors();
String returnPage = null;
try {
if (session.isNew()) {
session = request.getSession();
}
String userId = (request.getParameter("User_Id") == null ? "Guest" : request.getParameter("User_Id"));
//String userEdit = userId == "Guest"?"N":"Y";
String userEdit = (request.getParameter("user_edit") == null) ? "N" : request.getParameter("user_edit") ;
String sessionId = session.getId();
long currDateTime = System.currentTimeMillis();
Date myDate = new Date(currDateTime);
SimpleDateFormat dateFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
sessionInfo.setUserId(userId);
sessionInfo.setUserEdit(userEdit);
sessionInfo.setStrSessionId(sessionId);
sessionInfo.setBusinessDate(dateFormat.format(myDate));
session.setAttribute("SessionInfo", sessionInfo);
returnPage = "welcomePage";
}
catch (Exception e) {
RDMException rdmEx = new RDMException(e);
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.systemError.label1"));
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.systemError.label2", rdmEx.getMessage()));
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.systemError.label3", rdmEx.getExceptionTrail()));
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.commonMessage.label"));
saveErrors(request, errors);
returnPage = "errorPage";
}
return mapping.findForward(returnPage);
}
}
web.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Struts Action Servlet Mappings -->
<!-- Note that because Struts takes the *last* mapping here as the extension to add to
actions posted from forms, we must have *.do come after *.jpf. -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
URL
http ://localhost:7001/RDM/welcomeAction.do
I would greatly appreciate any help
Can somebody please help me with this problem? I am deploying war file on Weblogic. The application is done with Struts,
struts-config
<action-mappings>
<action path="/welcomeAction" type="com.refdata.welcome.WelcomeAction">
<forward name="welcomePage" contextRelative="true" path="/resources/jsp/common/index.jsp"/>
</action>
WelcomAction.java
/**
* <p><component description>.
* </p>
* <br><br>
*
* Name Date Description
* ----------------------------------------------------------<br>
*
*/
package com.refdata.welcome;
import com.refdata.common.Constants;
import com.refdata.common.RDMException;
import com.refdata.common.SessionInfo;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
public class WelcomeAction extends Action {
final Log log = LogFactory.getLog("com.refdata.welcome");
public WelcomeAction() {
}
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException {
System.out.println("I am in WelcomeAction");
SessionInfo sessionInfo = new SessionInfo();
HttpSession session = request.getSession(false);
// HttpSession session = null;
ActionErrors errors = new ActionErrors();
String returnPage = null;
try {
if (session.isNew()) {
session = request.getSession();
}
String userId = (request.getParameter("User_Id") == null ? "Guest" : request.getParameter("User_Id"));
//String userEdit = userId == "Guest"?"N":"Y";
String userEdit = (request.getParameter("user_edit") == null) ? "N" : request.getParameter("user_edit") ;
String sessionId = session.getId();
long currDateTime = System.currentTimeMillis();
Date myDate = new Date(currDateTime);
SimpleDateFormat dateFormat = new SimpleDateFormat(Constants.DATE_FORMAT);
sessionInfo.setUserId(userId);
sessionInfo.setUserEdit(userEdit);
sessionInfo.setStrSessionId(sessionId);
sessionInfo.setBusinessDate(dateFormat.format(myDate));
session.setAttribute("SessionInfo", sessionInfo);
returnPage = "welcomePage";
}
catch (Exception e) {
RDMException rdmEx = new RDMException(e);
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.systemError.label1"));
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.systemError.label2", rdmEx.getMessage()));
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.systemError.label3", rdmEx.getExceptionTrail()));
errors.add(ActionErrors.GLOBAL_MESSAGE, new ActionError("error.commonMessage.label"));
saveErrors(request, errors);
returnPage = "errorPage";
}
return mapping.findForward(returnPage);
}
}
web.xml
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Struts Action Servlet Mappings -->
<!-- Note that because Struts takes the *last* mapping here as the extension to add to
actions posted from forms, we must have *.do come after *.jpf. -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
URL
http ://localhost:7001/RDM/welcomeAction.do
I would greatly appreciate any help