• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Form bean not taking the value when property is disabled in jsp

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

MY jsp code is


<%
//Calling the class processDAO and the ICode value
processDAO dao=new processDAO();
String ICode=dao.newsupplier();

%>

and then i write

<html:text styleClass="txfield" property="code" value="<%= ICode %>" disabled="true"/>

My form bean is

public String code;
public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}

but its not taking the value;

But i write it as a disbled="false" in jsp it takes a value

Help me,

Thanks in advance
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
In your struts-config.xml file check the

<form-beans>
<form-bean name="LoginForm" type="com.solversa.loginForm"/>
</form-beans>


and

<action path="/main"
type="com.solversa.EmpAction"
name="LoginForm">
<forward name="success" path="/showEmployee.jsp" />
<forward name="failed" path="/error.jsp" />
</action>

In that both bold one names must be same,, but,,,
name of your form bean that i shown as bold & italic must be different than only bold one,,,
becoz faced same err .. this is solution for this.
hope this will help u...
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Disabled values are not passed as parameters in the request.

<html:text styleClass="txfield" property="code" value="<%= ICode %>" disabled="true"/>



Change this to:



By changing it to readOnly, the values will be passed and also the user will not be able to change the contents(which you were trying to achieve by having disabled="true")
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic