Validation and errormessage?

2003-09-24 Thread Terje Hopsø
Hello,
 
In my validation.xml I have the folowing:
 
   form name=nySkytterForm
 field property=epost
   depends=required,email
arg0 key=nySkytterForm.epost/
 /field
   /form

This works fine and the value from the nySkytterForm.epost is found in the
resources file. But I would like to have the value of the fields in my
errormessage as well, is that possible? And if it is, how?
 
- Terje

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

Variable assigning?

2003-08-20 Thread Terje Hopsø
Hello,
 
I have a logic:iterate loop listing out a lists of name++. For each line
the name is written but I want to write it only when I get a different name
than previous line. I want to do it like this:
 
c:set prevName =  scope=request value=/
logic:iterate id=person name=personlist type=Person
??Compare prevName to name 
bean:write name=id property=name/
?? somehow update prevName 
/logic:iterate
 
I have tried but could not figure out how to do it.
Is this possible?
 
- Terje
 
 


RE: html:select multiple and validationForm?

2003-08-15 Thread Terje Hopsø
Thanks!!

Now it works! Three days of trying and crying is over.

Where can I find this bug list?

- Terje


-Original Message-
From: Jacek Zoch [mailto:[EMAIL PROTECTED] 
Sent: 15. august 2003 10:46
To: Struts Users Mailing List
Subject: Re: html:select multiple and validationForm?



- Original Message - 
From: Terje Hopsø [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Friday, August 15, 2003 12:32 AM
Subject: RE: html:select multiple and validationForm?


I have both and only the one I mentioned is called.

- Terje

You can`t have both! Just one - with String[] or String as its argument. If
you have two setters only thsi with
String argument. This is a bug in struts ( or a feature - as you wish ).

Jacek



-
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]

html:select multiple and validationForm?

2003-08-14 Thread Terje Hopsø
Hello,
 
I have a html:select.. where I show a listbox where I can select multiple
records. But I only get the first selected entry into my validationForm. The
setNavn(String navn) is the one that is executed when submitting my form.
 
What is wrong?
 
- Terje
 
JSP-CODE:
html:form action=/struts/rapporterAction.do

html:select name=skyttere property='navn' size=30 multiple='true'
html:options collection='skyttere' property='initialer'
labelProperty='navn' /
/html:select

 
GENERATED CODE:
form name=rapporterForm method=post
action=/drwv/struts/rapporterAction.do
...
select name=navn multiple=multiple size=30
option value=AKSAKS/option
option value=AMKAMK/option
option value=BRBR/option
option value=GKGK/option
/select
 
VALIDATIONFORM-CODE:
 public void setNavn(String navn) {
  System.out.println(Yes, I have been called);
 }



RE: html:select multiple and validationForm?

2003-08-14 Thread Terje Hopsø
I have both and only the one I mentioned is called.

- Terje


-Original Message-
From: Jacek Zoch [mailto:[EMAIL PROTECTED] 
Sent: 15. august 2003 00:17
To: Struts Users Mailing List
Subject: Re: html:select multiple and validationForm?



- Original Message - 
From: Terje Hopsø [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Thursday, August 14, 2003 11:48 PM
Subject: html:select multiple and validationForm?


Hello,

I have a html:select.. where I show a listbox where I can select multiple
records. But I only get the first selected entry into my validationForm. The
setNavn(String navn) is the one that is executed when submitting my form.

What is wrong?
VALIDATIONFORM-CODE:
 public void setNavn(String navn) {
  System.out.println(Yes, I have been called);
 }

Try :

 public void setNavn(String[] navn) {
  System.out.println(Yes, I have been called);
 }

Jacek


-
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]



Multiselect listbox(html:select) and validationFrom

2003-08-14 Thread Terje Hopsø
Hello,
 
I have a problem with how to get values from a multiselect list into a
validationForm. I have a class:
 
public class Skytter extends ArrayList {
  private String navn;
  private String initialer;

}
 
I build up an array with the class:
 
Skytter skyttere = new Skytter();
In a loop
Skytter skytter = new Skytter();
setting values to skytter
skyttere.add(skytter);
 
And then
 ...setAttribute(skyttere, skyttere).
 
In my jsp-page I show this in a listbox where I can select multiple
elements.
 
td valign=top
html:select name='skyttere' property='navn' multiple='true' size=30
html:options collection='skyttere' property='initialer'
labelProperty='navn' /
/html:select
/td
 
How can I get the selected values into the validationform? Do I need to get
the address-string and loop thru all elements to extract each element
myself?
 
The address string sent: ./rapporterAction.do?navn=HK++
http://ppcterje/drwv/struts/rapporterAction.do?navn=HK++navn=IH++navn=JOS
+navn=KBS+navn=MA++navn=PH++navn=RO++navn=RK
navn=IH++navn=JOS+navn=KBS+navn=MA++navn=PH++navn=RO++navn=RK++..
..
 
- Terje
 

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

Resetting inputparameters to a jsp-page?

2003-07-21 Thread Terje Hopsø
Hi,
 
Is there an easy way to reset inputparameters? 
 
I use them like this
 
input name=dato type=text class=small id=dato size=5
maxlength=5 value=c:out value='${param.dato}' /
 
The problem is that a reset-button will not reset the fields when using
jstl. I have a feeling this is not possible but I just want to ask.
 
- Terje
 


RE: trigger an action from a filter?

2003-07-16 Thread Terje Hopsø
I missed some of the understanding of how Struts works. I had a link (not in
a form) to a page where I wanted to get a resultset from my database first.
I had the logic in an actionServlet. The link activated the filter but not
the actionServlet. If I used a form with submit the actionServlet got
activated but not the filter. That's why I wanted to get the filter to
activate the actionservlet.

I have changed this now and move the logic into the filter an removed the
form/submit button and don't need a actionServlet for this link.

I am a novice to Struts at the moment and I am reading, trying and reading
the books again. 

- Terje



Not sure if this is what Terje is after, but you can use a link instead of a
form:

html:link action=/action/path.../html:link

http://jakarta.apache.org/struts/userGuide/struts-html.html#link

As Max asked though, it would help to have some more detail on what the
requirements are.

Quoting Max Cooper [EMAIL PROTECTED]:

 You could send a redirect or forward the current request to the Struts
 action (mapping) from a Filter or Servlet.
 
 What has lead you to want to do this? Perhaps a simpler solution to your
 functional needs is possible.
 
 -Max
 
 - Original Message - 
 From: Terje Hopsø [EMAIL PROTECTED]
 To: Struts Users Mailing List [EMAIL PROTECTED]
 Sent: Tuesday, July 15, 2003 1:47 AM
 Subject: trigger an action from a filter?
 
 
  Hello,
 
  How can I call my actionservlet without using a FORM/SUBMIT? Can I
 trigger
  it from a Filter-servlet and in that case how?
 
  - Terje


-Original Message-
From: Terje Hopsø [mailto:[EMAIL PROTECTED] 
Sent: 15. juli 2003 10:47
To: Struts Users Mailing List
Subject: trigger an action from a filter?


Hello,
 
How can I call my actionservlet without using a FORM/SUBMIT? Can I trigger
it from a Filter-servlet and in that case how?
 
- Terje
 

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

trigger an action from a filter?

2003-07-15 Thread Terje Hopsø
Hello,
 
How can I call my actionservlet without using a FORM/SUBMIT? Can I trigger
it from a Filter-servlet and in that case how?
 
- Terje
 


quote or apostrophe in c:out ...?

2003-07-14 Thread Terje Hopsø
Hello,
 
I looked at a file with tables in Dreamweaver. It was messy an difficult to
read because it was confised by referencing pages like this:
 ..href=c:out value=/report.jsp /
 
I then changed it to look like this with apostrphe instead of quotes:
..href=c:out value='/report.jsp' /
 
Dreamweaver showed the pages correctly now but will this have any impact
elsewhere. Could Tomcat or other webservers fail writing the code like this?
 
- Terje
 


Accessing database in java and jsp?

2003-07-08 Thread Terje Hopsø
Hello
 
I have created a datasource in my struts-config.xml. But I cant find out how
to use it. Creating my datasource in my web.xml works fine. Any tips?
 
- Terje
 
struts-config.xml:
...
 data-sources
  data-source
   set-property value=true property=autoCommit /
   set-property value=My database property=description /
   set-property value=com.sybase.jdbc2.jdbc.SybDriver
property=driverClass /
   set-property value=10 property=maxCount /
   set-property value=2 property=minCount /
   set-property value= property=user /
   set-property value=x property=password /
   set-property value=jdbc:sybase:Tds:mycomputer:4000/mydatabase
property=url /
  /data-source
 /data-sources
...
 

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

RE: Accessing database in java and jsp?

2003-07-08 Thread Terje Hopsø
Hi,

As mentioned in the book Jakarta Struts from O'Reilly that some
configuration in web.xml has been moved to struts-config.xml I wanted to try
it out. I am testing out a lot of things in Struts since it is new to me and
this is something I am strugling with.

- Terje


-Original Message-
From: Micael [mailto:[EMAIL PROTECTED] 
Sent: 8. juli 2003 16:49
To: Struts Users Mailing List
Subject: Re: Accessing database in java and jsp? 


This is probably more of an additional question than a help, but why do you 
want to do something other than create the datasource in your web.xml?

At 01:31 PM 7/8/03 +0200, you wrote:
Hello

I have created a datasource in my struts-config.xml. But I cant find out
how
to use it. Creating my datasource in my web.xml works fine. Any tips?

- Terje

struts-config.xml:
...
  data-sources
   data-source
set-property value=true property=autoCommit /
set-property value=My database property=description /
set-property value=com.sybase.jdbc2.jdbc.SybDriver
property=driverClass /
set-property value=10 property=maxCount /
set-property value=2 property=minCount /
set-property value= property=user /
set-property value=x property=password /
set-property value=jdbc:sybase:Tds:mycomputer:4000/mydatabase
property=url /
   /data-source
  /data-sources
...


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



LEGAL NOTICE

This electronic mail  transmission and any accompanying documents contain 
information belonging to the sender which may be confidential and legally 
privileged.  This information is intended only for the use of the 
individual or entity to whom this electronic mail transmission was sent as 
indicated above. If you are not the intended recipient, any disclosure, 
copying, distribution, or action taken in reliance on the contents of the 
information contained in this transmission is strictly prohibited.  If you 
have received this transmission in error, please delete the message.  Thank 
you  



-
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]



RE: Accessing database in java and jsp?

2003-07-08 Thread Terje Hopsø
Hi,

That works fine, thanks!

Now my next test is to get it into the sql-taglib. I tried to use the
data-source key=resDB and use that but with no luck. I guess the
sql-taglib is looking at the web.xml. I only get datasource invalid: null
or no suitable driver.

sql:setDataSource var=ex scope=application dataSource=resDB
/
sql:query var=rader dataSource=${ex}
select Initialer
from Skytter
/sql:query

- Terje


-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Yann Cébron
Sent: 8. juli 2003 21:44
To: [EMAIL PROTECTED]
Subject: Re: Accessing database in java and jsp?


This might be a good start to read:

http://jakarta.apache.org/struts/faqs/database.html

HTH,
Yann

At 01:31 PM 7/8/03 +0200, you wrote:
Hello

I have created a datasource in my struts-config.xml. But I cant find out
how
to use it. Creating my datasource in my web.xml works fine. Any tips?

- Terje

struts-config.xml:
...
  data-sources
   data-source
set-property value=true property=autoCommit /
set-property value=My database property=description /
set-property value=com.sybase.jdbc2.jdbc.SybDriver
property=driverClass /
set-property value=10 property=maxCount /
set-property value=2 property=minCount /
set-property value= property=user /
set-property value=x property=password /
set-property value=jdbc:sybase:Tds:mycomputer:4000/mydatabase
property=url /
   /data-source
  /data-sources
...


-
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]



ActionForms and errors?

2003-07-06 Thread Terje Hopsø
Hello,
 
I am trying to figure out how ActionForm and validate()-function work. If I
returns an error (ActionErrors) from my ActionForm it fail (se below for
output). Returning null everything works fine. I thought that when returning
an error I would return to my loginpage automatically. But I dont. Anyone
who can explain to me hwo this works og give me a link with a fully
functioning example? I have looked at examples but they are for the most
parts of an example.
 
- Terje
 
Error when pressing submit in login.jsp
type Status report

message No input attribute for mapping path /struts/authenticate

description The server encountered an internal error (No input attribute for
mapping path /struts/authenticate) that prevented it from fulfilling this
request.

 
WEB.XML
?xml version=1.0 encoding=UTF-8?
!DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application
2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
 filter
  filter-nameaccessControl/filter-name
  filter-classcom.teho.servlets.AccessControlFilter/filter-class
  init-param
   param-nameloginPage/param-name
   param-value/login.jsp/param-value
  /init-param
 /filter
 filter-mapping
  filter-nameaccessControl/filter-name
  url-pattern/internal/*/url-pattern
 /filter-mapping
 servlet
  servlet-nameaction/servlet-name
  servlet-classorg.apache.struts.action.ActionServlet/servlet-class
  init-param
   param-nameapplication/param-name
   param-valuecom.teho.servlets.ApplicationResources/param-value
  /init-param
 /servlet
 servlet-mapping
  servlet-nameaction/servlet-name
  url-pattern*.do/url-pattern
 /servlet-mapping
/web-app

STRUTS-CONFIG.XML:
?xml version=1.0 encoding=UTF-8?
!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
 form-beans
  form-bean name=loginForm type=com.teho.servlets.LoginForm /
 /form-beans
 action-mappings
  action name=loginForm type=com.teho.servlets.AuthenticateAction
path=/struts/authenticate /
 /action-mappings
/struts-config

login.jsp
...
form name=login method=post action=c:url
value=/struts/authenticate.do /
...