[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: Error setting expression with Value
From:       NIJO GEORGE <nijomon () gmail ! com>
Date:       2014-06-16 8:58:54
Message-ID: CAGRZGV1JZx7fV-Y3AZXZgmEQgBUns_5F6rwGqnGyAVkwQbgJ4A () mail ! gmail ! com
[Download RAW message or body]


I have done it and my error got resolved.
My Current problem is the value is not getting updated.

I'm getting a NullPointerException while getting value from above fields.
The values which are set to those hidden fields are not retriving properly
by Action Class.

I'm getting 0(Zero) always


On Mon, Jun 16, 2014 at 2:09 PM, Lukasz Lenart <lukaszlenart@apache.org>
wrote:

> Or you can try to use OGNL 3.0.8 which solves that problem (it's a
> drop-in dependency)
>
> https://issues.apache.org/jira/browse/WW-3909
> https://github.com/jkuhnert/ognl#release-notes---version-308
>
> 2014-06-16 10:29 GMT+02:00 Sreekanth S. Nair <
> sreekanth.nair@egovernments.org>:
> > rename your setter & getter method of mAnswerid from setmAnswerid to
> > setMAnswerid  and getmAnswerid to getMAnswerid. And same thing is
> > applicable to mQuestionid variable as well.
> >
> > --
> > Thanks & Regards
> > Srikanth
> > Software Developer
> > --------------------------------
> > eGovernments Foundations
> > www.egovernments.org
> > Mob : 9980078913
> > --------------------------------
> >
> >
> > On Mon, Jun 16, 2014 at 1:53 PM, NIJO GEORGE <nijomon@gmail.com> wrote:
> >
> >> import com.dieutek.examsoft.entities.ExmAnswers;
> >> import com.dieutek.examsoft.entities.ExmQuestion;
> >> import com.dieutek.examsoft.implementors.AnswerImplementor;
> >> import com.dieutek.examsoft.implementors.QuestionImplementor;
> >> import static com.opensymphony.xwork2.Action.SUCCESS;
> >> import com.opensymphony.xwork2.ActionSupport;
> >> import javax.servlet.http.HttpServletRequest;
> >> import org.apache.struts2.interceptor.ServletRequestAware;
> >>
> >> public class UpdateQuestionAction extends ActionSupport implements
> >> ServletRequestAware {
> >>
> >>     int adminid;
> >>     int mQuestionid;
> >>     int mAnswerid;
> >>     private int courseid;
> >>     private int subjectid;
> >>     private String question;
> >>     private String optionA;
> >>     private String optionB;
> >>     private String optionC;
> >>     private String optionD;
> >>     private String optionE;
> >>     private String optionF;
> >>     private String optionG;
> >>     private int answerType;
> >>     private String CorrectAnswer;
> >>     private int showAsMCQ;
> >>     private String hint;
> >>     HttpServletRequest request;
> >>
> >>     public int getAdminid() {
> >>         return adminid;
> >>     }
> >>
> >>     public void setAdminid(int adminid) {
> >>         this.adminid = adminid;
> >>     }
> >>
> >>     public int getmQuestionid() {
> >>         return mQuestionid;
> >>     }
> >>
> >>     public void setmQuestionid(int mQuestionid) {
> >>         this.mQuestionid = mQuestionid;
> >>     }
> >>
> >>     public int getmAnswerid() {
> >>         return mAnswerid;
> >>     }
> >>
> >>     public void setmAnswerid(int mAnswerid) {
> >>         this.mAnswerid = mAnswerid;
> >>     }
> >>
> >>     public int getCourseid() {
> >>         return courseid;
> >>     }
> >>
> >>     public void setCourseid(int courseid) {
> >>         this.courseid = courseid;
> >>     }
> >>
> >>     public int getSubjectid() {
> >>         return subjectid;
> >>     }
> >>
> >>     public void setSubjectid(int subjectid) {
> >>         this.subjectid = subjectid;
> >>     }
> >>
> >>     public String getQuestion() {
> >>         return question;
> >>     }
> >>
> >>     public void setQuestion(String question) {
> >>         this.question = question;
> >>     }
> >>
> >>     public String getOptionA() {
> >>         return optionA;
> >>     }
> >>
> >>     public void setOptionA(String optionA) {
> >>         this.optionA = optionA;
> >>     }
> >>
> >>     public String getOptionB() {
> >>         return optionB;
> >>     }
> >>
> >>     public void setOptionB(String optionB) {
> >>         this.optionB = optionB;
> >>     }
> >>
> >>     public String getOptionC() {
> >>         return optionC;
> >>     }
> >>
> >>     public void setOptionC(String optionC) {
> >>         this.optionC = optionC;
> >>     }
> >>
> >>     public String getOptionD() {
> >>         return optionD;
> >>     }
> >>
> >>     public void setOptionD(String optionD) {
> >>         this.optionD = optionD;
> >>     }
> >>
> >>     public String getOptionE() {
> >>         return optionE;
> >>     }
> >>
> >>     public void setOptionE(String optionE) {
> >>         this.optionE = optionE;
> >>     }
> >>
> >>     public String getOptionF() {
> >>         return optionF;
> >>     }
> >>
> >>     public void setOptionF(String optionF) {
> >>         this.optionF = optionF;
> >>     }
> >>
> >>     public String getOptionG() {
> >>         return optionG;
> >>     }
> >>
> >>     public void setOptionG(String optionG) {
> >>         this.optionG = optionG;
> >>     }
> >>
> >>     public int getAnswerType() {
> >>         return answerType;
> >>     }
> >>
> >>     public void setAnswerType(int answerType) {
> >>         this.answerType = answerType;
> >>     }
> >>
> >>     public String getCorrectAnswer() {
> >>         return CorrectAnswer;
> >>     }
> >>
> >>     public void setCorrectAnswer(String CorrectAnswer) {
> >>         this.CorrectAnswer = CorrectAnswer;
> >>     }
> >>
> >>     public int getShowAsMCQ() {
> >>         return showAsMCQ;
> >>     }
> >>
> >>     public void setShowAsMCQ(int showAsMCQ) {
> >>         this.showAsMCQ = showAsMCQ;
> >>     }
> >>
> >>     public String getHint() {
> >>         return hint;
> >>     }
> >>
> >>     public void setHint(String hint) {
> >>         this.hint = hint;
> >>     }
> >>
> >>     public UpdateQuestionAction() {
> >>     }
> >>
> >>     public String updateQuestion() {
> >>         QuestionImplementor qi = new QuestionImplementor();
> >>         AnswerImplementor ai = new AnswerImplementor();
> >>         System.out.println("Answer Id : " + getmAnswerid());
> >>         System.out.println("Question Id : " + getmQuestionid());
> >>         adminid = ((Integer)
> >> request.getSession().getAttribute("adminid")).intValue();
> >>         ExmQuestion eqn = new ExmQuestion();
> >>         ExmAnswers eas = new ExmAnswers();
> >>         eqn.setQuestionid(getmQuestionid());//(getmQuestionid());
> >>         eqn.setQuestion(getQuestion());
> >>         eqn.setCourseid(getCourseid());
> >>
> >> eqn.setSubjectid(getSubjectid());//eq.setSubjectid(getSubjectids());
> >>         eqn.setAdminid(adminid);
> >>         eqn.setOccurance(0);
> >>         eqn.setQuestionhint(getHint());
> >>         eqn.setShowasMcq(getShowAsMCQ());
> >>         if (qi.editQuestion(eqn)) {
> >>             eas.setAnswerid(getmAnswerid());//(getmAnswerid());
> >>             eas.setAnswer(getCorrectAnswer());
> >>             eas.setOptionA(getOptionA());
> >>             eas.setOptionB(getOptionB());
> >>             eas.setOptionC(getOptionC());
> >>             eas.setOptionD(getOptionD());
> >>             eas.setOptionE(getOptionE());
> >>             eas.setOptionF(getOptionF());
> >>             eas.setOptionG(getOptionG());
> >>             if (ai.editAnswer(eas) != true) {
> >>                 addActionError("Failed to Update Answer");
> >>             }
> >>         } else {
> >>             addActionError("Failed to Update Question");
> >>         }
> >>         addActionMessage("Question Updated Successfully");
> >>         return SUCCESS;
> >>     }
> >>
> >>     @Override
> >>     public void setServletRequest(HttpServletRequest hsr) {
> >>         this.request = hsr;
> >>     }
> >> }
> >>
> >>
> >>
> >> On Sun, Jun 15, 2014 at 2:05 PM, Lukasz Lenart <lukaszlenart@apache.org
> >
> >> wrote:
> >>
> >> > Can you show your action? Looks like a issue with setters
> >> >
> >> > 2014-06-14 14:57 GMT+02:00 NIJO GEORGE <nijomon@gmail.com>:
> >> > >  <s:hidden value="%{#qa.questionid}" name="mQuestionid" id="qid" />
> >> > >  <s:hidden value="%{#qa.answerid}" name="mAnswerid" id="aid" />
> >> > >
> >> > > 17:58:54,084 ERROR
> >> > > [com.opensymphony.xwork2.interceptor.ParametersInterceptor]
> >> > > (http--127.0.0.1-8080-6) Developer Notification (set struts.devMode
> to
> >> > false
> >> > > to disable this message):
> >> > > Unexpected Exception caught setting 'mAnswerid' on 'class
> >> > > com.dieutek.examsoft.question.CreateQuestionAction: Error setting
> >> > expression
> >> > > 'mAnswerid' with value ['26', ]
> >> > >
> >> > > 17:58:54,085 ERROR
> >> > > [com.opensymphony.xwork2.interceptor.ParametersInterceptor]
> >> > > (http--127.0.0.1-8080-6) Developer Notification (set struts.devMode
> to
> >> > false
> >> > > to disable this message):
> >> > > Unexpected Exception caught setting 'mQuestionid' on 'class
> >> > > com.dieutek.examsoft.question.CreateQuestionAction: Error setting
> >> > expression
> >> > > 'mQuestionid' with value ['3402', ]
> >> > >
> >> > >
> >> > > I'm Getting the above error while getting value from two Hidden
> Fields
> >> > into
> >> > > a form Action. I have also tried these two fields with textfield
> too.
> >> But
> >> > > Getting the same error.
> >> > > I'm not using any Model driven Interface in my action. How i should
> >> > proceed
> >> > > with this?
> >> > >
> >> > >
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >> > For additional commands, e-mail: user-help@struts.apache.org
> >> >
> >> >
> >>
> >>
> >> --
> >> NIJO GEORGE P
> >> Follow me on Twitter <http://www.twitter.com/nijogeorgep>
> >> Add me as Friend <http://www.facebook.com/nijogeorgep>
> >> View my Profile on LinkedIn <http://in.linkedin.com/in/nijogeorgep>
> >> +918089699703
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


-- 
NIJO GEORGE P
Follow me on Twitter <http://www.twitter.com/nijogeorgep>
Add me as Friend <http://www.facebook.com/nijogeorgep>
View my Profile on LinkedIn <http://in.linkedin.com/in/nijogeorgep>
+918089699703


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic