At this point you might want to take a walk down to the local book store and find a good book on Struts. Lurking around the struts email lists wouldn't hurt either. I've found "Mastering Jakarta Struts" by James Goodwill pretty good both for learning and as a reference. I just hope he put out a new edition to better cover Struts 1.1. Lastly, take a look around the struts documentation both on the struts website and in the various .war files you downloaded with the struts package.
Good luck.
--David
Shilpa Nalgonda wrote:
I did waht all is mentioned, but still i have one problem, radio button not functioning properly. when i select "new user" it will take me to shipping.jsp and if i select "returning usr radio" it should take me to another ordersummary.jsp page. But my application is currently taking me to only shipping.jsp no matter which radio i select. Am i missing some scope issue...
Below is my jsp--- <label> <html:radio property="customerType" value="new"/> <bean:message key="prompt.checkCustomerType1"/> </label> <br> <label> <html:radio property="customerType" value="returning"/> <bean:message key="prompt.checkCustomerType2"/> </label> <br>
Below is my struts config== ================================ <form-bean name="CheckCustomerForm" type="com.ecommerce.form.CheckCustomerForm"/>
</form-beans>
<action path="/checkCustomer" type="com.ecommerce.action.CheckCustomerAction" name="CheckCustomerForm" input="/CheckCustomer.jsp"> <forward name="new" path="/EditShipping.jsp" /> <forward name="returning" path="/OrderSummary.jsp" /> </action>
=========================================================== This is my formBean class-- public class CheckCustomerForm extends ValidatorForm {
private String ms_EmailAddress = null; private String ms_CustomerType = null; private String ms_Password = null;
public CheckCustomerForm() { setCustomerType("new"); } public String getCustomerType() { return this.ms_CustomerType; } public String setCustomerType(String type) { return this.ms_CustomerType = type; }
public void reset(ActionMapping mapping, HttpServletRequest request) { this.ms_EmailAddress = null; this.ms_Password = null; }
/** * Validate the properties that have been set from this HTTP request, * and return an <code>ActionErrors</code> object that encapsulates any * validation errors that have been found. If no errors are found, return * <code>null</code> or an <code>ActionErrors</code> object with no * recorded error messages. * * @param mapping The mapping used to select this instance * @param request The servlet request we are processing */ public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { // Perform validator framework validations ActionErrors errors = super.validate(mapping, request); if ((ms_CustomerType == null) || (ms_CustomerType.length() < 1)) errors.add("CustomerType", new ActionError("error.CustomerType.required")); if ((ms_EmailAddress == null) || (ms_EmailAddress.length() < 1)) errors.add("EmailAddress", new ActionError("error.EmailAddress.required")); if ((ms_EmailAddress != null) && (ms_Password == null)) errors.add("Password", new ActionError("error.Password.required")); return errors; } ============================================================================ ================
-----Original Message----- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Thursday, July 29, 2004 8:01 PM To: Tomcat Users List Subject: Re: org.apache.jasper.JasperException: /CheckCustomer.jsp(36,67) equal symbol expected
Ok. Cool. That's what I'm using as well.
Your on the right track with the bean. Just make sure it extends org.apache.struts.action.ActionForm (it won't work otherwise) and then add it to the <form-beans> section of your struts-config.xml file. There are examples already there if you're using one of the struts war files. I tend to start with struts-blank.war when I start my projects.
You won't have to instantiate the bean yourself in the jsp because that will be taken care of by the <html:form> tag. You will have to make sure the name of your form-bean is specified in the name attribute of your <action> entry of the struts-config.xml. Again, the struts war files have examples in their stock standard struts-config.xml files. Also take a look at the struts-examples.war and struts-docs.war files. They are all downloaded together in one archive from the Struts site.
That should get you going.
--David
Shilpa Nalgonda wrote:
symbolthanks, and i am using Struts
-----Original Message----- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Thursday, July 29, 2004 4:47 PM To: Tomcat Users List Subject: Re: org.apache.jasper.JasperException: /CheckCustomer.jsp(36,67) equal symbol expected
Quick question -- are you using Struts? I just need to know so I know what to recommend.
I've got to run now and get my exercise. I'll check back later when I get home.
--David
Shilpa Nalgonda wrote:
yeah, ur right i just want to select a default value for the radio button. Radio button has two values a new user and a returning user. user also has a email address.
But i am not sure how exactly this can be done .. should i write a bean class called "User" with 2 properties,
public class User{ Private String emailaddress = null; private String usrType = "new";
//getters and setters; }
And then in jsp <% User usr = new User(); %> when i use the < html:radio tag how can i display that usr?
--please help, i am new to java world
-----Original Message----- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Thursday, July 29, 2004 3:56 PM To: Tomcat Users List Subject: Re: org.apache.jasper.JasperException: /CheckCustomer.jsp(36,67) equal symbol expected
Well....
The checked attribute is without a value. You'll have to set it to something or remove it. As mentioned by Tim Funk, the checked attribute doesn't exist in the API for the <html:radio/> tag.
I'm guessing you want to set one of the radio buttons as a default. If so, you'll have to do something different like set a default value in the bean class when it's initialized.
--David
Shilpa Nalgonda wrote:
How to resolve that?
-----Original Message----- From: Tim Funk [mailto:[EMAIL PROTECTED] Sent: Thursday, July 29, 2004 3:27 PM To: Tomcat Users List Subject: Re: org.apache.jasper.JasperException: /CheckCustomer.jsp(36,67) equal symbol expected
I bet its:
<html:radio property="checkCustomerType" value="new" checked/>
-Tim
Shilpa Nalgonda wrote:
Hi i am getting the following error,
org.apache.jasper.JasperException: /CheckCustomer.jsp(36,67) equal
eorg.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandlexpected at
4
r
.
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:java:94) at
1
2
8
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:) at
2
6
) at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:169) at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:136) at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:718) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:804) at org.apache.jasper.compiler.Parser.parseBody(Parser.java:833) at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:753) at org.apache.jasper.compiler.Parser.parseElements(Parser.java:804)
belolw is my jsp using struts tags. I have combined html and struts
tags..
where am i doing wrong...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <html:html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Login or Start Order</title> <link href="styles/base.css" rel="stylesheet" type="text/css"> <link href="styles/checkCustomer.css" rel="stylesheet" type="text/css"> <script language="javascript" src="basicFunctions.js"></script> </head>
<body> <html:errors/> <table cellspacing="0"> <tr> <td id="progressBar" align="center"> <span>Welcome</span> <span>Select Product</span> <span>Choose Options</span> <span id="active">Create Order</span> <span>Review Order</span> <span>Complete Order</span> </td> </tr> </table> <div class="headType" id="top">Ordering from MyPublisher is quick and easy</div> <div> <html:form action="/checkCustomer"> <bean:message key="prompt.emailaddress"/> <html:text property="emailAddress" size="16" maxlength="16"/> <label> <html:radio property="checkCustomerType" value="new" checked/> <bean:message key="prompt.checkCustomerType1"/> <label> <br> <label> <html:radio property="checkCustomerType" value="returning"/> <bean:message key="prompt.checkCustomerType2"/> <label> <br>
<html:password property="password" redisplay="false"/> <html:submit value="Continue"/> </html:form> </div> <div> <input type="button" value="Back" onClick="goBack()"> <input type="button" value="New User" onClick="location.href='editShipping.html'"> <input type="button" value="Existing User" onClick="location.href='orderSummary.html'">
</div> </body> </html:html>
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- 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]
--------------------------------------------------------------------- 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]