[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!

Feel free to post any questions or comments here!  XML
Forum Index -> General Comments
Author Message
saoj



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


The Mentawai community will try to address your question as quickly as possible.

Please feel free to post not only questions but also feedback about the framework. What you liked, what you did not like, etc.

I hope you liked using Mentawai as much as we do!

Sergio Oliveira

Kaitsu



Joined: 07/07/2009 16:08:07
Messages: 9
Offline

Absolutely amazing work! Finally a Java Web Framework, which is a joy to learn, because it is simple! I've been laughing to "Rube Goldberg Machine" and other comments about JavaEE / EJB / RocketScience! So true, keep it simple. This is it, finally the search for framework is over. I just happened to click a link to mentawai.org when reading a 'spring sucks' article. It was a good click.
Kaitsu



Joined: 07/07/2009 16:08:07
Messages: 9
Offline

Peace!

I've been using HttpServletRequest in my actions this way:

- by adding "protected HttpServletRequest req" to BaseAction as a member field

- modifying setInput() method in BaseAction:

Code:
 
     public void setInput(Input input) {
         if(input instanceof RequestInput) {
             req = ((RequestInput)input).getRequest();
         }
         this.input = input;
     }
 


- compiling sources to menta.jar


It works fine but now I have modified the sources and have licence problems if I want to do something commercial. So...

Is there any way that the future mentawai.jar includes some kind of getHttpServletRequest() method?

All the best,

Kaitsu

saoj



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


You should NOT need to use HttpServletRequest inside your actions. You don't want to couple your application to the servlet API.

But if you really want or need you can do this:

HttpServletRequest req = ( (SessionContext) session).getRequest();

session = Mentawai action session

Sergio Oliveira

Kaitsu



Joined: 07/07/2009 16:08:07
Messages: 9
Offline

Thank you.

I really want to, and at this point in my app I also need to. I like coding in the simple way, where you put objects into request and use request in JSP pages. To me it's the most intuitive way when JSP pages contain only Java and html (and some mtw:tags). I can abstract all the unnecessary logic out from JSP pages and the pages are easy to read.



Kaitsu



Joined: 07/07/2009 16:08:07
Messages: 9
Offline

Hi,

I'm using mysql decimal type for a "price" field in my app, and java BigDecimal for that price in java. I didn't find any matching org.mentawai.bean.type.BigDecimalType, so I wrote it myself in the same manner the other DBTypes are written. Is it possible to have this solution in mentawai.jar near future or do you have some other ideas?

Best regards,

Kaitsu

Code:
 
 package org.mentawai.bean.type;
 
 import java.math.BigDecimal;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 
 import org.mentawai.bean.DBType;
 
 public class BigDecimalType implements DBType {
 	
 	public String toString() {
 		
 		return this.getClass().getSimpleName();
 	}
 	
 	public Object getFromResultSet(ResultSet rset, int index) throws SQLException {
 
         return rset.getBigDecimal(index);
 	}
 	
 	public Object getFromResultSet(ResultSet rset, String field) throws SQLException {
 		
 		return rset.getBigDecimal(field);
 	}
 	
 	
 	public Class<? extends Object> getTypeClass() {
 		
 		return BigDecimal.class;
 	}
 	
 	public void bindToStmt(PreparedStatement stmt, int index, Object value) throws SQLException {
 		
 		if (value == null) {
 			
 			stmt.setNull(index, java.sql.Types.DECIMAL);
 			
 		} else if (value instanceof BigDecimal) {
 			
 			BigDecimal d = (BigDecimal) value;
 		
 			stmt.setBigDecimal(index, d);
 			
 		} else {
 			
 			throw new IllegalArgumentException("value is not a bigdecimal!");
 		}
 		
 	}
 }
 


Code:
 
 // in DBTypes.java
 
 public static BigDecimalType BIGDECIMAL = new BigDecimalType();
 
Lobo


[Avatar]

Joined: 23/01/2006 02:17:14
Messages: 840
Location: Fortaleza-CE
Offline

Thanks !

https://mentaframework.svn.sourceforge.net/svnroot/mentaframework/mentawai/src/org/mentawai/bean/type/BigDecimalType.java

Atenciosamente,
Hélio Frota

Helio Frota
10+ Java Programmer
heliofrota.com

Member
Mentawai Developer
Kaitsu



Joined: 07/07/2009 16:08:07
Messages: 9
Offline

Hi,

I moved my app from win XP to win Vista and I have this kind of problem with MySQL: the app works fine, but when left alone for while (few minutes without clicking links) it won't respond to requests anymore, and MySQL cannot be shutdown in windows service, somehow it gets stuck. I tried to search the web but found nothing. I tried to switch C3p0ConnectionHandler to DBCP, but no effect. MySQL processlist shows few processes in state sleep. Any ideas?

Best regards,

Kaitsu
 
Forum Index -> General Comments
Go to:   
Powered by JForum 2.1.6 © JForum Team