By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,137 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,137 IT Pros & Developers. It's quick & easy.

getting Request null inside IE

100+
P: 101
Hi,

I have a very strange problem with my application.
I have developed it using Struts.

I have a TextBox With Some fixed value in it and on Submit iam passing it to another page.
[PHP]<html:form action="/login">

<html:text property="userName" value="Bunty"/>
<html:submit/>
</html:form>[/PHP]

I am printing it's value through Action Class to check what value it is getting..

When I am Running this application in mozilla it is working fine printing the values perfectly.

But when i am running it using IE it is giving blank. It is getting request null.


Please help me in this.....


Struts Config
[PHP]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>

<form-beans>
<form-bean name="loginForm" type="com.some.ikan.form.LoginForm"/>
<form-bean name="questionsForm" type="com.some.ikan.form.QuestionsForm"/>
<form-bean name="answersForm" type="com.some.ikan.form.AnswersForm"/>
<form-bean name="submitForm" type="com.some.ikan.form.SubmitForm"/>
</form-beans>

<!-- ========== Global Exception Definitions ============================== -->
<global-exceptions />

<!-- ========== Global Forward Definitions =============================== -->
<global-forwards />

<!-- ========== Action Mapping Definitions =============================== -->



<action-mappings>
<action
attribute="loginForm"
input="/jsp/index.jsp"
name="loginForm"
scope="session"
path="/login"
type="com.some.ikan.action.LoginAction">
<forward name="answer" path="/jsp/query2.jsp" />
<forward name="question" path="/jsp/query1.jsp" />
<forward name="error" path="/jsp//jsp/error.jsp" />
</action>
<action forward="/jsp/loginOut.jsp"
path="/logout"/>

<action
attribute="questionsForm"
input="/jsp/query1.jsp"
name="questionsForm"
scope="session"
path="/questions"
type="com.some.ikan.action.QuestionsAction">
<forward name="noerror" path="/jsp/questions.jsp" />
</action>
<action
attribute="answersForm"
input="/jsp/query2.jsp"
name="answersForm"
path="/answers"
type="com.some.ikan.action.AnswersAction">
<forward name="noerror" path="/jsp/questionsForAnswererChoice.jsp" />
</action>
<!-- Webeditor Action -->
<action
path="/submit"
type="com.some.ikan.action.WebEditorAction">
<forward name="noerror" path="/jsp/closingpage.jsp" />
<forward name="error" path="/jsp/error.jsp" />
</action>
<!--Editor for answer-->

<action
path="/submitAnswer"
type="com.some.ikan.action.WebEditorForAnswerActio n">
<forward name="noerror" path="/jsp/closingpage1.jsp" />
<forward name="error" path="/jsp/error.jsp" />
</action>
<!--Question Edit Action-->

<action
path="/QuestionEditsubmit"
type="com.some.ikan.action.QuestionEditsubmitActio n">
<forward name="noerror" path="/jsp/otherdetailsforanswererNew.jsp" />
<forward name="error" path="/jsp/error.jsp" />
</action>
<!--Question delete Action-->

<action
path="/deleteAction"
type="com.some.ikan.action.DeleteAction">
<forward name="noerror" path="/jsp/query2.jsp" />
</action>
</action-mappings>

<!-- ========== Controller Configuration ================================ -->
<!-- ========== Message Resources Definitions ============================ -->
<message-resources parameter="com.some.ikan.ResourceBundles.Applicati onResources" />
<!-- ========== Plug Ins Configuration ================================= -->
<plug-in className="Plugin.IkanPlug">
</plug-in>
</struts-config>[/PHP]

LoginAction.java

[PHP]

public class LoginAction extends Action {

// --------------------------------------------------------- Instance Variables

// --------------------------------------------------------- Methods
public static Logger myLogger=Logger.getLogger(LoginAction.class);

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
myLogger.info("entering LoginAction execute");
String next = null;

LoginForm loginForm = (LoginForm) form;

String mUserName = loginForm.getUserName();
//This I am getting Blank Inside IE but works in Mozilla
System.out.println("UserName " + mUserName);
myLogger.info("entering LoginAction execute for user:"+ mUserName);


//String mPassword = loginForm.getPassword();
HttpSession hs = request.getSession();
hs.setAttribute("username", "something");

String queidFromRequest=(String)request.getParameter("que idFromRequest");
String queidfromlink=(String)hs.getAttribute("queidfromli nk");
try
{
String role="none";

if(queidfromlink!=null)
{
if(role.equalsIgnoreCase("Admin"))
response.sendRedirect("/IKANNEW2/jsp/otherdetailsforanswerer.jsp?que_id="+queidfromlink );
else
response.sendRedirect("/IKANNEW2/jsp/otherdetails.jsp?que_id="+queidfromlink);
}
else if(!role.equalsIgnoreCase("none"))
{
next="answer";
}

else
{
next="question";
}
}
catch (Exception e) {
//next = "error";
myLogger.error("Exception",e);
}

myLogger.info("returned from LoginAction with value:"+next);
return mapping.findForward(next);
}
}[/PHP]

ActionForm

[PHP]
public class LoginForm extends ActionForm {

// --------------------------------------------------------- Instance Variables



/**
*
*/
private static final long serialVersionUID = -1281925207517807L;
/**
* userName property
*/
private String userName;



// --------------------------------------------------------- Methods


/**
* Returns the userName.
*
* @return String
*/
public String getUserName() {

return userName;
}

/**
* Method reset
*
* @param mapping mapping
* @param request request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {

userName = "";

}


/**
* Set the userName.
*
* @param userName The userName to set
*/
public void setUserName(String userName) {
this.userName = userName;
}

}[/PHP]
Dec 19 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.