RE: Javascript question...

2003-11-04 Thread Joe Krause
You need to put a space in front of the word selected. Right now your HTML
output will contain:

option value=2005selected2005/option

This makes the value equal to 2005selected. By putting a space in between
the quote and the word selected - you will change the value to 2005 and
selected will be picked up correctly.

document.write('option value=' + i + ' selected' + i + '/option');

You should put double quotes around the value parameter - its cleaner HTML:

document.write('option value=' + i + ' selected' + i + '/option');

You might have to escape those - I'm not sure.

-Original Message-
From: Jacob Wilson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 04, 2003 5:00 PM
To: Struts Users Mailing List
Subject: RE: Javascript question... 

Richard...
 
I find this list to be more user friendly in terms of responding to
questions... Also, not that I do not use Struts at all... for this
particular requirement of an old project under maintenance, I am trying to
do this... I consider this to be very much knowledge sharing list and hence
post questions whenever I have any... thanks is advance...
 
Now, getting back to your question... this is the code...
 
script language=javascript
 function generateYear(optionName,defaultValue) {
  var today = new Date();
  var year = today.getYear();
  document.write('select NAME='+optionName+'');
  document.write('option value=yearYear/option');
  for (var i=(year-4);i(year+4);i++ ) {
   if(defaultValue == i) {
document.write('option value=' + i +'selected' + i+'/option');
   } else {
document.write('option value=' + i +'' + i+'/option');
   }
  }
document.write('/select');
 }

html
script language=javascript
 generateYear(optStartDtYear,2005);
/script
/html
 
My idea is to make '2005' selected when the page loads... The above code
fails to make '2005' selected!!! If you can make me know the reason, it'd be
great... Thanks! 

Yee, Richard K,,DMDCWEST [EMAIL PROTECTED] wrote:
Jacob,
You wrote: unfortunately we aren't using Struts here...?
If you aren't using Struts then
a) why are you asking this question on a Struts mailing list
b) What do you mean then when you write Now if I have values of day, month,
year executing an action. How can I default those values in the select
box???

Regards,

Richard


-
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard


Populating Web Forms After Validation Errors

2003-11-03 Thread Joe Krause
I have a web form that includes several dropdown menus that must be
populated dynamically from a database. I am using an Action called
EditUserAction to setup the appropriate name value pairs for the dropdown
menus. I am building the name value pairs as simple String arrays which I
place in the request scope:

 

request.setAttribute(startPageValues, startPageLabels);

request.setAttribute(startPageLabels, startPageValues);

 

When the action is complete it forwards processing to a JSP page which
displays the form: /WEB-INF/jsp/editUser.jsp. In this JSP I have the
following STRUT tag:

 

html:select property=startPage styleClass=clear-select-menus

html:options name=startPageValues labelName=startPageLabels
/

/html:select

 

The form submits to the STRUTS controller and is configured to use an Action
called ProcessEditUserAction. This all works perfectly and without a hitch.

 

If I program the FormBean that these series of pages are using to validate
the user submitted code - when there is an error, the FormBean is being sent
to the /WEB-INF/jsp/editUser.jsp page without the name/value array pairs
being generated. This then causes some problems. How do I architecturally
handle this? My struts-config.xml file is pointing to
/WEB-INF/jsp/editUser.jsp as the input mapping. Should that be different?
If I do the validation in the FormBean, it seems like I can't get flow of
control back to an Action? Am I missing something?

 

Thanks!!!

 

Joe Krause



Using Sturts-HTML tags in Template

2003-08-01 Thread Joe Krause
I am trying to place the bulk of my navigation and HTML header code into a
header.jsp file. Each JSP view page then includes a header.jsp and a
footer.jsp file using the following:

 

%@ include file = /templates/header.jsp %

 

// Page specific implementation

 

%@ include file = /templates/footer.jsp %

 

This works great. But when I added the %@ taglib
uri=/WEB-INF/struts-html.tld prefix=html % taglib directive and made
html become html:html in the header.jsp file and /html become
/html:html in the footer file, I get the following error:

 

org.apache.jasper.JasperException:
/WEB-INF/jsp/admin/employee/list.jsp(16,0) /templates/header.jsp(39,0)
Unterminated  tag

 

 

Is there a way to have the html:html and the /html:html tags be in
different physical .jsp files? I thought that by using the PAGE DIRECTIVE
INCLUDE versus the TAGLIB INCLUDE I would be assured that the pages would be
included at compile time and thus work.

 

Please advise!

 

Joe



Prepopulating Forms

2003-08-01 Thread Joe Krause
I need to pre-populate an HTML form with values from a database. I have an
action that sets up the form and a different action that processes the form.
On the actual JSP page itself, if I set the action of the html:fom element
to the processor action (which is what I need to do), then the form is not
pre-populated with the dorm data from the actionForm. However, if I switch
the html:form element to point to the setup page, then it works right
(however, then it can't process the form). I know this is just some simple
configuration proplem. Can somebody please show me the right way to do this?

Here's my code and configuration:

STRUTS-CONFIG.XML

action path=/employee/edit 
type=com.multivision.actions.admin.employee.EditAction 
name=EmployeeForm 
validate=false

forward name=success 
 path=/WEB-INF/jsp/admin/employee/edit.jsp 
 redirect=false /
/action

action path=/employee/editProcess 
type=com.multivision.actions.admin.employee.EditProcessAction 
name=EmployeeForm 
input=/employee/edit.do 
scope=request

forward name=success 
 path=/employee/list.do 
 redirect=false /
/action





EDIT.JSP (no prepoluate, but form submits to processor action)

html:form action=/employee/editProcess


EDIT.JSP (Prepopulates, but form does not submit to processor action)

html:form action=/employee/edit




Thanks!

Joe


How to make dynamic SELECT elements?

2003-07-31 Thread Joe Krause
Can anyone please give me an example of a JSP page and the appropriate
ActionForm object that would prepopulate the form on the JSP page
specifically creating an HTML drop down Select menu using the Struts'
HTML:SELECT tag? Or just send me a link to a tutorial that has it - I
can't seem to find it in the Documentation anywhere.

 

Thanks!

 

Joe Krause



RE: How to make dynamic SELECT elements?

2003-07-31 Thread Joe Krause
Hey Hey - thanks a lot. This helps. 

Your shameless plug is fine as long as you wrap it in a shameless-plug
element like you have.

Cheers

Joe

-Original Message-
From: Steve Raeburn [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 31, 2003 3:55 PM
To: Struts Users Mailing List
Subject: RE: How to make dynamic SELECT elements?

shameless-plug
  You can download an application containing Struts examples, 
  including populating select options, from
   http://www.ninsky.com/struts 
/shameless-plug

Steve

 -Original Message-
 From: Joe Krause [mailto:[EMAIL PROTECTED]
 Sent: July 31, 2003 3:32 PM
 To: '[EMAIL PROTECTED]'
 Subject: How to make dynamic SELECT elements?
 
 
 Can anyone please give me an example of a JSP page and the appropriate
 ActionForm object that would prepopulate the form on the JSP page
 specifically creating an HTML drop down Select menu using the Struts'
 HTML:SELECT tag? Or just send me a link to a tutorial that has it - I
 can't seem to find it in the Documentation anywhere.
 
  
 
 Thanks!
 
  
 
 Joe Krause
 
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]