Form Problem in Struts
Hi
I have a problem with Form: I've a tiles project and it works, but I tried to insert in body a form as you see below, but after inserting it doesn't work as it cann't show all parts that
have form. Can anybody tell me why? thanks,
Parviz
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
<html:form action="/doPageTwo">
<table border="0" width="100%" height="100%" cellpadding="1">
<tr height="10%">
<td align="center" colspan="3" height="10%" bgcolor="darkblue">
<tiles:insert page="/common/header.jsp"/>
<!-- tiles:put name="title" beanName="title" beanScope="tile"/-->
<!-- /tiles:insert-->
</td>
</tr>
<tr height="80%">
<td width="10%" valign="top" bgcolor="gold">
<tiles:insert page="/common/navbar2.jsp"/>
</td>
<td width="60%" bgcolor="white" valign="top" align="left">
<table border="0" width="100%" height="100%">
<tr ">
<td width="30%" height="30%" valign="middle" >
<html:link action="/doPageTwo" ><html:img page="/images/Nature.jpg"/></html:link>
</td>
<td width="30%" height="30%" bgcolor="white" valign="middle">
<html:img page="/images/HappyBirthday.jpg"/>
</td>
<td width="30%" height="30%" bgcolor="white" valign="middle">
<html:img page="/images/Norouz.jpg"/>
</td>
</tr>
</table>
</td>
<td width="10%" bgcolor="blue" valign="top" >
<tiles:insert page="/common/news.html"/>
</td>
</tr>
<tr height="10%">
<td><html:submit/></td>
<td valign="bottom" colspan="3" height="10%" bgcolor="darkblue">
<tiles:insert page="/common/footer.jsp"/>
</td>
</tr>
</table>
</html:form>
It is happening because probably you missed to write the
enctype="multipart/form-data" in your <form>tag in jsp page from where you want to upload the file.
Similar Messages
-
Problem in struts using JDeveloper10.1.2
hi
Iam completly new to jdeveloper
Iam using jdev 10.1.2 for my simple struts application
I have
action class -- LoginAction
form bean -- login (using DynaActionForm)
login.jsp to enter username
success.jsp for welcom msg
failure.jsp --- in this i use one submit btn when i press this it will go to login.jsp for relogin
<form action="/login.jsp">....
the problem is
In LoginAction
String password=(String)((DynaActionForm)form).get("password");
// String pwd =request.getParameter("username");
if(password.equalsIgnoreCase("oracle"))
return mapping.findForward("success");
else
return mapping.findForward("failure");
iam import all the class for the respective reff variables.
But it will indicate err underline(blue) under text which are in bold saying msgs as
--method get(java.lang.string) not found in org.apache.struts.action.DynaActionform
the samething for remaining two showing on ActionMapping
plese tell me where is the problem
running on Embedded OC4J SERVER
error message is
http://hostname:8988/hello_struts1-ViewController-context-root/login.do
07/07/19 17:12:31 Oracle Application Server Containers for J2EE 10g (10.1.2.0.2) initialized
Jul 19, 2007 5:12:32 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Jul 19, 2007 5:12:32 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Jul 19, 2007 5:12:32 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='view.ApplicationResources', returnNull=true
Jul 19, 2007 5:12:32 PM org.apache.struts.action.RequestProcessor processException
WARNING: Unhandled Exception thrown: class java.lang.NullPointerException
thanksDuplicate post:
problem on struts using jdeveloper 10.1.2
user583549,
I see you got an answer from Shay in the other post.
Good Luck,
Avi. -
Multipart Forms, UTF and Struts
Hi,
We're developing an internationalised application with a custom application
framework which makes use of struts.
Entry of i18n text works perfectly for each form throughout the application
except for when the form is "multipart/form-data":
<form name="myForm" method="post" action="/myAction"
enctype="multipart/form-data">
</form>
The unicode text that is inserted into the database is expanded, ie 2
characters per input character.
What I'd like to know is if anyone else has had a similar problem, and if
they have a solution to it?
Additionally, is this a Weblogic problem, a Struts problem or something that
we have introduced.
Environment.
Windows XP
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
Struts 1.0.1 ~
Weblogic 6.1 SP1
Oracle Thin Driver
Oracle 8.1.6
Any help is appreciated.
Peter
This link may help you.
http://balusc.blogspot.com/2007/11/multipartfilter.html -
"Serious Problem in Struts" + "Please help me"
Hi all,
I m facing one problem in struts. I have A DTO with Attributes(data transfer Object) which contains one Array List. In that Arraylist i have other B DTO with Attributes.
In my Screen I have fields which are using some of the attributes from A DTo and B Dto
In the JSP
I m creating controls like this
<html:text name="facilityForm" property="dto.installationSite" />
in the ActionForm I m setting values which are typed in the screen to the dto.
I have to create one control(textbox) which is using B DTO Attribute..
How to do that?
if its the attribute of DTO i can create like this
"dto.installationSite"
But A Dto contains ArrayList that contains B Dto objects
<html:text name="facilityForm" property="dto.ARRAYLIST(B DTO).Attribute" />
Please help me...try this... (not sure though)
<html:text name="facilityForm" property="dto[0].Attribute" />
or is it this:
<html:text name="facilityForm" property="dto(0).Attribute" />
... I'm not really sure about this, however. ...Maybe instead, loop thru the outer list and create a field for each object. -
Smart Form problem with address layout
Hello everyone,
I need your help please for a smart form problem. We need the address layout for great britain with street1, street2 etc. but currently street2 is alligned before street1.
We are using the FM ADDRESS_INTO_PRINTFORM (SAP standard address node) and according to the documenation the layout for GB is different as we see it currently.
We have checked the sold-to and all contact persons, they have as country GB and language EN maintained.
In customizing for address screen layout there is nothing chosen (tested to set up Europe, but did not change anything).
For the customizing 'specify my countries...' we have maintained GB as country with the address layout key 006, vehicle country key GB and language key EN.
For the described setting shouldn't there be designed the address in our smart forms according to 006? Anyhting in customizing we missed?
Thanks a lot for your answers.
TorstenHi,
Try to use line priority of FM, below is a brief of documentation. You can read it more in FM documentation:
Control Parameters
See also the parameter documentation.
ADDRESS_TYPE - Address type (from 3.0C)
There are three types of address:
Address type '1': addresses of firms or organizations; the address
structure which is used in most SAP applications as 'Address'.
Address type '2': address of a person
Address type '3': work address, usually the address of a contact person
in a company
The default value SPACE for the address type is handled like type '1',
and is needed for the upwards-compatibility of the function module.
Which parameters are used for which address type is explained in the
ADDRESS_TYPE parameter documentation.
The three character "address layout key" of the recipient country (LAND1) controls which of the available country-specific routines is used to format addresses for the country in question. This key is stored in field T005-ADDRS and is entered in Customizing under Global settings -> Set countries -> Define countries, on the detail screen under "Address layout key".
Keys for customer routines in the SAP enhancement SZAD0001 can be
maintained via the transaction SM30 (extended table maintenance),table
name T005A, in the customer name range, and be assigned in country customizing.
The address attributes are passed in the structures ADDRESS1 (type 1), ADDRESS2 (type 2), ADDRESS3 (type 3) or ADRSWA_IN (type SPACE).
NUMBER_OF_LINES (ADRSWA_IN-ANZZL)
The number of lines available for the address layout. If the number of
lines is not sufficient for the complete layout of an address, then
lines are consecutively suppressed according to the rules of the country in question. Use the parameter LINE_PRIORITY (ADRSWA_IN-PRIOR) overrules the standard sequence in which the output lines are to be suppressed.
LINE_PRIORITY (ADRSWA_IN-PRIOR)
If not equal to SPACE, this field overwrites the standard sequence in
which the lines are suppressed if the available number of lines ANZZL is
insufficient.
The standard sequence is defined as follows:
Type 1: 'AP43HRT7I86LC2BS5O' (GB: 'APRT4327I86CBS5LO')
Type 2: 'APHRT7I86LCBS5O' (GB: 'PRT7I86CBS5LO')
Type 3: 'APF43HR7I86TLC2BSND5O' (GB: 'APRT4327I86CBS5LNDIO')
where (if they occupy a line of their own):
A = Title
P = Mandatory empty line 1
F = Function of the contact person in the company
4 = Name 4
3 = Name 3
H = Different city
R = Region
T = District
L = Name of country
C = Postal code
T = District
7 = Street 3 (field STR_SUPPL2)
I = Street 5 (field LOCATION)
8 = Street 4 (field STR_SUPPL3)
6 = Street 2 (field STR_SUPPL1)
L = Country
C = Postal code
2 = Name 2
B = PO Box
S = Street or PO Box
5 = c/o name
N = Name (and title) of a person
D = Department
O = City
Which of these attributes are available for maintenance can vary. All
fields exist in Business Address Services.
STREET_HAS_PRIORITY (ADRSWA_IN-WAREN)
'X': Street has priority over PO Box (delivery address for example)
' ': PO Box has priority over street. This is the default value.
regards, -
Muse CC 2014 contact web forms problems
Hi I recently created a website using muse cc 2014 and I uploaded it to the hosting server a free one at freehosting.com I set up everything I know of and when I uploaded the site using muse it gave a error message saying something about PHP mail??? I setup the mail account for my admin user and entered that in the muse contact form. If I test the contact form I do not get the messages and I even added a email to have it forwarded to my yahoo account. If I go in my email account and enter the hosting email account I however do see the message on the server's webmail page and it gets forwarded to the email I set to be the forward email. I checked everything and I'm really confused as what needs to be done. I also submitted a ticket asking customer service they have yet to respond. To note I'm using a free hosting company as it's just a personal website that I don't need all the fancy stuff just the basic needed components to make it work. my website does show up and the pages work EXCEPT the contact form which is needed and important. I ran the script and this is the results
PHP Version - OK
mail configured incorrectly
SQL configuration problem
The last two items I really don't understand what is the problem
Im using Cpanel and here is some basic info on the host server. Please help me. Thanks
Hosting package
Free Website
Server Name
customers
cPanel Version
11.44.0 (build 16)
Theme
x3
Apache version
2.4.9
PHP version
5.4.26
MySQL version
5.5.37-cll
Architecture
x86_64
Operating system
linux
Shared IP Address
Path to sendmail
/usr/sbin/sendmail
Path to Perl
/usr/bin/perl
Perl version
5.10.1
Kernel version
3.14.3
cPanel Pro
1.0 (RC1)What would be the fix or proper setup for the "SQL configuration problem?" I too am having form problems on a third party host, and after checking the PHP diagnostics, the "php version" reads ok, the "mail configuration" is ok, but the SQL configuration is not.
I guess I just need to know what I need to communicate to the hosting administrator about the SQL so they will configure it properly.
Thanks -
Make an input form in pdk-struts
Hi
I have an application that uses ADF BC4J as model and jsp as view. One of the pages has an master/detail input from.
I have installed struts-pdk and I can build and deploy simple text pages, which are visible as portlets in the portal. Linking between these pages, within the application also works.
How can I make an input form(either using struts-pdk or something else!) in the portal???
And how do I combine the input form to my existing ADF model???You need to start with a table in a sheet that has some columns with headers Once you create a new tab you can then create an input form for the table. This is in Numbers for iOS, not Mac OS X.
-
Comparing 2 form beans in Struts???
Hi,
How to compare 2 form beans in struts??? I have an edit screen with
some data in it. If user does not edit any of the values present in the
component(textfield) and try to submit the values that are old(already displayed)then i need to capture the data from form and compare it with the same data that is stored in another bean or session for example.
if both are equal, then prevent the user from submit otherwise allow the
user to submit the form with modified datas.
In order to proceed further,how we can actually compare 2 form beans which does have the same values in it???
Thanks,
JavaCrazyLoverNo replies as yet...
-
A problem with struts - DispatchAction class
Hi,
I am facing a problem with DispatchAction class in struts 1.1.
Here is my senario:
I have a two classes that extend DispatchAction - classA and classB.
In classA, I have a start method. In classB, I have two methods - display and submit.
When my application starts, my index.jsp does a logic:forward to the struts-config.xml file.
e.g.:
index.jsp<logic:forward name="startApp"/>
struts-config.xml<form-beans>
<form-bean name="testFormBean" type="package.testFormBean">
</form-bean>
</form-beans>
<global-forwards>
<forward name="startApp" path="/startApp.do?method=start"/>
</global-forwards>
<action-mappings>
<action name="testFormBean"
path="/startApp"
parameter="method"
validate="false"
scope="request"
type="package.StartAppActions">
<forward name="successOneUser" path="/runSearch.do?method=display"/>
</action>
<action name="testBean"
path="/runSearch"
parameter="method"
validate="false"
scope="request"
type="package.SearchActions">
<forward name="success" path="/html/jsps/success.jsp"/>
</action>
</action-mappings>
when my application starts, the control goes to the index.jsp and then because of the logic forward goes to the start method of the /startApp action(i.e. the StartAppActions class). I return a ActionForward element with the value of "successOneUser".
Uptill this point everything works fine.
But now it should go the /runSearch element (i.e. SearchActions class) and the display method of it. But it is not going there. The error I am getting is action[runSearch] does not have a method named "start".
I checked the value for the method parameter using the RAD/WSAD debugger, the value of parameter is "method" is still "start".
I do not understand why it is not overiding the value of parameter "method" with display even though I am doing a
<forward name="successOneUser" path="/runSearch.do?method=display"/> in the /startApp element, which should send the control to the display method of the [runSearch] element (i.e. in the startActions class).
Can anyone tell me what the problem is ?
Thanks in advance.
kaushalTry this:
Runtime.getRuntime().exec("your_batch_file.bat");
where your_batch_file is:
SET CLASSPATH=....(place all needed classes here)
javac.exe filename
must work,but there is some limitation...
you must think to solve this problems.
i hope that will help,
Marius -
Problems creating Struts ActionForm in JDeveloper 9.0.3.3
I am very new to JDeveloper, where recently i am learning on how to use the struts technology. The problem occurs when i right-click the project file at the navigator and i choose NEW then at the Web-Tier i choose Struts, and at the item columns i choose ActionForm. The thing is the dialog doesnt prompt and it goes back to the main Window. What's the problem? Any patches that i need to upgrade? I use JDeveloper 9.0.3.3 is because my company doesnt want to migrate to 10g for the time being. So, I have limitation in using 10g instead.
Regards,
RoLand
Java DeveloperHi Roland.
Yes, you are right. This does not seem to be working in the 9.0.3.x code base. I checked the 9.0.3.4 release and all the available patches and I don't see it as being fixed.
It is working in the 9.0.4.x release though and that is not 10g... Would that work for you?
Alternatively, you can could the action form class manually. Check out the 9.0.4 release on OTN to see what is generating and replicate that your 9.0.3.x product.
Hope that helps.
Pete -
Problem using struts tags in .jsp
I have a page that fills in the appropriate user information in text fields when viewed. The problem is, i want to have a text field that shows the full name, but i only have getter and setter methods for firstname and lastname in my form bean. Is there a way to combine firstname and lastname to display the fullname using the <html:text> tag ???
You can use an ActionForm for your view that differs from the bean you are using. DynaActionForm would be ideal because it can be tedious to have a full complement of view beans that mirror your value objects.
The idea is to loadup a DynaActionForm with the values for the view before the JSP is called in an Action. The following shows the parts of this and some code for execute() that creates DynaActionForm.
If you have this bean in myapp/Contact.java
package myapp;
public class Contact {
private String firstName,lastName;
public String getFirstName() { return firstName; }
public String getLastName() { return lastName; }
public void setFirstName(String _firstName) { firstName = _firstName; }
public void setLastName(String _lastName) { lastName = _lastName; }
}Put this in the appropriatesecions in struts-config.xml
<form-bean name="ContactActionForm" type="org.apache.struts.action.DynaActionForm">
<form-property name="fullName" type="java.lang.String"/>
</form-bean>
<action path="/showContactForm"
type="myapp.ShowContactActionForm">
<forward name="success" path="/contactActionForm.jsp">
</action>
<action path="/handleContact"
name="ContactActionForm"
type="myapp.HandleContactActionForm">
<forward name="success" path="/contactActionForm.jsp">
</action>And for the execute method in the ShowContactActionForm put...
Contact contact = db.getContact(contactId);
ModuleConfig mc = _mapping.getModuleConfig();
FormBeanConfig fbc = mc.findFormBeanConfig("ContactForm");
DynaActionFormClass dafc =
DynaActionFormClass.createDynaActionFormClass(fbc);
DynaActionForm theForm = (DynaActionForm)dafc.newInstance();
theForm.initialize(_mapping);
theForm.set("fullName", contact.getFirstName() + " " + contact.getLastName());
_request.setAttribute("ContactForm", theForm);
fwd = _mapping.findForward("success"); -
Urgent problem in struts bc4j app
The problem occurs between the Controller an the View Layer(can I debug there?) Anyway, I can see the data in the Action class, but not in the jsp page, there's just one row (the first).
Thank you.
I'm using the 9.0.3.3 build 1205
The Action class:
public class ShowneuebehauftrAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
BC4JContext context = BC4JContext.getContext(request);
ViewObject vo = context.getApplicationModule().findViewObject("BehauftrNeu");
//here the output looks fine
Row r = vo.first();
while (r != null)
for (int i = 0; i < vo.getAttributeCount(); i++)
String attrName = vo.getAttributeDef(i).getName();
String attrVal = r.getAttribute(i).toString();
System.out.println(attrName + " = " + attrVal);
r = vo.next();
return BC4JUtils.getForwardFromContext(context, mapping);
And the jsp page:
<%@ page language="java" errorPage="errorpage.jsp" contentType="text/html;charset=windows-1252" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/webapp/DataTags.tld" prefix="jbo" %>
<html>
<head>
<META NAME="GENERATOR" CONTENT="Oracle JDeveloper">
<LINK REL=STYLESHEET TYPE="text/css" HREF="bc4j.css">
<TITLE>
<bean:message key="behauftr.title"/>
</TITLE>
</head>
<body>
<table border="0" bgcolor="#003399">
<tr>
<th><font color="white" size="3"><bean:message key="behauftr.nr"/></font></th>
<th><font color="white" size="3"><bean:message key="behauftr.wunschdatum"/></font></th>
<th><font color="white" size="3"><bean:message key="behauftr.status"/></font></th>
<th> </th>
</tr>
<jbo:RowsetIterate datasource="DataaccessModule.BehauftrNeu" userange="true" >
<tr bgcolor="#f3f3f3">
<td>
<jbo:ShowValue dataitem="Nr"/>
</td>
<td>
<jbo:ShowValue dataitem="Wunschdatum"/>
</a>
</td>
<td align="right">
<jbo:ShowValue dataitem="BasNr"/>
</td>
</tr>
</jbo:RowsetIterate>
</table>
</body>
</html>There's another question: I tried to format a date field to SimpleDate format dd.MM.yyyy - in the Entity's and ViewObject's Attribute-Editor-Control-Hint.
It works fine in the BC-App-Module, but in the Action class there's the yyyy-MM-dd format back again (and of course in the jsp page as well). Does this have to be handled in the Action class?
But, more important, I still can't figure out why there's only one row in the jsp page - as described earlier -
Thanks in advance for your help.
Regards
gabriela -
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
-
hai
I have a problem while using the struts validator in my program.
It gives the error as:
HTTP Status 404 - Servlet action is not available
type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.
The program is given below
File : one.jsp
<html:form action="/test" method="post">
<table width="309">
<tr>
<td width="149"><div align="right">User Name: </div></td>
<td width="148"><html:text property="username" value=""/></td>
</tr>
<tr>
<td><div align="right">PassWord: </div></td>
<td><html:password property="password" value="" /> </td>
</tr>
<tr>
<td><div align="right">Number: </div></td>
<td><html:password property="number" value="" /> </td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><html:submit /> </td>
</tr>
</table>
</html:form>
web.xml file is ordineary file which contains the tag which is necessary for the struts.
File : struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<global-forwards>
<forward name="database" path="/database"/>
</global-forwards>
<form-beans>
<form-bean name="form1" type="struts1.bean1">
</form-bean>
</form-beans>
<action-mappings>
<action path="/test" name="form1" type="struts1.one" input="one.jsp" validate="true" scope="request" >
<forward name="success" path="/two.jsp"/>
</action>
</action-mappings>
<message-resources parameter="ApplicationResources" />
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" />
</plug-in>
</struts-config>
File validator.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE form-validation PUBLIC
"-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN"
"http://jakarta.apache.org/commons/dtds/validator_1_0.dtd">
<form-validation>
<formset>
<!-- Form for Validation example -->
<form name="form1">
<field property="username" depends="required">
<arg0 key="test.string"/>
</field>
<field property="password" depends="required">
<arg0 key="test.password"/>
</field>
<field property="number" depends="required">
<arg0 key="test.number"/>
</field>
</form>
</formset>
</form-validation>
File validator-rules.xml
The validator-rules.xml file is default validator-rules.xml file.
Iam using the two java file for ActionForm and Action
ActionForm file
package struts1;
import org.apache.struts.validator.ValidatorForm;
public class bean1 extends ValidatorForm
private String username=null;
private String password=null;
private int number=0;
public void setUsername(String username)
this.username=username;
public String getUsername()
return username;
public void setPassword(String password)
this.password=password;
public String getPassword()
return password;
public void setNumber(int number)
this.number=number;
public int getNumber()
return number;
Action class:
package struts1;
import struts1.bean1;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.DynaActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.ValidatorActionForm;
import org.apache.struts.validator.ValidatorForm;
import java.io.IOException;
import javax.servlet.ServletException;
public class one extends Action
public ActionForward execute(ActionMapping mapping,ActionForm form1,HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
String uname=null;
String pword=null;
String target=new String("success");
int num=0;
HttpSession session=request.getSession(true);
try
if(form1 !=null)
bean1 form=(bean1) form1;
uname=form.getUsername();
pword=form.getPassword();
num=form.getNumber();
session.setAttribute("uname",uname);
session.setAttribute("word",pword);
session.setAttribute("num",""+num);
catch(Exception e)
return mapping.findForward(target);
In two.jsp file Iam just getting the session value and displaying the result.
The Action and ActionForm are used inside the struts1 file which is placed inside the classes folder.
The Two file is also compiled successful.
When executing the one.jsp file is displayed but when clicking the submit button it giving the error as servlet action is not available.
So Iam try to change some coding in the Action Class
In the execute method I changed ValidatorForm instead of ActionForm.
but it giving the same error.
The same error is displayed when Iam trying the DynaValidatorForm
instead of struts bean class i.e ActionForm.
If any one knows what is the problem in the program please give some instrutction to correct the error or give some simple example program for practice.
Regards
A.K. RajAdd the Validator as the 6th argument and it should work fine.
Amy
<validator name="required"
classname="org.apache.struts.validator.FieldChecks"
method="validateRequired"
methodParams="java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest"
msg="errors.required"/> -
WLS 6.1 SP2, problem starting Struts
Hi,
We have recently upgraded our Weblogic Server from 6.1(no service pack) to
6.1 SP2. Now the problem is when I access a jsp page in my web application,
I get this nasty error:
<Feb 20, 2002 9:10:24 AM SGT> <Error> <HTTP>
<[WebAppServletContext(5743047,sme,/sme)] Root cause of Servl
javax.servlet.jsp.JspException: Cannot find ActionMappings or
ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:781)
at
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:481)
at jsp_servlet._security.__login._jspService(__login.java:132)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:304)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2495)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
I didn't change any of the configuration files that were working well with
the previous version of WLS. In fact even classpath also I didn't modify.
This problem is seen on Windows as well as Solaris env. Yesterday I played
with classpath in Solaris env. and kept the "struts.jar" as the fist in
classpath. It worked and I got an idea to remove it and see if it doesn't
work. It didn't work as expected, but didn't work even if I put it back form
then on.
Has any of you guys had the same problem and if yes, pl. let me know your
fix for it.
Thanks & Regards
Vijay
Hi,
We have recently upgraded our Weblogic Server from 6.1(no service pack) to
6.1 SP2. Now the problem is when I access a jsp page in my web application,
I get this nasty error:
<Feb 20, 2002 9:10:24 AM SGT> <Error> <HTTP>
<[WebAppServletContext(5743047,sme,/sme)] Root cause of Servl
javax.servlet.jsp.JspException: Cannot find ActionMappings or
ActionFormBeans collection
at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:781)
at
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:481)
at jsp_servlet._security.__login._jspService(__login.java:132)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:304)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2495)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2204)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
I didn't change any of the configuration files that were working well with
the previous version of WLS. In fact even classpath also I didn't modify.
This problem is seen on Windows as well as Solaris env. Yesterday I played
with classpath in Solaris env. and kept the "struts.jar" as the fist in
classpath. It worked and I got an idea to remove it and see if it doesn't
work. It didn't work as expected, but didn't work even if I put it back form
then on.
Has any of you guys had the same problem and if yes, pl. let me know your
fix for it.
Thanks & Regards
Vijay
Maybe you are looking for
-
ArrayList() problems
Hi! I need a little help getting an ArrayList to work. I am refactoring some of the classes in one of the O'Reilly books for a class assignment. I believe that I cannot get my ArrayList to add elements into itself. I'm not quite sure what I'm doing w
-
how do i change the email address for my icloud account on my 4s. when i sign in on line it is my new email address so i thought it would change automatically but obviously not!
-
The university I work for is using Ocal, I have the client working in windows, and had it installed fine and working in Gentoo, but in kubuntu I get these errors upon attempting to install. The referenced libs are all in place in /usr/lib Any suggest
-
Short text problem in import queue (STMS)
hello, I have a problem with the short text in the import queue on STMS,. The short text no longer appears on new request, but still appear on import history. would anyone help me with this matter? Anthony P.
-
Hi all. I've been reading about the efforts regarding esb deployment automation: Dealing with changing service wsdl locations in the ESB Now, I'd like to know about the latest best practices regarding BPEL deployment automation for different environ