• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with the form variables in struts

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

i have a problem with form variables.
The value which i am giving when i send a req to the server is different from the value which i am giving..

it is taking the value which i have used in the previous sessions..

please can any one suggest how can i resolve my problem?
 
sri valli
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THe problem in detail is..i want to search on surname and this value is set to formbean and after processing some business logic it makes the connection to the database and it will retrieve the valuescorresponding the surname.

I have some more fields include the surname field..

if i try search on the combination of two fields including surname then it works fine.using only surname is giving problem.

Please any one suggest me how can i resolve this problem?
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post your Action class code , with How are you setting the surname field on JSP file with FormBean ...

I'm interested in How are you retrieving value from request for 'surname' ...
 
sri valli
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


My action form bean code is like this


class searchProjectForm{

serchProjectForm(){
//constructor
}

Public void reset(ActionForm form,HttpServletRequest request){

super.reset(request);

//array declaration

}

public void setSurName(String surname){
this.surname=surname;
}
public String getSurName(){
return surName
}



and the code for JSP is

searchProject {


<html:javascript formName="searchProjectForm" method="validateSearchProjectForm"/>

<html:form action="/searchProjectRelay" onsubmit="return validateSearchProjectForm(this);">

<html:hidden name="searchProjectForm" property="dispatch"/>
<html:hidden name="searchProjectForm" property="mode"/>
<html:hidden name="searchProjectForm" property="filterID"/>
<html:hidden name="searchProjectForm" property="filterName"/>
<ournet:button name="SearchProjectFind" displayName="Find" dispatch="SearchProjectFind" page="SearchProject" form="searchProjectForm"/>

<tr>
<td align="right"><b><i>Assigned User - AU -</i></b>(blank = ALL) Surname</td>
<td><html:text property="surName" maxlength="20" size="20"/></td>

</tr>


and my action class code is


public class PerformSearchProjectAction extends PLOAction {

protected String doExecute(ActionForm form, HttpServletRequest request) throws Exception {
_log.debug("Entering PerformSearchProjectAction.doExecute(...)");

if (!(form instanceof SearchProjectForm)) { // We do not have a SearchProjectForm, so we
// cannot feasibly continue
return NPAAction.FAILURE_KEY;
}
else {
SearchProjectForm searchProjectForm = (SearchProjectForm) form;
try{
projectSearchFormulator.setAssignedUserSurname(searchProjectForm.getSurName());
} }
catch (Exception e) {
e.printStackTrace();
_log.debug("In PerformSearchProjectAction.doExecute(...) - Exception: " + e);
return NPAAction.FAILURE_KEY;
}

_log.debug("Exiting PerformSearchProjectAction.doExecute(...)");

return NPAAction.SUCCESS_KEY;
}}


Any Help Would be appreciate
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have some case differences in your form class - surname vs. surName. I'm not sure if this is just a result of how you posted the code or if they really are that way in your code. Try to make the cases consistent between the getter, setter and property. I'm not sure exactly what java looks at to determine if something is a bean property or not, but inconsistent casing might do it.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like you extends the Action class with PLOAction .. The code looks fine.. Just look at the getter , setter methods as suggested by Tom..

Just print out on console the value of this statement



And please use CODE tag.. i.e enclosed your code in [C O D E] [/C O D E] tag
(w/o spaces) Its make code easier to read ..
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic