Actions and form beans
1. i have a jsp page that maps to a form bean
2. the form bean extends action form
3. i have 4 drop downs in my form
4. on form load two drop downs are populated (no issues so far)
5. on changing the selection in one of the forms i have to go back to the database fetch the values for the next drop down
6. i have written a separate action class for this.
7. This action class makes my input (what ever done on the form so far) as null and does not even retain the value of the drop down.
8. An alternate method i tried out was to just call the form submit so that the same action class is called multiple times.
9. however this fires the validator written in the form bean.
10. i need to be able to fire the validator only after my form has been filled.
11. Any ideas
you can specify the submit 'property' for example you can have different submit values in different names
than you can use validwher or requiredif validation case depending on the submit button checked.
Similar Messages
-
Anybody help me about as know how to developer using Actions and Form with JDeveloper.
Thank´s
Carlos Magno
[email protected]What specifically are you looking for?
If you are looking for a basic Struts Form that calls a Struts Action check out the JDeveloper Reviewer Guide
http://otn.oracle.com/products/jdev/collateral/papers/10g/reviewer/reviewerguide.html
Look at the Struts sample of a login form. -
Cannot retrieve definition for form bean null on action /submitCustomerForm
Can someone plz check my code...
while I try to run the code I got Stuck getting the above error report.
here is my code..
this is wat i wrote in JSP page
<html:form action="/submitCustomerForm">
and in my struts-config I ve..
<form-beans>
<form-bean name="CustomerForm" type="app1.CustomerForm" />
</form-beans>
<!-- ========== Global Forward Definitions ========= -->
<global-forwards><forward name="mainpage" path="index.jsp"></forward>
</global-forwards>
<!-- ========== Action Mapping Definitions ======== -->
<action-mappings>
<action
path="/submitCustomerForm"
type="app1.CustomerAction"
name="CustomerForm"
scope="request"
validate="true"
input="CustomerDetails.jsp" >
<forward name="success" path="/Success.jsp" />
<forward name="failure" path="/Failure.jsp" />
</action>
</action-mappings><html:form action="submitCustomerForm.do">the above is the way how you call your ActionServlet
if your ActionServlet mapping is
<servlet-mapping>
<servlet-name>ActionServlet</servlet>
<url-pattern>*.do<url-pattern>
</servlet-mapping> -
JSF Actions and ActionListeners with Tiles and forms
I�m having a problem trying to use the Tiles functionality in Struts 1.1 with JSF and was wondering if anyone could help me.
I have defined a very simple header, menu, content Tile that doesn�t involve nesting of tiles (ExampleTile_content1Level.jsp).
I have 3 JSP pages, the first testHarness.jsp is NOT built using Tiles and is just used to load some test data into a session scoped bean using an actionListener and then forward to a Tile generated page (ExampleTile3.jsp) using a hard-coded action �applicationSummary� when a commandLink is pressed. This works fine for both the action and actionListener.
ExampleTile3.jsp contains another commandLink that is meant to forward to another tile ExampleTile2.jsp. This also works until I try to add the <h:form> � </h:form> tag around the outside of the <h:panelGrid> tags in ExampleContent1.jsp when the action and actionListener then fail to fire and I get an �Error on Page� message in Explorer the detail of which says �Error �com_sun_rave_web_ui_appbase_renderer_CommandLinkRendererer� is null or not an object�.
However I need a form so that I can bind UI controls to data from the bean stored in the session scope. This is only a problem when I use Tiles to define the pages. Does anyone know what I am doing wrong?
Any help would be much appreciated.
Tiles.xml
<definition name="example3" path="/pages/exampleTile_content1Level.jsp" >
<put name="headerClass" value="someStyle"/>
<put name="menuClass" value="someStyle"/>
<put name="contentClass" value="someStyle"/>
<put name="header-title" value="/pages/exampleHeader.jsp" />
<put name="menu" value="/pages/exampleMenu.jsp" />
<put name="content" value="/pages/exampleContent1.jsp" />
</definition>
<definition name="example2" path="/pages/exampleTile_content1Level.jsp" >
<put name="headerClass" value="someStyle"/>
<put name="menuClass" value="someStyle"/>
<put name="contentClass" value="someStyle"/>
<put name="header" value="/pages/exampleHeader.jsp" />
<put name="menu" value="/pages/exampleHeader.jsp" />
<put name="content" value="/pages/exampleContent2.jsp" />
</definition>ExampleTile3.jsp
<f:view>
<h:form>
<tiles:insert definition="example3" flush="false" />
</h:form>
</f:view> ExampleTile2.jsp
<f:view>
<h:form>
<tiles:insert definition="example2" flush="false" />
</h:form>
</f:view> Faces-config.xml
<navigation-rule>
<from-view-id>/pages/testHarness.jsp</from-view-id>
<navigation-case>
<from-outcome>applicationSummary</from-outcome>
<to-view-id>/pages/exampleTile3.jsp</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/pages/exampleTile3.jsp</from-view-id>
<navigation-case>
<from-outcome>nextPage</from-outcome>
<to-view-id>/pages/exampleTile2.jsp</to-view-id>
<redirect/>
</navigation-case>
</navigation-rule> ExampleTile_content1Level.jsp
<tiles:importAttribute scope="request"/>
<h:panelGrid columns="1" >
<f:subview id="header-title">
<tiles:insert name="header-title" flush="false" />
</f:subview>
<f:subview id="menu">
<tiles:insert name="menu" flush="false" />
</f:subview>
<f:subview id="content">
<tiles:insert name="content" flush="false" />
</f:subview>
</h:panelGrid> ExampleHeader.jsp / ExampleMenu.jsp
<tiles:importAttribute scope="request"/>
<h:panelGrid columns="1" columnClasses="someSyle">
<h:outputFormat value="This is the {0}.">
<f:param value="Header / Menu as appropriate "/>
</h:outputFormat>
</h:panelGrid> ExampleContent1.jsp
<tiles:importAttribute scope="request"/>
<h:form> <----- Fails with this tag included but works without it.
<h:panelGrid columns="1" >
<h:outputFormat value="This is the {0}.">
<f:param value="Content on the FIRST page"/>
</h:outputFormat>
<h:commandLink action="nextPage" immediate="false">
<h:outputText value="Click to go to next page"/>
</h:commandLink>
</h:panelGrid>
</h:form> ExampleContent2.jsp
<tiles:importAttribute scope="request"/>
<h:panelGrid columns="1" >
<h:outputFormat value="This is the {0}.">
<f:param value="Content on the SECOND page"/>
</h:outputFormat>
</h:panelGrid>jezzica85 wrote:
Hi everybody,
I want to overload a method so it can take either 2 Actions, 2 ActionListeners, or one of each. The issue with this is that I'd have to make 4 overloaded signatures and almost identical methods, like this:
method( action, action )
method( action, listener )
method( listener, action )
method( listener, listener )
Well, if you want to support that then you are just going to have to do suffer through it, the only shortcut I can recommend is that your method(action, listener) and method(listener, action) are the same so you only have to implement 1 and just use the other as a entry point to call the one you wish to contain the code. -
How to populate form bean (Action form) from Action (Struts)
Hello to all..
I have a problem populating a from bean in struts from Action class...
What I would like is ..
1. how can I populate a formbean from Action so when a page (JSP) with tags will be displayed some tags will be set and some no (depends on data from database)..
example...
look at the picture...
http://freeweb.siol.net/peterv6i/ax1.jsp
I have a AO2.jsp page linked to action2 and also i have a formbean with set/get methods...
nex step.. when I call action2 I' retrive datas from my database and in Action class I would like to populate formbean which is from page AO3 (which will be displayed)..
Is this possible? here is my code but work only for 1 user.. if there are 2 or more users on page I get internal server error (Exception)..
this is my Action class
public class Action2 extends Action
public[b] ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
System.out.println("Action2");
session = request.getSession();
if (session.isNew()) {
response.sendRedirect("AO2.jsp");
AO3formbean frm = new AO3formbean(); <-- this is formbean from page AO3.jsp which I like to populate
frm.setName("xxxxxx");
frm.setSurname("ekekelek");
session.setAttribute("AO3formbean", frm); <-- here I put a formbean in session
return mapping.findForward("success");
then the AO3.jsp page will be called which use a AO3formbean... and here problems come... If only one user use the application all is ok.. but when two or more users use the same form with different session the page will not work well.. sometimes i get exception, sometimes white page.. sometimes nonsense datas are displayed..
Anybody know if is possibile to populate a formbean and store it in session or I must change whole code?
for example...
In my form i must enter a car assicurance policy number... (page AO2.jsp)..
then in the action form I must connect to my database and retrive information from table and populate bean which is also a formbean on the page AO3 which will be desplayed.. (if I'am doing something wrong please let me know the right way)
best regardshttp://freeweb.siol.net/peterv6i/ax1.jpg
-
PageFlow scope and session scoped form beans
Howdy,
Is there any more documentation on how the scope of form beans is supposed
to work in SP2? The only bit I find is a small section within the
jpf:forward and jpf:action annotation doc files. This doesn't really help
very much. If you could point to examples or more information explaining
how this can be done, I would really appreciate it!
Thanks,
WendyAre you sending the user back and forth between HTTP and HTTPS requests? If a session is established via HTTPS the cookie will be secure and will not be accessible to HTTP requests to the same server.
-
Passing data from JSP to Action w/o form bean
I would like to invoke an action using the content of a table cell displayed on
a JSP as the action parameter. For example, assume the JSP has a table displaying
the data attributes for an Employee (i.e. name, age, salary, department, etc.).
I would like clicking the data vale for an attribute to display more detailed
information about that attribute. So if I click on department, it would invoke
a getDepartmentDetails action that would get the attributes for that department
and display them on second JSP. The department attribute on the first JSP would
be an HTML anchor. Since the getDepartmentDetails action would not have a form
bean, how could I pass it the department id? I've heard that SP2 will support
something called page inputs. Will this resolve this problem? Thanks.I have a table listing companies...I had a link over the company code to call an
action selectCompany so that it would display a company info page.
I did this...
<td><netui:anchor action="selectCompany"><netui:parameter name="companyId" value="{container.item.companyId}"></netui:parameter><netui:label
value="{container.item.companyCd}"></netui:label></netui:anchor></td>
when I highlighted over the html link it would show
http://localhost:7001/Admin/financialInstitution/selectCompany.do?companyId=27
in my selectCompany action...to retrieve the parms, i did this...
String compId = this.getRequest().getParameter("companyId");
int iCompId = 0;
// A company object is loaded based on the companyId parameter.
try {
iCompId = Integer.parseInt( compId );
} catch (Exception exc) {
hope that helps,
Tom
"Fred Criscuolo" <[email protected]> wrote:
>
I would like to invoke an action using the content of a table cell displayed
on
a JSP as the action parameter. For example, assume the JSP has a table
displaying
the data attributes for an Employee (i.e. name, age, salary, department,
etc.).
I would like clicking the data vale for an attribute to display more
detailed
information about that attribute. So if I click on department, it would
invoke
a getDepartmentDetails action that would get the attributes for that
department
and display them on second JSP. The department attribute on the first
JSP would
be an HTML anchor. Since the getDepartmentDetails action would not have
a form
bean, how could I pass it the department id? I've heard that SP2 will
support
something called page inputs. Will this resolve this problem? Thanks. -
Authorization issue on hire action through HCM Process and Forms
Hi All,
We are executing hiring action through HCM form process. The process is using the HR_PL_ADMINISTRATOR role on ECC which is super admin access to execute the action and HR administrator role on the portal. If we restrict the role with personal area, we do not see the hire process on the portal.
Could you please let me know if anyone has faced this issue?
Thanks,
GowriThanks for responding back. I have seen the link before.
We have HR_PL_ADMINISTRATOR_000 role. The role has P_ASRCONT P_ORGIN and P_PERNR object. Object P_ORGIN needs to be set as
Authorization level Read
Infotype *
Personnel Area *
Employee Group *
Employee Subgroup *
Subtype *
Organizational Key *
in order to show the Hire Process in execute hiring link on the Portal. If we put a restriction on personal area, we do not see the Hire process on the execute hiring on the portal.
Kindly advice.
Thanks,
Gowri -
HCM Process and Forms Dynamic Actions
Hi
We are implementing HCM process and forms and presume that dynamic actions will have to be recreated as rules.
Can anyone give any guidance in this area as some of our dynamic actions are quite complex.
Many thanks
IanHi,
For HR forms please follow the following link
HCM Processes and Forms (www.service.sap.com/erp: - SAP ERP Human Capital Management -> Workforce Process Management -> HCM Processes and Forms -> Media Library)
https://websmp205.sap-ag.de/~form/sapnet?_SHORTKEY=00200797470000081848&
A dynamic action has the following components.
Infotype Number (INFTY): specifies the infotype for which you want the dynamic action triggered
Subtype (SUBTY): narrows the focus to a specific subtype
Field Name (FIELDN): starts your action when a maintenance function is performed on a particular field
Function (FC): specifies the various maintenance operations to which your dynamic action would respond. They are 02 (change); 04 (create); 06 (create and change); 08 (delete); 10 (change and delete); 12 (create and delete). Dynamic actions are only applicable in maintenance operations, not in display functions.
Sequence Number (NO): refers to a sequential number.
Step (A): specifies a particular type of action. No dynamic action is executed if the function character has a value other than one of the following:
P: Plausibility checks, which allow you to check certain conditions.
I: Calls an infotype for processing
W: Called after the I statement and used to assign values to screen fields while creating or copying another infotype record through the I statement
F: Calls a FORM routine (subroutines in ABAP) during your action. The routine may reside in or out the module pool MPNNNN00.
V: Lets you treat collectively a number of fields for which you want to define a common dynamic action
M: Sends SAP Office mail
Variable function part: The variable function part along with the step indicator forms the core part of your action. It specifies the processing details when the dynamic action is triggered. For example:
Requirement: When the postal code or the city of an employeeu2019s permanent residence is changed in infotype 0006, an email should be sent to the administrator.
INFTY SUBTY FIELDN FC NO. STEP VARIABLE FUNCTION
0006 1 ORT01 06 001 V PSTLZ
0006 1 PSTLZ 06 002 M M0001
The V statement on line 001 is used to link the two fields to the M statement. The statements relevant to field PSTLZ are also applicable to the ORT01 field.
When a record is created or changed in infotype 0006 of permanent address, an email is sent using the feature M0001. Information such as the recipient address, subject, and content of the mail is derived from M0001.
Warm REgards,
Kapil -
Can i Create a Form Bean ouitside a page controller and use it
In Pageflows all the form beans are created in the JPF file. Is it possible to create the FormBean outside the JPF file and use it in the JPF File..
Regards
KrishnaWhen you create a bean in a jpf it creates it as an inner class.
If you don't want to use this method all you have to do is to write your bean and import it into your jpf file(s) that use it. -
Form bean with int property and netui:select tag
Hi,
I've recently started using WebLogic 8.1 for a client project. There's
been a bit of a learning curve, but I've been able to find most of my
answers in the docs or on the dev2dev site. This one, though, I've been
unable to manage.
I have a database table, call it foo. In it I have columns for id
(numeric) and name (string). I created a database control to read that
data:
select id, name
from foo
I then want to use this data to populate a select list in a form, which
is going to be used to submit new records for another table. For the data:
id name
1 Foo
2 Bar
3 Bletch
I want to generate a select list (this is the output HTML, not the netui
tags):
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
</select>
My first question is what the best way to do this is. I was able to get
this working by creating a database control, which returns an array of a
custom Foo class. I then pass that array into a utility method which
converts it into a Map, and pass that map to the netui:select tag in the
optionDataSource attribute. This works, but it seems rather roundabout,
so I'm wondering if there's a better way to do it, without needing the
conversion utility method in the middle. I tried playing around with
the control, I tried using different netui tags (I thought I could do it
with a repeater and netui:selectOption tags, but that didn't work), and
nothing else worked.
The second problem arose when I was tying the result to a Form Bean. I
created a bean with all the data that I was reading from the form, and
at first, I just made everything in the form bean be a String. For this
select, though, the values are ids, so I thought I'd just make them be
ints in the form bean instead. However, when I did that, WL decided
that it wanted to add in a default option with a value of 0:
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
<option value="0" selected>0</option>
</select>
I've tried to find a way to get rid of that 0, and I can't. Is there a
way to prevent it from sticking in a default value like that? Or do I
have to just leave it as a String in the form bean to get it to work the
way I want?
Thanks in advance for your help.
Joe Robins Tel: 212-918-5057
Thaumaturgix, Inc. Fax: 212-918-5001
19 W. 44th St., Suite 810 Email: [email protected]
New York, NY 10036 http://www.tgix.com
thau'ma-tur-gy, n. the working of miracles.wrt your 2nd problem, in the jpf, for the form bean, are you declaring your id
like this:
private int id;
if so, try declaring it w/ a valid value, like:
private int id = 1;
-tanya
Joe Robins <[email protected]> wrote:
Hi,
I've recently started using WebLogic 8.1 for a client project. There's
been a bit of a learning curve, but I've been able to find most of my
answers in the docs or on the dev2dev site. This one, though, I've been
unable to manage.
I have a database table, call it foo. In it I have columns for id
(numeric) and name (string). I created a database control to read that
data:
select id, name
from foo
I then want to use this data to populate a select list in a form, which
is going to be used to submit new records for another table. For the
data:
id name
1 Foo
2 Bar
3 Bletch
I want to generate a select list (this is the output HTML, not the netui
tags):
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
</select>
My first question is what the best way to do this is. I was able to
get
this working by creating a database control, which returns an array of
a
custom Foo class. I then pass that array into a utility method which
converts it into a Map, and pass that map to the netui:select tag in
the
optionDataSource attribute. This works, but it seems rather roundabout,
so I'm wondering if there's a better way to do it, without needing the
conversion utility method in the middle. I tried playing around with
the control, I tried using different netui tags (I thought I could do
it
with a repeater and netui:selectOption tags, but that didn't work), and
nothing else worked.
The second problem arose when I was tying the result to a Form Bean.
I
created a bean with all the data that I was reading from the form, and
at first, I just made everything in the form bean be a String. For this
select, though, the values are ids, so I thought I'd just make them be
ints in the form bean instead. However, when I did that, WL decided
that it wanted to add in a default option with a value of 0:
<select name="foo">
<option value="1">Foo</option>
<option value="2">Bar</option>
<option value="3">Bletch</option>
<option value="0" selected>0</option>
</select>
I've tried to find a way to get rid of that 0, and I can't. Is there
a
way to prevent it from sticking in a default value like that? Or do
I
have to just leave it as a String in the form bean to get it to work
the
way I want?
Thanks in advance for your help.
Joe Robins Tel: 212-918-5057
Thaumaturgix, Inc. Fax: 212-918-5001
19 W. 44th St., Suite 810 Email: [email protected]
New York, NY 10036 http://www.tgix.com
thau'ma-tur-gy, n. the working of miracles. -
STRUTS - Cannot retrieve definition for form bean null -aaaarrrrgh
Hi Folks,
my head hurts and i become crazy... i know that a lot of people asked this question before, but i did not found any suitable solution.
I have simple a jsp page, containing a form which should be handled by struts. I tried everything, but i did not found my mistake.
Can anyone help me please?
JSP:
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ page contentType="text/html;charset=windows-1252"%>
<html:html locale="true">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Anmeldung f?r GOLEM Quickplayout</title>
</head>
<body>
<html:errors/>
<html:form action="checkLogin.do">
<table cellspacing="3" cellpadding="2" border="0" width="100%" align="left">
<tr>
<td>
<bean:message key="prompt.username"/>
</td>
<td>
<html:text property="username"/>
</td>
</tr>
<tr>
<td>
<bean:message key="prompt.password"/>
</td>
<td>
<html:text property="password"/>
</td>
</tr>
</table>
</html:form>i tryed a lot for the FORM -Tag, for instance:
<html:form action="checkLogin.do"> or
<html:form action="/checkLogin.do"> or
<html:form action="/checkLogin"> but all throws the same exception. :(
struts-config.xml
<form-beans>
<form-bean name="loginForm" type="de.orb.quick.view.LoginForm"/>
</form-beans>
<action-mappings>
<action path="/login" type="de.orb.quick.view.LoginAction" name="loginForm" input="/login.jsp" scope="session" unknown="true">
<forward name="success" path="/showData.jsp"/>
</action>
<action path="/checkLogin" type="de.orb.quick.view.CheckLogonAction" unknown="false" input="/login.jsp">
<forward name="success" path="/storeRequestData.do"/>
<forward name="failure" path="/login.do"/>
</action>
Exception:
javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:831)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at _login._jspService(login.jsp:11) [/login.jsp]
LoginAction:
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
return mapping.findForward("success");
LoginForm:
public class LoginForm extends ActionForm {
private String password = "";
private String username = "";
public void reset(ActionMapping mapping, HttpServletRequest request) {
super.reset(mapping, request);
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
return super.validate(mapping, request);
public String getPassword() {
return password;
public void setPassword(String password) {
this.password = password;
public String getUsername() {
return username;
public void setUsername(String username) {
this.username = username;
}Sorry for this stupid question, but how can i avoid this exception while using struts TagLibs?
I tried to face the jsp with another action, but this does not change anything.
Thank you in advance
Mirkojavax.servlet.jsp.JspException: Cannot retrieve definition for form bean myfrom
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:831)
at org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:506)
at jsp_servlet.__index._jspService(__index.java:155)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1053)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:387)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6291)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3575)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2573)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151) -
Cannot retrieve definition for form bean null
Hi,
I have a page jsp which contains a form. This form contains an action
towards (page.do ).
I configured struts-config.xml file in whom I put a configuration of
action ( type=xxx.pageAction ) but not form because I have not need of
it.
During the execution it show that it tries to instantiate a bean of form
corresponding to a configuration of action and post this error message
" Root causes of ServletException javax.servlet.jsp. JspException:
Cannot retrieve definition for form bean null "
Could you indicate to me where is the problem ?
Here is my configuration :
< html:form action = " page.do " method = " post " >
</html:form >
<action path="/page"
type="xxx.pageAction">
<forward name="show" path="/page.jsp"/>
</action>
Thanks in advance
Rachid.
There's little reason to use Struts infrastructure to set this up since you have no model, and the controller aspect is well-defined (just go to "NewProject"!). You're basically providing a link from one page to another, akin to doing an <a href>, and you wouldn't use Struts to do a simple link :).
I would just just use standard HTML.
If you're okay with using Javascript, this is the simplest:
<input type="button" onClick="document.location='NewProject'">
Or you can use a standard HTML form, as you've basically done already:
<form action="NewProject" method="get">
<input type="submit" value="Create">
</form> -
How to reset values in a Data Form Bean?
I have created an ADF application that has a search facility in it. The architecture is as follows:
DataPage (search.jsp) --> DataAction (validateSearch) -->DataAction (refreshCollection) --> DataPage (results.jsp)
I have successfully created a data form bean to hold the data that is submitted in the search and bind it to the refresh method of the collection. I have also successfully overridden the validate method, which catches and throws and displays appropriate ActionErrors on the search.jsp page.
I have added a link back to the search.jsp page from the results.jsp page (as a user may wish to perform another search), the ActionErrors are resetting ok but I have not managed to work out how to reset the values of the actual data form bean.
I have tried several different ways of overriding the reset method within the data form bean but so far have been unsuccessful - I would appreciate any assistance with this matter.
Shown here is a basic example of a form bean that I have been trying different things out with - I can not get the reset method to even be called - please help!
package uk.dmf.eg02;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
public class searchForm extends ActionForm
String search;
public setupForm()
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
ActionErrors errors = new ActionErrors();
if (search.trim().length()==0)
errors.add("search", new ActionError("error.search"));
return errors;
public void reset(ActionMapping mapping, HttpServletRequest request)
System.err.println("EXECUTING RESET METHOD");
this.search = "";
public void setSearch(String search)
this.search = search;
public String getSearch()
return search;If you run in request scope the reset method is called, however in session scope is't only called once (or never?). See documentation of method reset():
public void reset(ActionMapping mapping,
javax.servlet.http.HttpServletRequest request)
Reset bean properties to their default state, as needed. This method is called before the properties are repopulated by the controller.
The default implementation does nothing. In practice, the only properties that need to be reset are those which represent checkboxes on a session-scoped form. Otherwise, properties can be given initial values where the field is declared.
If the form is stored in session-scope so that values can be collected over multiple requests (a "wizard"), you must be very careful of which properties, if any, are reset. As mentioned, session-scope checkboxes must be reset to false for any page where this property is set. This is because the client does not submit a checkbox value when it is clear (false). If a session-scoped checkbox is not proactively reset, it can never be set to false.
This method is not the appropriate place to initialize form value for an "update" type page (this should be done in a setup Action). You mainly need to worry about setting checkbox values to false; most of the time you can leave this method unimplemented. -
Cannot create a Struts Form bean using jdeveloper 10g
Hello I'm new to jdeveloper and struts and triying to create a sample login page following this tutorial :http://www.oracle.com/technology/products/jdev/htdocs/handson/struts/strutshandson.html
But I have a little problem in the 3rd excercice (Building Struts Form Beans and Actions)
when I follow the instructions "Select File | New > Choose Web-Tier in the Categories, and select Struts > Select ActionForm from the Items > Click OK. "
there is no ActionForm Item ! the only available item is "Struts Controller page Flow" and I allready used this one to create the struts' project template !
(same thing : Struts Action in the next tutorial section is not available)
BTW : I have to use jdeveloper 9.0.5.2 and not a latest version1. Take a look at the class diagram for query model http://docs.oracle.com/cd/E17904_01/web.1111/b31973/af_query.htm#BABDGCHI
2. Also see if this helps you understand http://jobinesh.blogspot.in/2011/03/retrieving-viewcriteria-from-custom.html
Maybe you are looking for
-
How to open all bookmarks in a folder
Hello, I've had a longstanding question regarding the behavior of bookmark folders and the Command/Ctrl"shortcut" that acts as if selecting Open All in Tabs. Why does the menu open when I Command click on a bookmark folder from the bookmarks toolbar?
-
How to download Pages in The Netherlands
Hi, Last week I was in New York, and I bought the iPad. I'm very happy with my recent purchase, but I would like to use pages before the iPad will be released in my country (July). I have a Dutch Appe ID, ofcourse, and a US Apple ID, without creditca
-
Hi All, I am facing two problems one with order and one with the invoice, 1.While creating sales order for and intra state customer by default the system is picking the amount of the CST also along with VAT condition.Can any one help.And the same is
-
Hi, We often park invoices as the business is very slow in doing goods reciepts. When we enter the PO number in MIR0 we get a message that says there is no selectable items, so we swtich to parking. The PO number stays in the PO field but the line
-
OCP Certification-Forms Developer(1z0-141)
Hi, i am planning to take my OCP exam on Developer track(1z0-141). i don't have any idea about the book i need to refer.kindly let me know which book would be recommended for the exam(1z0-141).