Re: [OT] JSP or Velocity

2004-02-27 Thread John Ferguson Smart
For my part, I tried Velocity with Struts and found it quite cool, but 
had trouble with some more tricky needs (dynamic includes) which where 
easier to do with Tiles and Taglibs (JSP 2.0-style taglibs, that is...)

Just my 2 cents...

A.White wrote:

Howdy

I am starting to develop an application using struts and have been
looking round the rest of the Jakarta project and came across the
Velocity project.
I was interested to see which which people recommended for a relative
newbie
Cheers

Andrew

 

--
John Ferguson Smart, PhD
Directeur de Projet
Département informatique Communicante 
AACOM
email : [EMAIL PROTECTED]

-
AACOM - L'Informatique communicante
120 rue du Marin Blanc - Z.I. des Paluds
13685 Aubagne Cedex
tel : 04.42.72.65.69 - fax : 04.42.72.65.68
Web : http://www.aacom.fr
-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [OT] JSP or Velocity

2004-02-27 Thread John Ferguson Smart
  /c:when
  /c:choose
  /c:forEach
  hr
  br${meeting.meetingId}:${repId}br
  /td
  /tr
/table
===
The velocity version:
===
table width=600 border=0 cellspacing=0 cellpadding=4
  bgcolor=white
  tr
  td
  ibTopic: $meeting.getTopic()/b/ip
  #foreach( $event in $meeting.getStoredEventsIterator() )
  #set( $yapper =
$meeting.getParticipation($event.getFromId()) )
  #if( $event.getClass().getName().equals($urlEvent) )

  #if( $repRole.equals($yapper.getRole()) )
  #set( $repId = $yapper.getParticipantId() )
  font
color=$blkb$yapper.getName()/b/font
  #else
  font
color=$blub$yapper.getName()/b/font
  #end
  a
href=$event.getStoredData()$event.getStoredData()/a br
  #elseif( $event.getClass().getName().equals($chatEvent) )

  #if($repRole.equals($yapper.getRole()) )
  #set( $repId = $yapper.getParticipantId() )
  font
color=$blkb$yapper.getName()/b/font
  #else
  font
color=$blub$yapper.getName()/b/font
  #end
  $event.getStoredData() br
  #end
  #end
  hr
  br$meeting.getMeetingId():$repIdbr
  /td
  /tr
/table
===
Larry

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


 

--
John Ferguson Smart, PhD
Directeur de Projet
Département informatique Communicante 
AACOM
email : [EMAIL PROTECTED]

-
AACOM - L'Informatique communicante
120 rue du Marin Blanc - Z.I. des Paluds
13685 Aubagne Cedex
tel : 04.42.72.65.69 - fax : 04.42.72.65.68
Web : http://www.aacom.fr
-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Generate Java class from xml?

2003-12-18 Thread John Ferguson Smart
Must be a new anti-spam filter on the mail server, I guess...

Adam Hardy wrote:

John,
this is off-topic, but why does your message header contain the word 
***SPAM** ?

On 12/17/2003 08:43 PMnbsp;John Smart wrote:

There's also XMLBeans (http://xml.apache.org/xmlbeans/) , which, 
unlike Castor, works with JDK 1.4...

Martin Gainty wrote:

Castor (http://www.castor.org) which generate the java classes with 
marshall
and unmarshall methods, but it is not finished, doesn't care to 
namespaces,
owns severals bugs ...

The second one is Xml Spy 5.0, it generate classes from an xsd file 
which
wrap on the Dom Tree, but all facets are not implemented as 
enumeration ...
but I think that a better version will come soon. Generates JAXP 
compliant
Java Beans
http://www.altova.com/features_java.html

-Martin

- Original Message - From: Vicky [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, December 17, 2003 2:01 PM
Subject: Generate Java class from xml?
 

Does anyone have an idea of how i can generate .java file from xml 
file?
  


Tools like jakrata digester, JOX are there but both of them are 
useful in
populating java beans from xml. My requirement is to generate .java 
file
from .xml with getters and setters methods for xml 
elements/attributes. I
also tried JAXB. But JAXB generates bunch of files and most of them are
interfaces, which is not going to work for me.
 

For e.g. i have following xml file and i want to generate Address.java
  


file with getters/setters. Any ideas?
 

?xml version='1.0' encoding='UTF-8' ?
Address
   FirstName type=String/
   PoBox type=int/
..
/Address
Thanks,
Vicky



--
John Ferguson Smart, PhD
Directeur de Projet
Département informatique Communicante 
AACOM
email : [EMAIL PROTECTED]

-
AACOM - L'Informatique communicante
120 rue du Marin Blanc - Z.I. des Paluds
13685 Aubagne Cedex
tel : 04.42.72.65.69 - fax : 04.42.72.65.68
Web : http://www.aacom.fr
-


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


Re: FormBean error using Struts 1.1 and Tomcat 5

2003-12-05 Thread John Ferguson Smart
Forget it, guys, I called an exorsist and a vodoo-specialist, who told 
me to install Tomcat 5.0.16, and now it works.

John Ferguson Smart wrote:

Anyone got any ideas ?

John Ferguson Smart wrote:

Hi,
   I've run into a strange problem using Struts 1.1 with Tomcat 
5.0.14 . In a page that previously worked fine (of course...), I now 
get a JSP page displays the following message :
   [ServletException in:/admin/tiles/welcomeBody.jsp] Exception 
creating bean of class com.wakaleo.webcat.auth.LogonForm: {1}

The strange thing is, I'm not working on the user interface at the 
moment, so I don't see what could have changed. From what I can 
gather from the source code, Struts calls the 
RequestUtils.applicationInstance() method to instanciate an instance 
of the form bean, and then exploses (see the stack dump below). 
Tomcat (?) doesn't seem to be able to find some of the Struts classes 
(ActionForm, ActionErrors,...). I get the same thing with any other 
Struts forms, but, strangely enough, the bits of the site that don't 
use the html:form tag seem to work as excepted (they do use Tiles 
and JSTL, though). I also have no idea what on earth Tomcat is trying 
to compile

This one's got me stumped. Any ideas ?

STACK DUMP :

GRAVE: Error creating form bean of class 
com.wakaleo.webcat.auth.LogonForm
java.lang.Error: Unresolved compilation problems:
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   ActionForm cannot be resolved or is not a valid superclass
   ActionErrors cannot be resolved (or is not a valid return 
type) for the
method validate
   ActionMapping cannot be resolved (or is not a valid type) for 
the argume
nt mapping of the method validate
   ActionErrors cannot be resolved or is not a type
   ActionErrors cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type

   at com.wakaleo.webcat.auth.LogonForm.init(LogonForm.java:14)
   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
   at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
   at 
java.lang.reflect.Constructor.newInstance(Constructor.java:274)
   at java.lang.Class.newInstance0(Class.java:308)
   at java.lang.Class.newInstance(Class.java:261)
   at 
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.
java:231)
   at 
org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.jav
a:837)
   at 
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:552)
   at 
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
   ...

TAGLIB WHICH EXPLOSES (works fine if I replace all this with 'HELLO 
WORLD') :

%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=http://java.sun.com/jstl/fmt; prefix=fmt %
%@ taglib uri=http://java.sun.com/jstl/core; prefix=c %
%@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles %
%@ taglib uri=http://jakarta.apache.org/taglibs/log-1.0; 
prefix=log %
%@ taglib tagdir=/WEB-INF/tags/util prefix=util %

%-- Login form --%
table class=infoFrame cellpadding=0 cellspacing=0 width=100%
%-- Box Heading --%
util:boxed_heading titleKey=admin.home.login.title /
tr class=infoList
 td colspan=3 align=center colspan=3
   table class=infoListFrame cellpadding=0 cellspacing=5 
width=100%
html:form action=/admin/LogonSubmit
 tr class=infoList
   td class=newsDetails
 fmt:message key=admin.home.login.description /
   /td
 /tr
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.login //th/tr
 tr class=infoListtdhtml:text property=username 
//td/tr
 html:errors property=username /
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.account //th/tr
 tr class=infoListtdhtml:text property=account //td/tr
 html:errors property=account /
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.password //th/tr
 tr class=infoListtdhtml:password property=password 
//td/tr
 html:errors property=password /
 tr class=infoList
  td align=left width=116 height=23
  input value='submit'
border='0'
src='html:rewrite page=/admin/images/btn_ok.gif/'
name='submit'
type='image'
  /td
 /tr
 html:errors property=org.apache.struts.action.GLOBAL_MESSAGE /
/html:form
   /table
 /td
/tr
/table
%-- End Login form --%

FORM-BEAN in struts-config.xml :
   form-bean name=logonForm 
type

Re: session taglib

2003-12-05 Thread John Ferguson Smart
Try something like
   String username = session.getAttribute(username);
or
   String username = request.getSession(à.getAttribute(username);
struts wrote:

In the Jsp i have:

sess:attribute name=userName/

witch prints the username. Now i want something like:

%

String username= sess:attribute name=userName/;

%

but that doesn't work. How can i assign the session variable to the String username ?

Thanks !



 

--
John Ferguson Smart, PhD
Directeur de Projet
Département informatique Communicante 
AACOM
email : [EMAIL PROTECTED]

-
AACOM - L'Informatique communicante
120 rue du Marin Blanc - Z.I. des Paluds
13685 Aubagne Cedex
tel : 04.42.72.65.69 - fax : 04.42.72.65.68
Web : http://www.aacom.fr
-


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


Re: Positional problem?

2003-12-04 Thread John Ferguson Smart
When we submit the form, we call a Javascript function to set a hidden 
field ('target_field'), which is where we want to go on the updated page :

function submitForm(theForm, actionChoice, targetFieldName) {
   setValue(theForm.query, actionChoice);
   setValue(theForm.target_field, targetFieldName);
   theForm.submit();
}
Then, when we display the page, we use  another Javascript function to 
scroll to the right place :

function jumpField(oForm,ofield) {
   var i=0;
   var elementsLength = oForm.elements.length;
   for ( i=0 ; i = elementsLength-1 ; i++ ) {
   var fName = oForm.elements[i].name;
   if ( fName == ofield.name ) {
   oForm.elements[i+1].focus();
   break;
   } else {
   continue;
   }
   }
}
Cheers,

Bjørn T Johansen wrote:

Does anyone have any examples? My javascript knowledge isn't where it
should be yet
BTJ

On Wed, 2003-12-03 at 14:49, John Smart wrote:
 

We did something like that using an extra field (focus) to know where 
you are and some javascript to place the focus at the right place when 
the page is redisplayed.

Bjørn T Johansen wrote:

   

I have a number of jsp pages that are longer than one page and if I am
at the bottom of a page and submit the page, I get back at the top of
the page. Is there a way to get back, after the submit, to the place you
were before the submit?
Regards,

BTJ

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

--
John Ferguson Smart, PhD
Directeur de Projet
Département informatique Communicante 
AACOM
email : [EMAIL PROTECTED]

-
AACOM - L'Informatique communicante
120 rue du Marin Blanc - Z.I. des Paluds
13685 Aubagne Cedex
tel : 04.42.72.65.69 - fax : 04.42.72.65.68
Web : http://www.aacom.fr
-


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


Re: FormBean error using Struts 1.1 and Tomcat 5

2003-12-04 Thread John Ferguson Smart
Anyone got any ideas ?

John Ferguson Smart wrote:

Hi,
   I've run into a strange problem using Struts 1.1 with Tomcat 5.0.14 
. In a page that previously worked fine (of course...), I now get a 
JSP page displays the following message :
   [ServletException in:/admin/tiles/welcomeBody.jsp] Exception 
creating bean of class com.wakaleo.webcat.auth.LogonForm: {1}

The strange thing is, I'm not working on the user interface at the 
moment, so I don't see what could have changed. From what I can gather 
from the source code, Struts calls the 
RequestUtils.applicationInstance() method to instanciate an instance 
of the form bean, and then exploses (see the stack dump below). Tomcat 
(?) doesn't seem to be able to find some of the Struts classes 
(ActionForm, ActionErrors,...). I get the same thing with any other 
Struts forms, but, strangely enough, the bits of the site that don't 
use the html:form tag seem to work as excepted (they do use Tiles 
and JSTL, though). I also have no idea what on earth Tomcat is trying 
to compile

This one's got me stumped. Any ideas ?

STACK DUMP :

GRAVE: Error creating form bean of class 
com.wakaleo.webcat.auth.LogonForm
java.lang.Error: Unresolved compilation problems:
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   ActionForm cannot be resolved or is not a valid superclass
   ActionErrors cannot be resolved (or is not a valid return type) 
for the
method validate
   ActionMapping cannot be resolved (or is not a valid type) for 
the argume
nt mapping of the method validate
   ActionErrors cannot be resolved or is not a type
   ActionErrors cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type

   at com.wakaleo.webcat.auth.LogonForm.init(LogonForm.java:14)
   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
   at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
   at java.lang.Class.newInstance0(Class.java:308)
   at java.lang.Class.newInstance(Class.java:261)
   at 
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.
java:231)
   at 
org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.jav
a:837)
   at 
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:552)
   at 
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
   ...

TAGLIB WHICH EXPLOSES (works fine if I replace all this with 'HELLO 
WORLD') :

%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=http://java.sun.com/jstl/fmt; prefix=fmt %
%@ taglib uri=http://java.sun.com/jstl/core; prefix=c %
%@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles %
%@ taglib uri=http://jakarta.apache.org/taglibs/log-1.0; 
prefix=log %
%@ taglib tagdir=/WEB-INF/tags/util prefix=util %

%-- Login form --%
table class=infoFrame cellpadding=0 cellspacing=0 width=100%
%-- Box Heading --%
util:boxed_heading titleKey=admin.home.login.title /
tr class=infoList
 td colspan=3 align=center colspan=3
   table class=infoListFrame cellpadding=0 cellspacing=5 
width=100%
html:form action=/admin/LogonSubmit
 tr class=infoList
   td class=newsDetails
 fmt:message key=admin.home.login.description /
   /td
 /tr
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.login //th/tr
 tr class=infoListtdhtml:text property=username //td/tr
 html:errors property=username /
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.account //th/tr
 tr class=infoListtdhtml:text property=account //td/tr
 html:errors property=account /
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.password //th/tr
 tr class=infoListtdhtml:password property=password 
//td/tr
 html:errors property=password /
 tr class=infoList
  td align=left width=116 height=23
  input value='submit'
border='0'
src='html:rewrite page=/admin/images/btn_ok.gif/'
name='submit'
type='image'
  /td
 /tr
 html:errors property=org.apache.struts.action.GLOBAL_MESSAGE /
/html:form
   /table
 /td
/tr
/table
%-- End Login form --%

FORM-BEAN in struts-config.xml :
   form-bean name=logonForm 
type=com.wakaleo.webcat.auth.LogonForm/

(And, yes, LogonForm is derived from ActionForm).

--
John Ferguson Smart, PhD
Directeur de Projet
Département informatique

FormBean error using Struts 1.1 and Tomcat 5

2003-12-02 Thread John Ferguson Smart
Hi,
   I've run into a strange problem using Struts 1.1 with Tomcat 5.0.14 
. In a page that previously worked fine (of course...), I now get a JSP 
page displays the following message :
   [ServletException in:/admin/tiles/welcomeBody.jsp] Exception 
creating bean of class com.wakaleo.webcat.auth.LogonForm: {1}

The strange thing is, I'm not working on the user interface at the 
moment, so I don't see what could have changed. From what I can gather 
from the source code, Struts calls the 
RequestUtils.applicationInstance() method to instanciate an instance of 
the form bean, and then exploses (see the stack dump below). Tomcat (?) 
doesn't seem to be able to find some of the Struts classes (ActionForm, 
ActionErrors,...). I get the same thing with any other Struts forms, 
but, strangely enough, the bits of the site that don't use the 
html:form tag seem to work as excepted (they do use Tiles and JSTL, 
though). I also have no idea what on earth Tomcat is trying to compile

This one's got me stumped. Any ideas ?

STACK DUMP :

GRAVE: Error creating form bean of class com.wakaleo.webcat.auth.LogonForm
java.lang.Error: Unresolved compilation problems:
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   The import org.apache.struts cannot be resolved
   ActionForm cannot be resolved or is not a valid superclass
   ActionErrors cannot be resolved (or is not a valid return type) 
for the
method validate
   ActionMapping cannot be resolved (or is not a valid type) for 
the argume
nt mapping of the method validate
   ActionErrors cannot be resolved or is not a type
   ActionErrors cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type
   ActionError cannot be resolved or is not a type

   at com.wakaleo.webcat.auth.LogonForm.init(LogonForm.java:14)
   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)

   at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
   at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
   at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
   at java.lang.Class.newInstance0(Class.java:308)
   at java.lang.Class.newInstance(Class.java:261)
   at 
org.apache.struts.util.RequestUtils.applicationInstance(RequestUtils.
java:231)
   at 
org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.jav
a:837)
   at 
org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:552)
   at 
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
   ...

TAGLIB WHICH EXPLOSES (works fine if I replace all this with 'HELLO 
WORLD') :

%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=http://java.sun.com/jstl/fmt; prefix=fmt %
%@ taglib uri=http://java.sun.com/jstl/core; prefix=c %
%@ taglib uri=/WEB-INF/struts-tiles.tld prefix=tiles %
%@ taglib uri=http://jakarta.apache.org/taglibs/log-1.0; prefix=log %
%@ taglib tagdir=/WEB-INF/tags/util prefix=util %
%-- Login form --%
table class=infoFrame cellpadding=0 cellspacing=0 width=100%
%-- Box Heading --%
util:boxed_heading titleKey=admin.home.login.title /
tr class=infoList
 td colspan=3 align=center colspan=3
   table class=infoListFrame cellpadding=0 cellspacing=5 
width=100%
html:form action=/admin/LogonSubmit
 tr class=infoList
   td class=newsDetails
 fmt:message key=admin.home.login.description /
   /td
 /tr
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.login //th/tr
 tr class=infoListtdhtml:text property=username //td/tr
 html:errors property=username /
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.account //th/tr
 tr class=infoListtdhtml:text property=account //td/tr
 html:errors property=account /
 tr class=infoListth align=leftfmt:message 
key=admin.home.login.password //th/tr
 tr class=infoListtdhtml:password property=password 
//td/tr
 html:errors property=password /
 tr class=infoList
  td align=left width=116 height=23
  input value='submit'
border='0'
src='html:rewrite page=/admin/images/btn_ok.gif/'
name='submit'
type='image'
  /td
 /tr
 html:errors property=org.apache.struts.action.GLOBAL_MESSAGE /
/html:form
   /table
 /td
/tr
/table
%-- End Login form --%

FORM-BEAN in struts-config.xml :
   form-bean name=logonForm 
type=com.wakaleo.webcat.auth.LogonForm/

(And, yes, LogonForm is derived from ActionForm).

--
John Ferguson Smart, PhD
Directeur de Projet
Département informatique Communicante 
AACOM
email : [EMAIL PROTECTED