load data from db into form

2003-08-31 Thread Jiri Chaloupka
Hallo,
what is the correct way to load data from db into form?
I have some form:
html:form action=/FinishRegister method=post focus=registerFull
table border=0
  tr
tdbean:message key=register.name.Fullname /:/td
tdhtml:text property=fullname //td
  /tr
  tr
tdbean:message key=register.name.Mail /:/td
tdhtml:text property=mail //td
  /tr
etc...
,
action class as:
public class LoadDataAction extends Action {
  public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse response)
  throws Exception, DatabaseException
  {
  LoadDataService service = new LoadDataService();
  ComplRegisterDTO registerDTO = service.loadUser(request);
((DynaActionForm)form).set(registerFull, registerDTO);
return (mapping.findForward(success));
  }
}
Service class as:
public class LoadDataService {
  public ComplRegisterDTO loadUser(HttpServletRequest request) throws 
Exception
  {
  ComplRegisterDTO userDataDTO = new ComplRegisterDTO();
  HttpSession session = request.getSession();
  User u = (User) session.getAttribute(user);
  userDataDTO.setId(u.getUserId());
  userDataDTO.setFullname(u.getFullname());
...
 return userDataDTO;
}

and struts-config file:
   action
  path=/Register2
  type=cz.chalu.struts.modules.completeregister.LoadDataAction
  parameter=.main.registerFinish/
But there is some mistake.
What is the correct way to do it?
Thanks, Jiri

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


Re: load data from db into form

2003-08-31 Thread Jiri Chaloupka
Yes, nested tags, I must look at ...
so now I have it without nested, form definition is now without it.
but still I got

java.lang.IllegalArgumentException: No destination bean specified
at org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:220)
at 
cz.chalu.struts.modules.completeregister.LoadDataAction.execute(LoadDataAction.java:32)
What is missing? I my action class (execute method) I have:

public ActionForward execute(...){
LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return null;
}
If I understand well, in BeanUtils.copyProperties I copy data from DTO 
into form defined in execute method?
Or something other is wrong?

Thanks

Mark Lowe wrote:

Okay assuming the following..

form-bean name=registerFull 
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=id type=java.lang.Integer /
   form-property name=fullname type=java.lang.String /
form-property name=notify type=java.lang.Integer /
/form-bean

..

html:text property=fullname /
html:text property=id /
html:text property=notify /
or if you are nesting you bean which in that case i wouldn't (too short).

form-property name=mybean 
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO

Then assuming that fullname, id, and notify are all properties of 
ComplRegisterDTO.

html:text property=mybean.fullname /
html:text property=mybean.id /
html:text property=mybean.notify /
Cheers Mark





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


Re: Handling Exceptions

2003-08-31 Thread Yann Cébron
 However, when a
 ServletException occurs, it does not go to the path defined in
 struts-config.xml. Somehow, the error is still showing in the
 application page and not in any one of the error pages defined.

My guess is, the ServletException is happening someplace where Struts'
ExceptionHandler can't get hold of it, e.g. on your JSP page. Have a look at
your servlet container's logfiles to see exactly where they appear.

You can still define an error-page in your *web.xml* to catch those and
redirect them to your own error-page.

HTH,
Yann




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



Re: dinamically add href into html:link

2003-08-31 Thread Jiri Chaloupka
Thanks, I used html-el and it works.
what is the better to use, use c:url or html-el:link? Or it is 
equivalent here?

And one more queestion:
I have object with application persistency (over all sessions), and for 
session I call some method to set some parameter and get another object 
(array list) and maybe store it in session.

Now I do:
jsp:useBean id=a class=cz.chalu.modules.blabla.Class 
scope=application /
and, now provisory, this as scriptlet:
%
a.setRequest(request);
User user = (User)session.getAttribute(user);
if(user != null){
   a.setUser(user);
}
getServletContext().setAttribute(b, a.getSomething().toArray());
%
next, I call some c:forEach ... cykle for b object.

How I can do it correctly in struts / jstl?

Thanks, Jiri

Mark Lowe wrote:

The ideal way would be something like this.

c:url url=${menuItem.link}
c:out var=${menuItem.name}/
/c:url
Cheers Mark

On Sunday, August 31, 2003, at 04:27 PM, Yann Cébron wrote:

how I can do something as this:

html:link action=${menuItem.link} c:out 
value=${menuItem.name}  /
?


Use the EL-tags (look in the contrib/struts-el directory of the 
Struts 1.1
distribution), e.g.

html-el:link action=${menuItem.link} .. .. /html-el:link

HTH,
Yann


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


Re: dinamically add href into html:link

2003-08-31 Thread Mark Lowe
opps...

c:url value=${menuItem.link}
c:out value=${menuItem.name} /
/c:url
is better

On Sunday, August 31, 2003, at 05:02 PM, Mark Lowe wrote:

The ideal way would be something like this.

c:url url=${menuItem.link}
c:out var=${menuItem.name}/
/c:url
Cheers Mark

On Sunday, August 31, 2003, at 04:27 PM, Yann Cébron wrote:

how I can do something as this:

html:link action=${menuItem.link} c:out 
value=${menuItem.name}  /
?
Use the EL-tags (look in the contrib/struts-el directory of the 
Struts 1.1
distribution), e.g.

html-el:link action=${menuItem.link} .. .. /html-el:link

HTH,
Yann


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


page field on DynaValidatorForm class

2003-08-31 Thread Erez Efrati
Hi,

Do I need to include the declaration of a 
form-property name=page ... in a form of type DynaValidatorForm in
the struts-config.xml?

Thanks in advance,
Erez



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



Re: load data from db into form

2003-08-31 Thread Mark Lowe
Your from bean definition is the most useful thing you can provide to 
answer this..

if in your formBean definition or in the actionForm class you've got 
type

form-property name=myprop type=com.whatever.ComplRegisterDTO /

Then you're on the right lines.. But you're nesting so you jsp needs to 
be more like

ComplRegisterDTO myObj = whatever...

theForm.set(myprop,myObj);

.. or if you dig beanutils

BeanUtils.copyProperties(theForm, myObj) ; //a bit silly in the this 
case,

html:text property=myprop.fullname /

..Other wise if you've got (recommended).

form-property name=fullname type=java.lang.String /
form-property name=mail type=java.lang.String /
DynaACtionForm theForm = (DynaActionForm) form;

theForm.set(fullname,Joe Bloggs);
theForm.set(mail,[EMAIL PROTECTED]);
Does this help?

Cheers MArk



On Sunday, August 31, 2003, at 07:55 AM, Jiri Chaloupka wrote:

Hallo,
what is the correct way to load data from db into form?
I have some form:
html:form action=/FinishRegister method=post focus=registerFull
table border=0
  tr
tdbean:message key=register.name.Fullname /:/td
tdhtml:text property=fullname //td
  /tr
  tr
tdbean:message key=register.name.Mail /:/td
tdhtml:text property=mail //td
  /tr
etc...
,
action class as:
public class LoadDataAction extends Action {
  public ActionForward execute(ActionMapping mapping,
   ActionForm form,
   HttpServletRequest request,
   HttpServletResponse 
response)
  throws Exception, DatabaseException
  {

  LoadDataService service = new LoadDataService();
  ComplRegisterDTO registerDTO = service.loadUser(request);
((DynaActionForm)form).set(registerFull, registerDTO);
return (mapping.findForward(success));
  }
}
Service class as:
public class LoadDataService {
  public ComplRegisterDTO loadUser(HttpServletRequest request) throws 
Exception
  {
  ComplRegisterDTO userDataDTO = new ComplRegisterDTO();
  HttpSession session = request.getSession();
  User u = (User) session.getAttribute(user);
  userDataDTO.setId(u.getUserId());
  userDataDTO.setFullname(u.getFullname());
...
 return userDataDTO;
}

and struts-config file:
   action
  path=/Register2
  
type=cz.chalu.struts.modules.completeregister.LoadDataAction
  parameter=.main.registerFinish/

But there is some mistake.
What is the correct way to do it?
Thanks, Jiri

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


struts / tiles forward problems

2003-08-31 Thread Johannes Plachy
Hi,

I am new to struts  tiles and have several questions/problems That I am
currently dealing with:

1) although a page ( say tiles.page ) is defined in my tiles-def.xml and
referenced 
in my struts-config.xml like

forward name=struts.page path=tiles.page / and
action path=/struts.page forward=tiles.page / 

a link from a jsp page html:link forward=struts.page... resolves to
a link to 'tiles.page' ( textual!) 
without resolving the tiles definition ? 

2) is it generally possible to nest ( not to extend) tile definitions ?

3) is there a simple solution for using the struts forward mechanism
programmatically ?
   I'd like to have either an action or a tag which I could call in a
jsp with something like:

mapping.findForward(request.getParameter(struts.page));


regards
Johannes




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



Re: load data from db into form

2003-08-31 Thread Jiri Chaloupka
Thanks Mark
I do not know if I understnad well.
No I have in struts config:
form-bean name=registerFull 
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=prop 
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO /
 form-property name=id type=java.lang.Integer /
   form-property name=fullname type=java.lang.String /
form-property name=notify type=java.lang.Integer /
...

, action definition:
action
   path=/Register2
   type=cz.chalu.struts.modules.completeregister.LoadDataAction
   parameter=.main.registerFinish/  

, LoadDataAction is:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
   throws Exception, DatabaseException
   {
   LoadDataService service = new LoadDataService();
   ComplRegisterDTO registerDTO = service.loadUser(request);
   BeanUtils.copyProperties(form, registerDTO);
  
   return (mapping.findForward(success));
   }

and form:
   html:form action=/FinishRegister method=post focus=registerFull
 table border=0
   tr
 tdbean:message key=register.name.Fullname /:/td
 tdhtml:text property=fullname //td
   /tr
   tr
 tdbean:message key=register.name.Mail /:/td
 tdhtml:text property=mail //td
   /tr
   tr
 tdbean:message key=register.name.MailNotification /:/td
 td valign=top
   html:radio property=notify value=1 bean:message 
key=register.name.MailNotifYes //html:radio
   html:radio property=notify value=0 bean:message 
key=register.name.MailNotifNo //html:radio
 /td
   /tr
...

and i got exception

ServletException: No destination bean specified

what is wrong?

Mark Lowe wrote:

Your from bean definition is the most useful thing you can provide to 
answer this..

if in your formBean definition or in the actionForm class you've got type

form-property name=myprop type=com.whatever.ComplRegisterDTO /

Then you're on the right lines.. But you're nesting so you jsp needs 
to be more like

ComplRegisterDTO myObj = whatever...

theForm.set(myprop,myObj);

.. or if you dig beanutils

BeanUtils.copyProperties(theForm, myObj) ; //a bit silly in the this 
case,

html:text property=myprop.fullname /

..Other wise if you've got (recommended).

form-property name=fullname type=java.lang.String /
form-property name=mail type=java.lang.String /
DynaACtionForm theForm = (DynaActionForm) form;

theForm.set(fullname,Joe Bloggs);
theForm.set(mail,[EMAIL PROTECTED]);
Does this help?

Cheers MArk




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


Re: load data from db into form

2003-08-31 Thread Mark Lowe
Okay assuming the following..

form-bean name=registerFull 
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=id type=java.lang.Integer /
   form-property name=fullname type=java.lang.String /
form-property name=notify type=java.lang.Integer /
/form-bean

..

html:text property=fullname /
html:text property=id /
html:text property=notify /
or if you are nesting you bean which in that case i wouldn't (too 
short).

form-property name=mybean 
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO

Then assuming that fullname, id, and notify are all properties of 
ComplRegisterDTO.

html:text property=mybean.fullname /
html:text property=mybean.id /
html:text property=mybean.notify /
Cheers Mark



On Sunday, August 31, 2003, at 03:00 PM, Jiri Chaloupka wrote:

Thanks Mark
I do not know if I understnad well.
No I have in struts config:
form-bean name=registerFull 
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=prop 
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO /
 form-property name=id type=java.lang.Integer /
   form-property name=fullname type=java.lang.String /
form-property name=notify type=java.lang.Integer /
...

, action definition:
action
   path=/Register2
   
type=cz.chalu.struts.modules.completeregister.LoadDataAction
   parameter=.main.registerFinish/
, LoadDataAction is:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse 
response)
   throws Exception, DatabaseException
   {

   LoadDataService service = new LoadDataService();
   ComplRegisterDTO registerDTO = service.loadUser(request);
   BeanUtils.copyProperties(form, registerDTO);
 return (mapping.findForward(success));
   }
and form:
   html:form action=/FinishRegister method=post 
focus=registerFull
 table border=0
   tr
 tdbean:message key=register.name.Fullname /:/td
 tdhtml:text property=fullname //td
   /tr
   tr
 tdbean:message key=register.name.Mail /:/td
 tdhtml:text property=mail //td
   /tr
   tr
 tdbean:message key=register.name.MailNotification 
/:/td
 td valign=top
   html:radio property=notify value=1 bean:message 
key=register.name.MailNotifYes //html:radio
   html:radio property=notify value=0 bean:message 
key=register.name.MailNotifNo //html:radio
 /td
   /tr
...

and i got exception

ServletException: No destination bean specified

what is wrong?

Mark Lowe wrote:

Your from bean definition is the most useful thing you can provide to 
answer this..

if in your formBean definition or in the actionForm class you've got 
type

form-property name=myprop type=com.whatever.ComplRegisterDTO /

Then you're on the right lines.. But you're nesting so you jsp needs 
to be more like

ComplRegisterDTO myObj = whatever...

theForm.set(myprop,myObj);

.. or if you dig beanutils

BeanUtils.copyProperties(theForm, myObj) ; //a bit silly in the this 
case,

html:text property=myprop.fullname /

..Other wise if you've got (recommended).

form-property name=fullname type=java.lang.String /
form-property name=mail type=java.lang.String /
DynaACtionForm theForm = (DynaActionForm) form;

theForm.set(fullname,Joe Bloggs);
theForm.set(mail,[EMAIL PROTECTED]);
Does this help?

Cheers MArk




-
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: getting at public static class constant field values in EL script

2003-08-31 Thread Adam Hardy
On 08/30/2003 06:42 PM James Mitchell wrote:
You can take advantage of the Unstandard tags.

This doesn't directly answer your question, but I'm sure you are smart
enough to derive your answer from the following archived post on
taglib-users from July:
Unsure if JSTL 1.1 will allow this, but using the Unstandard taglib you
can do:
un:bind var=bob type=your.package.Const field=JVP_LEVEL/
c:if test=$myScopedVar == $bob
..
/c:if


Hi James, David, Mike, everyone,

thanks for the input. For some reason yesterday I wasn't fully on the 
ball, but today your suggestions gave me a better idea - I can do it 
without using the extra tag library, so:

c:set var=bob%=org.apache.struts.Globals.ERROR_KEY %/c:set
c:if test=${requestScope[bob] != null}
  Oh look! Errors!
/c:if
Also, thanks for shaming me into using the Taglibs user list. I shall 
from now on. Just posting this here to finish the thread. I already 
subscribe to this list, tomcat-user, ant-user, emacs, linux, and 
occasionally mozilla browser and mozilla mail, xml, jdbc, mysql when 
necessary (oh and Van Morrison) so it gets to a point sometimes where I 
just don't recognise names anymore and it loses something in the 
transition. I guess it's one of the drawbacks of working on my own and 
doing it all myself, not being able to specialize :(

By the way I do have the JSTL spec and I have read it - the problem with 
specs is that they tell you what they can do, but don't tell you what 
they can't do, or what the downside is.

Adam

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


Re: dinamically add href into html:link

2003-08-31 Thread Mark Lowe
The ideal way would be something like this.

c:url url=${menuItem.link}
c:out var=${menuItem.name}/
/c:url
Cheers Mark

On Sunday, August 31, 2003, at 04:27 PM, Yann Cébron wrote:

how I can do something as this:

html:link action=${menuItem.link} c:out value=${menuItem.name} 
 /
?
Use the EL-tags (look in the contrib/struts-el directory of the Struts 
1.1
distribution), e.g.

html-el:link action=${menuItem.link} .. .. /html-el:link

HTH,
Yann


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


dinamically add href into html:link

2003-08-31 Thread Jiri Chaloupka
Hallo,
how I can do something as this:
html:link action=${menuItem.link} c:out value=${menuItem.name}  /
?
I tried page (in manual I read that it canbe created dynamicaly, but it 
does not), action, href...

it is still generated as

a href=/apl/${menuItem.doHome/a
instead of 
/apl/Index.do

I know I can do
a href=c:out value=${menuItem.link}
but it does not add application prefix :(
Thanks,
Jiri
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [OT] jstl forEach problem

2003-08-31 Thread Johan
Solved.
I added instead of a workDocument the collection workDocuments to my 
Arraylist. Just a typo

Johan

Johan wrote:
Hi,
I have a JSTL question and the answers in the archives don't solve the 
problem. So maybe one of you run into the problem ones

I have an ArrayList containing Objects.
c:forEach var=document 
items=${sessionScope.user.session.workDocuments}
c:out value=${document.carBrand.name} /
/c:forEach

This gives me the following error

[ServletException in:/pages/sessie.jsp] An error occurred while 
evaluating custom action attribute value with value 
${document.carBrand.name}: The . operator was supplied with an index 
value of type java.lang.String to be applied to a List or array, but 
that value cannot be converted to an integer. (null)'

In an other page with different objects in a ArrayList it works perfect.
When I run
c:forEach var=document 
items=${sessionScope.user.session.workDocuments}
c:out value=${document} /
/c:forEach

I get as output

[(this Collection)]

even when document isn't a List or array.

Has anyone of you a pointer where to search for an answer to this problem

Thanks

Johan



--
Nilling Software Design
Postbus 43
2280 AA  Rijswijk ZH
w: http://www.nilling.nl
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


best practices for ActionForm flow control

2003-08-31 Thread Seyhan BASMACI (Internet Yazilimlari Yetkilisi)
When the actionForm validate method returns errors,
struts direct the control to the jsp page specified in the input parameter of form 
mapping.
is it possible to direct control to the action class in case of error inside the 
actionForm validate method without making extra coding effort,
or playing with some configurations ?

I can solve this issue returning null inside form validate method in the case of 
error, binding erors to the request  (or  to the ActionForm) then check inside 
action execute method when request (actionForm) contains errors . is there any better 
way to control the flow ? 

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



Re: dinamically add href into html:link

2003-08-31 Thread Vic Cekvenich
Are you able to use JSTL?
I use JSTL for that.
Jiri Chaloupka wrote:
Hallo,
how I can do something as this:
html:link action=${menuItem.link} c:out value=${menuItem.name}  /
?
I tried page (in manual I read that it canbe created dynamicaly, but it 
does not), action, href...

it is still generated as

a href=/apl/${menuItem.doHome/a
instead of /apl/Index.do
I know I can do
a href=c:out value=${menuItem.link}
but it does not add application prefix :(
Thanks,
Jiri
--
Vic Cekvenich,
Struts Instructor,
1-800-917-JAVA
Advanced a href =baseBeans.comStruts Training/a, mentoring and 
project recovery in North East.
Struts conversion and a href =baseBeans.com fixed bid development/a.



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


Handling Exceptions

2003-08-31 Thread Mohd Amin Mohd Din
Hi,
 
In struts-config, I have defined few global-exceptions such as these
 
  exception type=com.enc.edu.pg.bo.common.DataAccessException
 key=exception.common.dataaccessexception
 path=/action/main/dataAccessExceptionSetup
 scope=session
  /exception
  exception type=java.lang.Exception
 key=exception.common.exception
 path=/action/main/errorSetup
 scope=session
  /exception 
  exception type=javax.servlet.ServletException
 key=exception.common.servletexception
 path=/action/main/errorSetup
 scope=session
  /exception 
 
I also have created an error page, error.jsp with %@ page
isErrorPage=true % and at the top of the jsp template for all the
pages a %@ page errorPage=error.jsp %. However, when a
ServletException occurs, it does not go to the path defined in
struts-config.xml. Somehow, the error is still showing in the
application page and not in any one of the error pages defined.
 
Thanks
Amin 
 
 


Re: dinamically add href into html:link

2003-08-31 Thread Yann Cébron
 how I can do something as this:

 html:link action=${menuItem.link} c:out value=${menuItem.name}  /
 ?

Use the EL-tags (look in the contrib/struts-el directory of the Struts 1.1
distribution), e.g.

html-el:link action=${menuItem.link} .. .. /html-el:link

HTH,
Yann




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



Re: [OT] sslext java.lang.IllegalStateException: sendError() failed- data has already been sent to client

2003-08-31 Thread Adam Hardy
Hi Robert
you seem to be fairly confident of the circumstances so I would suggest, 
barring any other response on this list (I'm sorry but I don't know 
enough to help any further), that you log this in bugzilla and / or post 
it to the struts-dev list.

Good luck,
Adam
On 08/30/2003 07:03 PM Robert Taylor wrote:
Adam, thanks for the reply but upgrading won't help in this case.
I've already looked at the source for the full 1.1 release and this
issue is not addressed.
Also, I'm not using Tomcat, I'm using ServletExec4.2 with the latest patch.
The servlet container has nothing to do with this problem.
It is fairly evident that the problem is that the response is being written
to after it has been committed. I've suggested a workaround and might
implement it.
I just wanted to know if this issue has been addressed.

I don't necessarily think it is the responsibility of the RequestProcessor
to check to see if the response has already been committed before writing to
it,
but as more and more plugin's are added (TilesRequestProcessor,
SecureRequestProcessor, etc...)
it may become necessary to check for this condition.
If I'm missing something obvious, please let me know.

robert




-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: Saturday, August 30, 2003 9:45 AM
To: Struts Users Mailing List
Subject: Re: [OT] sslext java.lang.IllegalStateException: sendError()
failed - data has already been sent to client
It might sound like Microsoft Support Hotline, but you should upgrade to
the full 1.1 release. Plus of interest would be the tomcat version.
On 08/29/2003 11:22 PM Robert Taylor wrote:

I'm using Struts1.1rc2 with sslext for Struts1.1rc2 and am seeing some
peculiar behavior
when an invalid path is requested.
What should happen is the RequestProcessor.processMapping()
should recognize

that
there is no action mapping for the path, log a message, and send an 400
(Invalid Request) response
directly back to the client.
That's what is happening here.
10156: Aug 29, 2003 4:53:36 PM org.apache.struts.action.RequestProcessor
processMapping
SEVERE: Invalid path /something was requested
But what happens is that SecureRequestProcess.preProcess() invokes
RequestProcessor.processMapping()
which logs the above error message, then returns null.
SecureRequestProcessor then returns true because
no mapping was found. Then RequestProcessor invokes its own
processMapping()

which is when the
IllegalStateException is thrown because the response has already been
committed.
10156: Aug 29, 2003 4:53:36 PM org.apache.struts.action.RequestProcessor
processMapping
SEVERE: Invalid path /something was requested
10156: ServletExec: caught exception - java.lang.IllegalStateException:
sendError() failed - data has already
been sent to client
10156: java.lang.IllegalStateException: sendError() failed - data has
already been sent to client
10156:  at
com.newatlanta.servletexec.Response.sendError(Response.java:670)

10156:  at

org.apache.struts.action.RequestProcessor.processMapping(RequestPr
ocessor.ja
va:679)
10156:  at
org.apache.struts.action.RequestProcessor.process(RequestProcessor
.java:242)
10156:  at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1421)
10156:  at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:500)
10156:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
10156:  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
10156:  at
com.newatlanta.servletexec.ServletExec.CallServletService(ServletE
xec.java:1
679)
10156:  at
com.newatlanta.servletexec.SERequestDispatcher.forwardServlet(SERe
questDispa
tcher.java:280)
10156:  at
com.newatlanta.servletexec.SERequestDispatcher.forward(SERequestDi
spatcher.j
ava:191)
10156:  at
com.newatlanta.servletexec.ApplicationInfo.processApplRequest(Appl
icationInf
o.java:1447)
10156:  at
com.newatlanta.servletexec.ServerHostInfo.processApplRequest(Serve
rHostInfo.
java:1242)
10156:  at
com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.
java:1235)
10156:  at

com.newatlanta.servletexec.ServletExec.ProcessRequest(ServletExec.
java:1113)
I'm assuming that this exception is trapped, because I get the
expected page

back in the browser.
Should I be worried about this? One possible work around would
be to check

to see if the
response has already been commited before attempting to write
to it. I'm not

sure how that would
impact the rest of the logic in the RequestProcessor.
robert

PS. I've created a test web app which duplicates the behavior described
above. If I remove
controller
processorClass=org.apache.struts.action.SecureRequestProcessor/ from
struts-config.xml
then I don't see the exception stack trace.
BTW: Below is a snippet of code from RequestProcessor where the
exception is

being thrown:

snip
// No mapping can be found to process this request
log.error(getInternal().getMessage(processInvalid, path));
response.sendError(HttpServletResponse.SC_BAD_REQUEST,   //
= Here


Re: load data from db into form

2003-08-31 Thread Adam Hardy
Hi guys,
could be many whys, but it looks like your form bean is null. have you 
configured your struts-config mapping correctly to reference this form?

You should also cast the form bean into the type of form class you have 
specified, since it is passed into the action as the super class ActionForm.

Adam

On 08/31/2003 06:24 PM Jiri Chaloupka wrote:
Yes, nested tags, I must look at ...
so now I have it without nested, form definition is now without it.
but still I got

java.lang.IllegalArgumentException: No destination bean specified
at 
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:220)
at 
cz.chalu.struts.modules.completeregister.LoadDataAction.execute(LoadDataAction.java:32) 

What is missing? I my action class (execute method) I have:

public ActionForward execute(...){
LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return null;
}
If I understand well, in BeanUtils.copyProperties I copy data from DTO 
into form defined in execute method?
Or something other is wrong?

Thanks

Mark Lowe wrote:

Okay assuming the following..

form-bean name=registerFull 
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=id type=java.lang.Integer /
   form-property name=fullname type=java.lang.String /
form-property name=notify type=java.lang.Integer /
/form-bean

..

html:text property=fullname /
html:text property=id /
html:text property=notify /
or if you are nesting you bean which in that case i wouldn't (too short).

form-property name=mybean 
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO

Then assuming that fullname, id, and notify are all properties of 
ComplRegisterDTO.

html:text property=mybean.fullname /
html:text property=mybean.id /
html:text property=mybean.notify /
Cheers Mark





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

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: dinamically add href into html:link

2003-08-31 Thread Carlos Sánchez
c:url is a standard tag from JSTL, so I think it's better to follow
standards
Maybe html:link will be deprecated in a near future.

 -Mensaje original-
 De: Jiri Chaloupka [mailto:[EMAIL PROTECTED] 
 Enviado el: domingo, 31 de agosto de 2003 18:36
 Para: Struts Users Mailing List
 Asunto: Re: dinamically add href into html:link
 
 
 Thanks, I used html-el and it works.
 what is the better to use, use c:url or html-el:link? Or it is 
 equivalent here?
 
 And one more queestion:
 I have object with application persistency (over all 
 sessions), and for 
 session I call some method to set some parameter and get 
 another object 
 (array list) and maybe store it in session.
 
 Now I do:
 jsp:useBean id=a class=cz.chalu.modules.blabla.Class 
 scope=application /
 and, now provisory, this as scriptlet:
 %
 a.setRequest(request);
 User user = (User)session.getAttribute(user);
 if(user != null){
 a.setUser(user);
 }
 getServletContext().setAttribute(b, 
 a.getSomething().toArray()); % next, I call some c:forEach 
 ... cykle for b object.
 
 How I can do it correctly in struts / jstl?
 
 Thanks, Jiri
 
 Mark Lowe wrote:
 
 
  The ideal way would be something like this.
 
  c:url url=${menuItem.link}
  c:out var=${menuItem.name}/
  /c:url
 
  Cheers Mark
 
  On Sunday, August 31, 2003, at 04:27 PM, Yann Cébron wrote:
 
  how I can do something as this:
 
  html:link action=${menuItem.link} c:out
  value=${menuItem.name}  /
  ?
 
 
  Use the EL-tags (look in the contrib/struts-el directory of the
  Struts 1.1
  distribution), e.g.
 
  html-el:link action=${menuItem.link} .. .. /html-el:link
 
  HTH,
  Yann
 
 
 
 
  
 -
  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]



Re: dinamically add href into html:link

2003-08-31 Thread Mark Lowe
If you've the choice use JSTL..  If you're using the expression 
language then use that. I like using the standard struts tags but that 
because there's no el. and after reading the faces stuff, i'm sold on 
using jstl.

Although I'm not JSTL's biggest fan it does have a certain elegance of 
its own. I'm gradually being won over. The fmt tags are really nice.

Cheers Mark

On Sunday, August 31, 2003, at 07:53 PM, Carlos Sánchez wrote:

c:url is a standard tag from JSTL, so I think it's better to follow
standards
Maybe html:link will be deprecated in a near future.
-Mensaje original-
De: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
Enviado el: domingo, 31 de agosto de 2003 18:36
Para: Struts Users Mailing List
Asunto: Re: dinamically add href into html:link
Thanks, I used html-el and it works.
what is the better to use, use c:url or html-el:link? Or it is
equivalent here?
And one more queestion:
I have object with application persistency (over all
sessions), and for
session I call some method to set some parameter and get
another object
(array list) and maybe store it in session.
Now I do:
jsp:useBean id=a class=cz.chalu.modules.blabla.Class
scope=application /
and, now provisory, this as scriptlet:
%
a.setRequest(request);
User user = (User)session.getAttribute(user);
if(user != null){
a.setUser(user);
}
getServletContext().setAttribute(b,
a.getSomething().toArray()); % next, I call some c:forEach
... cykle for b object.
How I can do it correctly in struts / jstl?

Thanks, Jiri

Mark Lowe wrote:

The ideal way would be something like this.

c:url url=${menuItem.link}
c:out var=${menuItem.name}/
/c:url
Cheers Mark

On Sunday, August 31, 2003, at 04:27 PM, Yann Cébron wrote:

how I can do something as this:

html:link action=${menuItem.link} c:out
value=${menuItem.name}  /
?


Use the EL-tags (look in the contrib/struts-el directory of the
Struts 1.1
distribution), e.g.
html-el:link action=${menuItem.link} .. .. /html-el:link

HTH,
Yann




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


RE: load data from db into form

2003-08-31 Thread David Friedman
Jiri,

Your error message explains the problem properly: No destination bean
specified. This means that BeanUtils.copyProperties is trying to copy the
registerDTO to a bean named 'form', which is null.  This makes complete
sense since your previous emails never tell us you've fixed your
action.../ tag to include the 'name=someFormBeanName' parameter.  You
need to switch your action tag to define a formBean. So, instead of having:

action
path=/Register2
type=cz.chalu.struts.modules.completeregister.LoadDataAction
parameter=.main.registerFinish/

You should have something like:

action
path=/Register2
name=registerFull
type=cz.chalu.struts.modules.completeregister.LoadDataAction
parameter=.main.registerFinish/

Without the name=registerFull (or some other defined bean name), the
ActionForm named 'form' in the execute(...) method will always be undefined
or null, and therefore unusable:

public ActionForward execute(ActionMapping mapping,
ActionForm form,HttpServletRequest request,
HttpServletResponse response) throws Exception, DatabaseException
{
// 'form' is in this function unless the action has
'name=someFormBeanName' in it.
.
}

Regards,
David

-Original Message-
From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 31, 2003 12:24 PM
To: Struts Users Mailing List
Subject: Re: load data from db into form


Yes, nested tags, I must look at ...
so now I have it without nested, form definition is now without it.

but still I got

java.lang.IllegalArgumentException: No destination bean specified
at
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:220)
at
cz.chalu.struts.modules.completeregister.LoadDataAction.execute(LoadDataActi
on.java:32)

What is missing? I my action class (execute method) I have:

public ActionForward execute(...){
LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return null;
}

If I understand well, in BeanUtils.copyProperties I copy data from DTO
into form defined in execute method?
Or something other is wrong?

Thanks


Mark Lowe wrote:

 Okay assuming the following..

 form-bean name=registerFull
 type=org.apache.struts.validator.DynaValidatorForm
  form-property name=id type=java.lang.Integer /
form-property name=fullname type=java.lang.String /
 form-property name=notify type=java.lang.Integer /
 /form-bean

 ..

 html:text property=fullname /
 html:text property=id /
 html:text property=notify /

 or if you are nesting you bean which in that case i wouldn't (too short).

 form-property name=mybean
 type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO

 Then assuming that fullname, id, and notify are all properties of
 ComplRegisterDTO.

 html:text property=mybean.fullname /
 html:text property=mybean.id /
 html:text property=mybean.notify /

 Cheers Mark






-
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: load data from db into form

2003-08-31 Thread Mark Lowe
Okay forget the beanutils...

form-property name=fullname type=java.lang.String /

theForm.set(fullname,registerDTO.getFullname());

..or

form-property name=mybean  
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO /

theForm.set(mybean, registerDTO);

Hope this gets you there..

Mark

On Sunday, August 31, 2003, at 05:24 PM, Jiri Chaloupka wrote:

Yes, nested tags, I must look at ...
so now I have it without nested, form definition is now without it.
but still I got

java.lang.IllegalArgumentException: No destination bean specified
	at  
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:22 
0)
	at  
cz.chalu.struts.modules.completeregister.LoadDataAction.execute(LoadDat 
aAction.java:32)

What is missing? I my action class (execute method) I have:

public ActionForward execute(...){
LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return null;
}
If I understand well, in BeanUtils.copyProperties I copy data from DTO  
into form defined in execute method?
Or something other is wrong?

Thanks

Mark Lowe wrote:

Okay assuming the following..

form-bean name=registerFull  
type=org.apache.struts.validator.DynaValidatorForm
 form-property name=id type=java.lang.Integer /
   form-property name=fullname type=java.lang.String /
form-property name=notify type=java.lang.Integer /
/form-bean

..

html:text property=fullname /
html:text property=id /
html:text property=notify /
or if you are nesting you bean which in that case i wouldn't (too  
short).

form-property name=mybean  
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO

Then assuming that fullname, id, and notify are all properties of  
ComplRegisterDTO.

html:text property=mybean.fullname /
html:text property=mybean.id /
html:text property=mybean.notify /
Cheers Mark





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


Getting IllegalStateException when URL is wrong struts can't finda mapping

2003-08-31 Thread Adam Hardy
When I type in the URL myself and make a spelling mistake, shouldn't I 
get a 404 error message saying this resource isn't available?

At the moment I am getting the following 500 error

java.lang.IllegalStateException
	at 
org.apache.coyote.tomcat4.CoyoteResponseFacade.sendError(CoyoteResponseFacade.java:312)
	at 
org.apache.struts.action.RequestProcessor.processMapping(RequestProcessor.java:684)

even though I am getting the appropriate logging:

Aug 31, 2003 9:57:11 PM org.apache.struts.action.RequestProcessor 
processMapping
SEVERE: Invalid path /private/start was requested



Adam

--
struts 1.1 + tomcat 4.1.27 + java 1.4.2
Linux 2.4.20 RH9
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: J2EE IDE

2003-08-31 Thread Michael Wever
This is nonsense.
I use NetBeans 3.5.1 with j2sdk1.4.2, and I rarely restart it (manually or
through a crash) more than one a week. Right now it has been running for
over three weeks fine. The speed issue is relative, what is slow? 
NetBeans 3.5.x version was primarily improvements to performance in the
IDE, now it is very fast and responsive. I have never had any problems
with speed on this version of NetBeans. (Unless you choose to turn on
every single plug in, and try experimenting with everyone at once, ...
eclipse users complain about poor performance under these conditions as
well).

Oh, and to have a jab, didn't IBM try to announce Eclipse as the first
open source true Java IDE? NetBeans was open source a good year or two
before Eclipse, and Eclipse isn't 100% java!! It is an interesting
reflection between Sun and IBM, Sun focus' more on technical issues and
IBM more on marketing. Nonetheless it is great the two opensource IDEs
exist to encourage competition between the two camps.

Mick.

On Thu, 28 Aug 2003 20:43:04 -0600, James Harman wrote:
 Maybe because it is slow, and crash like once everyday.
 
 Andy Cheng wrote:
 
Hi, I have never used anything else very seriously except Netbeans.  I
think it is slow, and crash like once everyday, but the feature it offer
really is worth the trouble.  It can generate the get and set method, it
will update any classes that implement the interface you are editing,
ultra good search and highlighting.  You can basically customize
everything you can see too... I really cannot understand why people do
not like it.

-- 
BR/
Driving ambition is the last refuge of the failure. Oscar Wilde
BR/
 --- a href=http://www.harryspractice.com.auwww.harryspractice.com.au/a --- 



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



force caching staticJavascript.jsp

2003-08-31 Thread Adolfo Miguelez
Hi,

as validator framework suggest, is possible to avoid downloading static 
functions for validation for every JSP, by creating the page:

%@ page contentType=application/x-javascript %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
html:javascript dynamicJavascript=false staticJavascript=true/
which would hold static functions called from the dynamic ones in the pages 
with forms.

However, when set controller cache=false/controller for the whole app, 
staticJavascript.jsp is not cached by browser and is returned again by every 
JSP page which includes validation to the browser.

How could we tell staticJavacript.jsp that it is an exception and MUST be 
cached in the client browser. I think it is a common issue, so I hope 
someone could have a solution.

Thanks in advance,

Adolfo

_
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

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


displaying collections after a validate() error

2003-08-31 Thread Graham Stark
Hi,
   could someone suggest what I'm doing wrong here?

I've got a form with an associated ActionForm, several members of which
are collections. I display them like this:

logic:iterate property=domainRoles name=myForm id=domain

tr class=dataTableHeader

td align=leftc:out value=${domain.roleDescription}//td

[]

Whilst single valued fields are displayed like:

html:textarea property=notes cols=15

All seems well, and everything displays fine. However, the ActionForm
has a validate() method, which send the user back at the form, which
displays some error messages. When this happens, however, the JSP
doesn't display the collections from the ActionForm, only single valued
fields. 

Can anyone suggest what I'm doing wrong here?

thanks,

Graham



-- 
Graham Stark, Virtual Worlds
phone: (+044) 01908 618239 mobile: 07952 633185
Homepage http://www.virtual-worlds.biz
Virtual Learning Arcade http://www.bized.ac.uk/virtual/vla
Virtual Economy http://www.bized.ac.uk/virtual/economy 


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



Re: load data from db into form

2003-08-31 Thread Jiri Chaloupka
Thanks David,
it looks bettre, you've right, this was a clear mistake :(
this exception is not shown now, but now it is displayed blank page, 
only htmlbody/body/html

Maybe, when action class is finished I must set some forward.

now I have

LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return (mapping.findForward(success));
but in page I do not need to return to anywhere now, I need only load 
data into form for future editing. How to do it, or what can I do for it?

Thanks,
Jiri
David Friedman wrote:

Jiri,

Your error message explains the problem properly: No destination bean
specified. This means that BeanUtils.copyProperties is trying to copy the
registerDTO to a bean named 'form', which is null.  This makes complete
sense since your previous emails never tell us you've fixed your
action.../ tag to include the 'name=someFormBeanName' parameter.  You
need to switch your action tag to define a formBean. So, instead of having:
action
   path=/Register2
   type=cz.chalu.struts.modules.completeregister.LoadDataAction
   parameter=.main.registerFinish/
You should have something like:

action
   path=/Register2
name=registerFull
   type=cz.chalu.struts.modules.completeregister.LoadDataAction
   parameter=.main.registerFinish/
Without the name=registerFull (or some other defined bean name), the
ActionForm named 'form' in the execute(...) method will always be undefined
or null, and therefore unusable:
public ActionForward execute(ActionMapping mapping,
ActionForm form,HttpServletRequest request,
HttpServletResponse response) throws Exception, DatabaseException
{
// 'form' is in this function unless the action has
'name=someFormBeanName' in it.
.
}
Regards,
David
-Original Message-
From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 31, 2003 12:24 PM
To: Struts Users Mailing List
Subject: Re: load data from db into form
Yes, nested tags, I must look at ...
so now I have it without nested, form definition is now without it.
but still I got

java.lang.IllegalArgumentException: No destination bean specified
at
org.apache.commons.beanutils.BeanUtils.copyProperties(BeanUtils.java:220)
at
cz.chalu.struts.modules.completeregister.LoadDataAction.execute(LoadDataActi
on.java:32)
What is missing? I my action class (execute method) I have:

public ActionForward execute(...){
LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return null;
}
If I understand well, in BeanUtils.copyProperties I copy data from DTO
into form defined in execute method?
Or something other is wrong?
Thanks

Mark Lowe wrote:

 

Okay assuming the following..

form-bean name=registerFull
type=org.apache.struts.validator.DynaValidatorForm
form-property name=id type=java.lang.Integer /
  form-property name=fullname type=java.lang.String /
   form-property name=notify type=java.lang.Integer /
/form-bean
..

html:text property=fullname /
html:text property=id /
html:text property=notify /
or if you are nesting you bean which in that case i wouldn't (too short).

form-property name=mybean
type=cz.chalu.struts.modules.completeregister.ComplRegisterDTO
Then assuming that fullname, id, and notify are all properties of
ComplRegisterDTO.
html:text property=mybean.fullname /
html:text property=mybean.id /
html:text property=mybean.notify /
Cheers Mark



   



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


RE: load data from db into form

2003-08-31 Thread David Friedman
Jiri,

What action class does your action extend?  If it is
org.apache.struts.action.Action, then the parameter field, which you appear
to have filled in with what seems to be a tiles definition, is ignored.  The
parameter field does nothing unless it is a subclass of Action, such as
ForwardAction, DispatchAction, etc.  Those sub-classes used the contents of
the optional parameter field to perform an action they were designed for:
ForwardAction assumes the contents of the parameter field is a tile or jsp
path to forward to while the DispatchAction assumes the contents of the
parameter field is to be used a form field name to determine what function
to execute.

When you put your return as a mapping.findForward(success), where do you
define a forward named success?  You must define a  forward either in the
global forwards section, or in the action.  Since you said I corrected for
the form bean error, here is the old action without the forwards:

action
path=/Register2
name=registerFull
type=cz.chalu.struts.modules.completeregister.LoadDataAction
parameter=.main.registerFinish/

You should define success, failure, or anything else you plan to use as
a mapping.findForward(SOMETHINGHERE) in your action or in the
global-forwards section.  An action would be setup a bit like this:

action
path=/Register2
name=registerFull
type=cz.chalu.struts.modules.completeregister.LoadDataAction
forward name=success path=.main.registerFinish/
forward name=failure path=.main.registerFailure/
!-- this above line is an example you could setup
for multiple destinations based on the name
you use in quotes with your findForward call.
If you wish to share these forwards, like menu
with other pages, put the forward/ in the
global-forwards... /global-forwards section
for any action to utilize. --
/action

I actually did some searching on the parameter=something last
week wondering what the normal Action class does with it and
found out it does nothing.  It is for you to pass information
to your action on the fly and access using getParameter() and
setParameter().  In the case of ActionForwards or other action
subclasses, it has specific means that assist in the function
of those subclasses.

Regards,
David

-Original Message-
From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 31, 2003 4:29 PM
To: Struts Users Mailing List
Subject: Re: load data from db into form


Thanks David,
it looks bettre, you've right, this was a clear mistake :(
this exception is not shown now, but now it is displayed blank page,
only htmlbody/body/html

Maybe, when action class is finished I must set some forward.

now I have

LoadDataService service = new LoadDataService();
ComplRegisterDTO registerDTO = service.loadUser(request);
BeanUtils.copyProperties(form, registerDTO);
return (mapping.findForward(success));

but in page I do not need to return to anywhere now, I need only load
data into form for future editing. How to do it, or what can I do for it?

Thanks,
Jiri

David Friedman wrote:

Jiri,

Your error message explains the problem properly: No destination bean
specified. This means that BeanUtils.copyProperties is trying to copy the
registerDTO to a bean named 'form', which is null.  This makes complete
sense since your previous emails never tell us you've fixed your
action.../ tag to include the 'name=someFormBeanName' parameter.  You
need to switch your action tag to define a formBean. So, instead of having:

action
path=/Register2
type=cz.chalu.struts.modules.completeregister.LoadDataAction
parameter=.main.registerFinish/

You should have something like:

action
path=/Register2
   name=registerFull
type=cz.chalu.struts.modules.completeregister.LoadDataAction
parameter=.main.registerFinish/
Without the name=registerFull (or some other defined bean name), the
ActionForm named 'form' in the execute(...) method will always be undefined
or null, and therefore unusable:

public ActionForward execute(ActionMapping mapping,
   ActionForm form,HttpServletRequest request,
   HttpServletResponse response) throws Exception, DatabaseException
{
// 'form' is in this function unless the action has
'name=someFormBeanName' in it.
.
}

Regards,
David

-Original Message-
From: Jiri Chaloupka [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 31, 2003 12:24 PM
To: Struts Users Mailing List
Subject: Re: load data from db into form


Yes, nested tags, I must look at ...
so now I have it without nested, form definition is now without it.

but still I got

java.lang.IllegalArgumentException: No destination bean specified
   at

Re: dinamically add href into html:link

2003-08-31 Thread Jiri Chaloupka
OK, thanks for your view. Maybe it will be better to rewrite it, until 
there is not much code...

Jiri

Mark Lowe wrote:

If you've the choice use JSTL..  If you're using the expression 
language then use that. I like using the standard struts tags but that 
because there's no el. and after reading the faces stuff, i'm sold on 
using jstl.

Although I'm not JSTL's biggest fan it does have a certain elegance of 
its own. I'm gradually being won over. The fmt tags are really nice.

Cheers Mark

On Sunday, August 31, 2003, at 07:53 PM, Carlos Sánchez wrote:

c:url is a standard tag from JSTL, so I think it's better to follow
standards
Maybe html:link will be deprecated in a near future.


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