View Full Version : Laszlo and Apache Struts
rajs1
11-11-2004, 06:39 AM
There have been a few posts on using apache struts with Laszlo, in my opinion, an excellent idea.
Here is a small example (zip file attached) on doing it.
The zip conatins the following:
1. a forms directory that contains a laszlo form
2. a WEB-INF dir with the web.xml and struts-config.xml files (I copied struts-blank as the template). The web.xml combines the strut and laszlo requirements.
3. a WEB-INF/classes directory containing some Action classes and form beans.
I guess the easiest way is to copy the strut-blank dir as app01 and replace the above from the zip file. Then copy the lps dir etc etc from the Laszlo distribution.
I hope this comes in useful.
Cheers
-raj
rajs1
11-11-2004, 06:41 AM
Zip file did not upload
rajs1
11-11-2004, 06:49 AM
Sorry, the 3 call back jsp files were missing from WEB-INF dir.
Here's the new zip.
ksuga27
12-20-2004, 02:47 AM
Hi, I was able to install the sample app and run the signup form. However everytime I tried to click on the Sign Me Up button I kept getting the following error message:
data source error for http://localhost:8080/app01/forms/../actions/register3.do: HTTP Status code: 404:Not Found
form submission error «LzDataset#0| "formhandler"»
I tried to change the dataset src attribute to:
/actions/register3.do with attribute type set to html, but still get the same error message (Status code 404)
Can you please help,
Thanks
rajs1
12-22-2004, 06:33 AM
I suggest you undertake the following steps:
Lets say your tomcat installation root dir is TOMCATINSTALL
and yous LaszloServer installation root dir is LASZLOINSTALL.
Then:
1. unzip app01.zip into TOMCATINSTALL/webapp
2. rename TOMCATINSTALL/webapp/app01 as TOMCATINSTALL/webapp/_app01
4. make a new directory called TOMCATINSTALL/webapp/app01
5. download jakarta struts and unzip struts-blank.war (in webapps of the distribution) into TOMCATINSTALL/webapp/app01
6. now you have 2 dirs:
TOMCATINSTALL/webapp/app01
TOMCATINSTALL/webapp/_app01
7. Move _app01/forms to app01
8. Move
_app01/WEB-INF/struts-config.xml to app01/WEB-INF (overwrite)
_app01/WEB-INF/web.xml to app01/WEB-INF (overwrite)
_app01/WEB-INF/results to app01/WEB-INF
_app01/WEB-INF/classes/app01 to app01/WEB-INF/classes
9. you can now delete _app01
10. copy LASZLOINSTALL/Server/lps-2.2/lps to TOMCATINSTALL/webapp/app01
11. copy LASZLOINSTALL/Server/lps-2.2/WEB-INF/lps to TOMCATINSTALL/webapp/app01/WEB-INF
(note: after this you may wish to delete cached files in TOMCATINSTALL/webapp/app01/WEB-INF/lps/work)
12. copy all the jars from LASZLOINSTALL/Server/lps-2.2/WEB-INF/lib to TOMCATINSTALL/webapp/app01/WEB-INF/lib
(avoid overwriting the commons's jar files)
13. Start tomcat
14. Type:
http://localhost:8080/app01/forms/signup.lzx
in your browser
and you should be "quids in"
Cheers
-raj
ksuga27
12-22-2004, 04:25 PM
Great instructions! Thanks a lot for your help, it works!
Hey,
I am currently using turbine for my application. The things that raj has posted about Struts and Laszlo should be possibly done with Turbine too right?
I am thinking of getting into Laszlo, and currently we have our web-apps done in Turbine and Velocity.
Thanks for any input to this.
vick
anong
04-28-2005, 12:16 AM
Can it support lps3.0?
Thank you!
stylee
09-14-2005, 01:11 AM
Hi raj,
I 've got a struts problem when I deploy app01. I've joined a picture with this message. it seems like a struts actionforward named "welcome" is missing.
Thanks in advance for your response
Stylee
lucaboati
11-24-2005, 01:09 AM
I tryed to apply your example to my application, i did all the right steps, but i still receive this log on the debug.
ERROR: data source error for http://localhost:7001/books/Addlzx.do?ISBN=0NAN000NAN03900NAN0&titolo=titolo&prezzo=23NAN.00000032: HTTP Status code: 404:Not Found
form submission error «LzDataset#1| <add/>»
«LzDataset#1| <add/>» {
_createdParent: #anonHTTPDS1
_dsrc: #anonHTTPDS1
_events: [LzEvent, LzEvent, LzEvent]
_instanceAttrs: «Object#2#5| {name: add, request: false, src: /books/Addlzx.do, type...»
_instanceChildren: «undefined»
_sCall: LzNode.setName
errorstring: «LzDataElement#7| <resultset><error status=\"500\" msg=\"data source...»
id: add
immediateparent: «LzCanvas#8| This is the canvas»
isinited: true
name: add
nodeLevel: 1
nodeName: add
oncanvas: true
ondata: «”LzEvent!#9| «LzDataset#1| <add/>».ondata»
onerror: «”LzEvent!#10| «LzDataset#1| <add/>».onerror»
ontimeout: «”LzEvent!#11| «LzDataset#1| <add/>».ontimeout»
options: «Object#12| {dstimeoutDel: Delegate for LzDataset :add calls gotTime...»
ownerDocument: «LzDataset#1| <add/>»
params: «LzParam#13| .params»
parent: «LzCanvas#8| This is the canvas»
querystring: ISBN=0%2D000%2D03900%2D0&titolo=titolo&prezzo=23%2E32
queuerequests: false
src: /books/Addlzx.do
subnodes: []
timeout: 30000
type: http
}
«LzDataset#1| <add/>»
anyways, my form send the data to struts action and it works, I just receive this error on the debug time.
advices..
this is my form code:
//--------------------
<tabpane id ="tp2" text=" <bean:message key="title.addbook"/>" selected="true">
<view layout="axis: y; spacing: 10">
<form layout="axis:y; spacing: 15">
<submit name="submitterBook" data="${add}"/>
<view layout="axis: x; spacing: 5">
<text y="2"> <bean:message key="prompt.book.ISBN"/></text>
<edittext width="120" name="ISBN">0-000-00000-0</edittext>
</view>
<view layout="axis: x; spacing: 5">
<text y="2"> <bean:message key="prompt.book.titolo"/></text>
<edittext width="120" name="titolo">titolo</edittext>
</view>
<view layout="axis: x; spacing: 5">
<text y="2"> <bean:message key="prompt.book.prezzo"/></text>
<edittext width="120" name="prezzo">23.32</edittext>
</view>
<button isdefault="true"
onclick="parent.submitterBook.submit();
add.setQueryType('POST');
tp5.setAttribute('selected',true);
griglia.setAttribute('visible',true);
var e = canvas.datasets.bookslist;
e.doRequest();
" >
<bean:message key="button.add"/>
</button>
</form>
</view>
</tabpane>
//--------------------
thanks
Luca
kmahapatruni
12-03-2005, 12:29 AM
Hi,
We are using lazlo with Struts. I have got a problem with internationalization. I am trying to enter some japanese data from Laszlo form. This request is being sent to the action class and the action class sends the data to the database. The prolem i face is, the parameters are being sent in japanese only. But the data is saved as junk charecters in the database.
I have also set the HTTPServletReuest charecter encoding to UTF-8. Also, my database do support UTF-8 charecterset.
From the lazlo form when the request goes to the action class, it does not encode the URL. Can anyone help me out in how to get this resolved. My web application should tell that the URL must be encoded.
dhanukanavin
03-25-2006, 04:07 PM
I have attached the screen shot of the error i get.
Kindly advice.
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.