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="userN ame" 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.Login Form"/>
<form-bean name="questions Form" type="com.some. ikan.form.Quest ionsForm"/>
<form-bean name="answersFo rm" type="com.some. ikan.form.Answe rsForm"/>
<form-bean name="submitFor m" type="com.some. ikan.form.Submi tForm"/>
</form-beans>
<!-- ========== Global Exception Definitions =============== =============== -->
<global-exceptions />
<!-- ========== Global Forward Definitions =============== =============== = -->
<global-forwards />
<!-- ========== Action Mapping Definitions =============== =============== = -->
<action-mappings>
<action
attribute="logi nForm"
input="/jsp/index.jsp"
name="loginForm "
scope="session"
path="/login"
type="com.some. ikan.action.Log inAction">
<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="ques tionsForm"
input="/jsp/query1.jsp"
name="questions Form"
scope="session"
path="/questions"
type="com.some. ikan.action.Que stionsAction">
<forward name="noerror" path="/jsp/questions.jsp" />
</action>
<action
attribute="answ ersForm"
input="/jsp/query2.jsp"
name="answersFo rm"
path="/answers"
type="com.some. ikan.action.Ans wersAction">
<forward name="noerror" path="/jsp/questionsForAns wererChoice.jsp " />
</action>
<!-- Webeditor Action -->
<action
path="/submit"
type="com.some. ikan.action.Web EditorAction">
<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.Web EditorForAnswer Action">
<forward name="noerror" path="/jsp/closingpage1.js p" />
<forward name="error" path="/jsp/error.jsp" />
</action>
<!--Question Edit Action-->
<action
path="/QuestionEditsub mit"
type="com.some. ikan.action.Que stionEditsubmit Action">
<forward name="noerror" path="/jsp/otherdetailsfor answererNew.jsp " />
<forward name="error" path="/jsp/error.jsp" />
</action>
<!--Question delete Action-->
<action
path="/deleteAction"
type="com.some. ikan.action.Del eteAction">
<forward name="noerror" path="/jsp/query2.jsp" />
</action>
</action-mappings>
<!-- ========== Controller Configuration =============== =============== == -->
<!-- ========== Message Resources Definitions =============== ============= -->
<message-resources parameter="com. some.ikan.Resou rceBundles.Appl icationResource s" />
<!-- ========== Plug Ins Configuration =============== =============== === -->
<plug-in className="Plug in.IkanPlug">
</plug-in>
</struts-config>[/PHP]
LoginAction.jav a
[PHP]
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
public static Logger myLogger=Logger .getLogger(Logi nAction.class);
public ActionForward execute(ActionM apping mapping, ActionForm form,
HttpServletRequ est request, HttpServletResp onse response)
throws Exception {
myLogger.info(" entering LoginAction execute");
String next = null;
LoginForm loginForm = (LoginForm) form;
String mUserName = loginForm.getUs erName();
//This I am getting Blank Inside IE but works in Mozilla
System.out.prin tln("UserName " + mUserName);
myLogger.info(" entering LoginAction execute for user:"+ mUserName);
//String mPassword = loginForm.getPa ssword();
HttpSession hs = request.getSess ion();
hs.setAttribute ("username", "something" );
String queidFromReques t=(String)reque st.getParameter ("queidFromRequ est");
String queidfromlink=( String)hs.getAt tribute("queidf romlink");
try
{
String role="none";
if(queidfromlin k!=null)
{
if(role.equalsI gnoreCase("Admi n"))
response.sendRe direct("/IKANNEW2/jsp/otherdetailsfor answerer.jsp?qu e_id="+queidfro mlink);
else
response.sendRe direct("/IKANNEW2/jsp/otherdetails.js p?que_id="+quei dfromlink);
}
else if(!role.equals IgnoreCase("non e"))
{
next="answer";
}
else
{
next="question" ;
}
}
catch (Exception e) {
//next = "error";
myLogger.error( "Exception" ,e);
}
myLogger.info(" returned from LoginAction with value:"+next);
return mapping.findFor ward(next);
}
}[/PHP]
ActionForm
[PHP]
public class LoginForm extends ActionForm {
// --------------------------------------------------------- Instance Variables
/**
*
*/
private static final long serialVersionUI D = -128192520751780 7L;
/**
* 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(ActionMap ping mapping, HttpServletRequ est request) {
userName = "";
}
/**
* Set the userName.
*
* @param userName The userName to set
*/
public void setUserName(Str ing userName) {
this.userName = userName;
}
}[/PHP]
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="userN ame" 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.Login Form"/>
<form-bean name="questions Form" type="com.some. ikan.form.Quest ionsForm"/>
<form-bean name="answersFo rm" type="com.some. ikan.form.Answe rsForm"/>
<form-bean name="submitFor m" type="com.some. ikan.form.Submi tForm"/>
</form-beans>
<!-- ========== Global Exception Definitions =============== =============== -->
<global-exceptions />
<!-- ========== Global Forward Definitions =============== =============== = -->
<global-forwards />
<!-- ========== Action Mapping Definitions =============== =============== = -->
<action-mappings>
<action
attribute="logi nForm"
input="/jsp/index.jsp"
name="loginForm "
scope="session"
path="/login"
type="com.some. ikan.action.Log inAction">
<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="ques tionsForm"
input="/jsp/query1.jsp"
name="questions Form"
scope="session"
path="/questions"
type="com.some. ikan.action.Que stionsAction">
<forward name="noerror" path="/jsp/questions.jsp" />
</action>
<action
attribute="answ ersForm"
input="/jsp/query2.jsp"
name="answersFo rm"
path="/answers"
type="com.some. ikan.action.Ans wersAction">
<forward name="noerror" path="/jsp/questionsForAns wererChoice.jsp " />
</action>
<!-- Webeditor Action -->
<action
path="/submit"
type="com.some. ikan.action.Web EditorAction">
<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.Web EditorForAnswer Action">
<forward name="noerror" path="/jsp/closingpage1.js p" />
<forward name="error" path="/jsp/error.jsp" />
</action>
<!--Question Edit Action-->
<action
path="/QuestionEditsub mit"
type="com.some. ikan.action.Que stionEditsubmit Action">
<forward name="noerror" path="/jsp/otherdetailsfor answererNew.jsp " />
<forward name="error" path="/jsp/error.jsp" />
</action>
<!--Question delete Action-->
<action
path="/deleteAction"
type="com.some. ikan.action.Del eteAction">
<forward name="noerror" path="/jsp/query2.jsp" />
</action>
</action-mappings>
<!-- ========== Controller Configuration =============== =============== == -->
<!-- ========== Message Resources Definitions =============== ============= -->
<message-resources parameter="com. some.ikan.Resou rceBundles.Appl icationResource s" />
<!-- ========== Plug Ins Configuration =============== =============== === -->
<plug-in className="Plug in.IkanPlug">
</plug-in>
</struts-config>[/PHP]
LoginAction.jav a
[PHP]
public class LoginAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
public static Logger myLogger=Logger .getLogger(Logi nAction.class);
public ActionForward execute(ActionM apping mapping, ActionForm form,
HttpServletRequ est request, HttpServletResp onse response)
throws Exception {
myLogger.info(" entering LoginAction execute");
String next = null;
LoginForm loginForm = (LoginForm) form;
String mUserName = loginForm.getUs erName();
//This I am getting Blank Inside IE but works in Mozilla
System.out.prin tln("UserName " + mUserName);
myLogger.info(" entering LoginAction execute for user:"+ mUserName);
//String mPassword = loginForm.getPa ssword();
HttpSession hs = request.getSess ion();
hs.setAttribute ("username", "something" );
String queidFromReques t=(String)reque st.getParameter ("queidFromRequ est");
String queidfromlink=( String)hs.getAt tribute("queidf romlink");
try
{
String role="none";
if(queidfromlin k!=null)
{
if(role.equalsI gnoreCase("Admi n"))
response.sendRe direct("/IKANNEW2/jsp/otherdetailsfor answerer.jsp?qu e_id="+queidfro mlink);
else
response.sendRe direct("/IKANNEW2/jsp/otherdetails.js p?que_id="+quei dfromlink);
}
else if(!role.equals IgnoreCase("non e"))
{
next="answer";
}
else
{
next="question" ;
}
}
catch (Exception e) {
//next = "error";
myLogger.error( "Exception" ,e);
}
myLogger.info(" returned from LoginAction with value:"+next);
return mapping.findFor ward(next);
}
}[/PHP]
ActionForm
[PHP]
public class LoginForm extends ActionForm {
// --------------------------------------------------------- Instance Variables
/**
*
*/
private static final long serialVersionUI D = -128192520751780 7L;
/**
* 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(ActionMap ping mapping, HttpServletRequ est request) {
userName = "";
}
/**
* Set the userName.
*
* @param userName The userName to set
*/
public void setUserName(Str ing userName) {
this.userName = userName;
}
}[/PHP]