Rosemary,

I had a long day at work so bear with me..

Are you using the JavaScript 'onClick' event to go to the new form which is
resulting in missing hidden fields?  If so, that is your problem:

It isn't changing the action on the from (And then submitting the form) but
changing the web page in the browser directly using window.location.  That
ignores all forms on the page and acts as if you typed the URL in the
browser's location text box/window.  I believe you would want to change the
onClick to do something like this:

onClick="javascript:this.form.action=\"./empDetailPrepare.do\";this.form.sub
mit();"

My javascript might be slightly off but I'm definitely about there.  This
would result in the onClick event changing the form's submit location and
then submitting the form.  Any variables, hidden or visible, would be
submitted to the new Struts action.

Regards,
David

-----Original Message-----
From: Rosemary Philip [mailto:[EMAIL PROTECTED]
Sent: Monday, October 18, 2004 9:13 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: html:hidden values are null


Yes, the html:hidden is within an html:form. Also when I do a view
source on the page, I can see the values of the hidden variables
correctly.
but when I trace them to action class, they are null, all of them.

another thing. this is what my html:form tag in my first jsp page says.
<html:form action="/showempList" method="post">

but in the same page I have this <TR class="command"
                  onclick='window.location="./empDetailPrepare.do"'
   > ,
which goes to a different action. I dont know enough about Struts to
know if this is a problem. There is a similar logic in another set of
pages where , both are the same. I meant both actions are the same and
that works.




On Mon, 18 Oct 2004 00:01:51 -0400, David G. Friedman
<[EMAIL PROTECTED]> wrote:
> Are you positive you have the html:hidden tag
> within the appropriate html:form tag?  What is
> your html:form tag for either JSP?
>
> Regards,
> David
>
>
>
> -----Original Message-----
> From: Rosemary Philip [mailto:[EMAIL PROTECTED]
> Sent: Sunday, October 17, 2004 10:48 PM
> To: [EMAIL PROTECTED]
> Subject: html:hidden values are null
>
> I am having a problem getting values to another page when I try to use
> html:hidden.
>
> I have a list of employee objects in a page. on clicking on an
> employee from the list, the next page should show me more details on
> the employee.
> for getting the values across, i am trying to use html:hidden. but for
> some reason i am getting null for the attributes.
>
> when i do a view source on the page with the list, this is what i see.
>
> <TR class="command"
onclick='window.location="./empDetailPrepare.do"'       >
>
>        <input type="hidden" name="empNmbr" value="8423">
>        <input type="hidden" name="empSSN" value="55315">
>
>        <TD class="list">Howard Austin</TD>
>       <TD class="list">Programmer</TD>
>
> The employee list shows the name and job title of the employee and I
> am passing  empNmbr and empSSN as the hidden parameters.
>
> I have a EmplListForm (ActionForm)  which has empNmbr and empSSN as
> the attributes. I have a Value Object Employee , which has a bunch of
> attributes like empNmbr,empSSN,name,jobTitle etc.
> ---------------------------------------------------------------
> struts-config.xml
>
> <!--*** emp list form bean, just used to pass some properties to the
> next page***-->
> <form-bean name="empListbean" type="com.test.web.forms.empListForm">
> </form-bean>
>
> <!--*** show the emp list ***-->
> <action path="/showempList"  type="com.test.web.actions.EmpListAction"
> name="empListbean" scope="request">
>        <forward name="empdetailprepare" path="/empDetailPrepare.do"/>
> </action>
>
> <!--*** prepares the event detail screen for display ***-->
> <action path="/empDetailPrepare"
> type="com.test.web.actions.EmpDetailsPrepareAction" name="empListbean"
> scope="request">
>        <forward name="continue" path="/empDetail.jsp"/>
>                </action>
>
> --------------------------
> empList.jsp
>
> <html:hidden name='empobj' property='empNmbr'/>
> <html:hidden name='empobj' property='evntTm'/>
>
> <TD class="list"><bean:write name='empobj' property='name' /></TD>
> <TD class="list"><bean:write name='empobj' property='jobTitle' /></TD>
>
> --------------------------------------
> in my action class
>
> EmplListForm emplListForm = (EmplListForm ) form;
> System.out.println("empNmbr = "+request.getAttribute("empNmbr"));
>
> ------------------------------------------------------------------------
> I am at a loss at to what am I missing here. Can anyone point out
anything?
> Thanks,
> Rosemary
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to