[Logo] Mentawai Forum - Mentawai Web Framework
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 

Forum Read-Only! Check the new site and forum here!

Using standard filters and servlets with Mentawai  XML
Forum Index -> General Comments
Author Message
kabrod



Joined: 02/02/2008 18:50:42
Messages: 6
Offline

I tried the MyBooks app with SiteMesh filter and it wouldn't run. I didn't spend much time with it, because I thought it would be better to ask first.

So the question is: How do we implement a filter or a servlet? Can it be done the standard way by declaring it in the web.xml, or if we must use the ApplicationManager.java, do you have an example?

Thank you.
kabrod



Joined: 02/02/2008 18:50:42
Messages: 6
Offline

I think I'm falling in love...

I just made a jsp page with no html markup in it, and Mentawai happily returned what I wrote - and nothing more. That means a jsp file can be used to return any kind of xml, scripts or html fragments. I doesn't get any simpler than that. So, you can forget my question about servlets. An example on how to do filters and filter mapping would be great though.

And if you wondered - I think my only true love is Mentawai!
rodrigo.avila


[Avatar]

Joined: 07/08/2007 13:47:17
Messages: 140
Location: Brochier, RS | http://osm.org/go/M5t3EG8U
Offline

kabrod wrote:
I think I'm falling in love...

I just made a jsp page with no html markup in it, and Mentawai happily returned what I wrote - and nothing more. That means a jsp file can be used to return any kind of xml, scripts or html fragments. I doesn't get any simpler than that. So, you can forget my question about servlets. An example on how to do filters and filter mapping would be great though.

And if you wondered - I think my only true love is Mentawai!
 


Why put java code in scriptlets, if you can use Mentawai Filters?

http://www.mentaframework.org/filters.jsp?loc=en

Mentawai can produce action outputs in json, xml... only using filters.

Take a look here to see examples.

Rodrigo de Avila
http://www.avila.net.br
[WWW] [MSN]
kabrod



Joined: 02/02/2008 18:50:42
Messages: 6
Offline

I think my last message requires some explanation.

I wasn't thinking of placing java code in scriptlets. I'm working as a web gui developer with some experience with java frameworks. So I'm more interested in what I can do with technology rather than the technology itself. That's also the reason for my enthusiastic response to Mentawai's simple approach.

I was talking of using jsp files to return scripts (as in javascript) and xml for example with frameworks like jQuery or Prototype. My main experience with java is from jsf, and with jsf you can't do simple things like this as the framework would always interfere and put some markup in the response. There might be ways to avoid this, but I haven't been able to figure it out.

But I hadn't read the Mentawai filter tutorials thoroughly enough. Like everything else I've read about this framework it's quite amazing how powerful and simple it is.

But I still wonder how I could use existing technologies like SiteMesh or DisplayTag with Mentawai. I might not understand it properly, but it seems to me like you would have to write the filter yourself rather than just include jars and a declaration in web.xml?
saoj



Joined: 01/07/2005 09:59:17
Messages: 2846
Location: Rio de Janeiro, RJ
Offline


Hi Kabrob,

I am happy that you liked Mentawai.

You can use display tag as normal as you would use with servlets. Mentawai is fully compatible as it places all the output is the request as well. That also makes it possible to use JSTL and EL as normal as it always have been.

I have seen people using SiteMesh as well. You may consider Mentawai Templates or you may want to forget about templates and use JSP @include.

I am not a great fan for templates in JSP, so I don't know much about it.

Sergio Oliveira

Sven



Joined: 20/01/2008 05:53:15
Messages: 24
Offline

That brings me to another question which I think fits into this thread:

In my web application I want to log clicks to external sites so I've created a "Goto" servlet which is registered to the URL pattern /goto/*. The servlet reads the whole query string and sends a 303 (See Other) HTTP status code to forward to the new location.

Links now look like this: /goto/www.example.com

Since I don't want to use parameters (the links should look pretty) I don't know how to implement this feature the Mentawai way with actions. I don't want to use the PrettyURLController for the whole web application either.

Any idea?
rodrigo.avila


[Avatar]

Joined: 07/08/2007 13:47:17
Messages: 140
Location: Brochier, RS | http://osm.org/go/M5t3EG8U
Offline

I have another question

Is possible to use both the default Controller and the PrettyURLController in the same webapp, at same time?

If this is possible, Sven can use the Controller to the whole webapp, and the PrettyURLController only to the /goto mapping.

Rodrigo de Avila
http://www.avila.net.br
[WWW] [MSN]
Christoph



Joined: 25/02/2008 04:01:02
Messages: 4
Location: Germany
Offline

rodrigo.avila wrote:
I have another question

Is possible to use both the default Controller and the PrettyURLController in the same webapp, at same time?

 


You could use both at same time. Have a look at this recipe:
http://recipes.mentaframework.org/posts/list/25.page

If Sven doesn't wanna use the PrettyURLController, his only chance is to map his own servlet in the web.xml ( /goto/*. )

When using the PrettyURLEncoder, he could do it looking like that:
/mtw/goto/*




[WWW]
 
Forum Index -> General Comments
Go to:   
Powered by JForum 2.1.6 © JForum Team