[JBoss Portal] - Re: How to get started?? Which jars for needed for simple po
by nadley
Well, you're right - I never declared that variable because I thought it should be available for every portlet. Isn't it possible to include a certain jar so that I can access "portletSession"? I've seen "portletSession" in various sample codes...
Here is my JSP:
| <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
|
| <portlet:defineObjects/>
|
| <div align="center">
| <%!
| java.util.Random random = new java.util.Random();
| int toGuess;
| int guessedNumber;
| long start;
| long end;
| long minuten;
| long sekunden;
| %>
| <%
| String value = renderRequest.getParameter("guessedNumber");
|
| java.util.List <String> list = (java.util.List <String>)portletSession.getAttribute("bereitsGeraten");
| if (portletSession.getAttribute("toGuess")!=null){
| toGuess = (Integer) portletSession.getAttribute("toGuess");
| }else {
| toGuess = random.nextInt(1000);
| }
| if (value != null){
| if (value.equals("neustart")){
| list = new java.util.ArrayList <String> ();
| guessedNumber = -1;
| toGuess = random.nextInt(1000);
| }
| else {
| if (list == null){
| list = new java.util.ArrayList<String>();
| }
| list.add(value);
| try {
| guessedNumber = Integer.parseInt(value);
| }catch (Exception e){
| out.print("Fehler beim Lesen der eingegebenen Zahl!");
| }
| }
| }
|
| portletSession.setAttribute("bereitsGeraten",list);
| portletSession.setAttribute("toGuess",toGuess);
| %>
| <form action="<portlet:actionURL><portlet:param name="page" value="mainview"/></portlet:actionURL>" method="POST">
|
| <% if (guessedNumber == toGuess){
| end = new java.util.Date().getTime();
| minuten = (end-start)/(60*1000);
| sekunden = ((end-start)%(60*1000))/ 1000;
| %>
| Super! Das war die gesuchte Zahl!!! <br>
| Sie haben das Ergebnis in <%=minuten%> Minuten und <%=sekunden%>
| Sekunden beim <%= list.size()%>. Versuch gefunden! <br>
| <input type=hidden name=guessedNumber value="neustart">
| <input type=submit value=Neustart>
| <% }else {
| if ((value == null)||(value.equals("neustart"))) {
| start = new java.util.Date().getTime();%>
| Hallo! <br> Bitte eine Zahl zwischen 0 und 1000 erraten!
| <% } else if (guessedNumber > toGuess) { %>
| Die zu erratende Zahl ist kleiner! Noch ein Versuch:
| <% } else if (guessedNumber < toGuess) { %>
| Die zu erratende Zahl ist gröÃer! Noch ein Versuch:
| <% } %>
| <br>
| <input type="text" name="guessedNumber">
| <input type="submit" value="raten">
| <br><br>
| Bereits geratene Zahlen: <%=list %>
| <%} %>
|
| </form>
| </div>
|
It's a little game to guess a random number and it worked fine as a jsp-only application.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4228175#4228175
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4228175
16 years, 11 months
Mandragora framework provides 100 Business methods in a well done J2ee infrastructure
by Alessandro Colantoni
The open source framework Mandragora (http://mandragora.sourceforge.net/)
provides a pre-built infrastructure for every kind of java application, with
more than 100 methods ready to use, from the most simple and common ones as
findByprimaryKey to the most complex of tree manipulation, that will let you
save between the 50 and 60% of your team development time.
Mandragora is a generic business layer highly configurable and easily
extensible, suitable for distributed applications as well, that come with
more than 100 generic business methods , and that allows you to reuse the
methods you write, keeping the infrastructure that implements the J2ee
patterns. It has been fully tested for JBOSS and Tomcat, and it can be
considered a component of the middleware.
If you use a MVC pattern in the application that you have to design and
implement, Mandragora provides you the infrastructure for the Model.
Typically, with MVC, the controller has to update or query the model, and
the view can query the model as well. The model should be decoupled from
controller or view by a business delegate layer. So all access to the model
should pass trough the BD.
Mandragora provides more than one hundred of business methods, that your
controller for example, has just to call, without worrying about their
implementation (IoC). So How such methods call service facade, application
services ,and DAO methods, is not about your care. Just do
bd.findByPrimarykey(....) or bd. storePathsCascade(...) and much more, to
execute very complex operations and queries such storing or modifying very
complex objects in the DB. Then you can extend the service facade,
application services and Dao implementation very easily, to better fit your
requirements, as Mandragora porvides a very easy to use IoC mechanism, to
allow you to choose which implementation of BD, ApplicationService, Service
FAcade or DAO interface to use, even at runtime.
You should spend some minutes downloading and trying it, to see, how much
time you can save, having yet ready to use the most common operations (many
crud methods and much more complex business methods), so in your work you
have just to focus on the particular Business Intelligence of your concrete
project, as all such bothering operations that you have to repeat project
after project, are already done, once for ever, and if you improve them,
such work is done for all your projects. Moreover all of that is implemented
using a well done infrastructure using the J2ee patterns, so extending
Mandragora (http://mandragora.sourceforge.net/) for the business method
that you have to implement because you don't find in the provided ones, you
are guaranteed to implement a well done architecture.
If you wish to write new BD methods, you can do in terms of the already
existing Servcice Facade methods, or mixing with new SF methods written by
your own, that in turn ca be implemented in terms of existing Application
Service or DAO methods, or in terms of new ones that you write. All this is
very easy to use. Download and spend 30 minutes. You will save week of
work.
I hope you will appreciate this work , and come with new idea and methods to
make it grow up. Any kind of critic is of course welcome.
Best regards
Alessandro Colantoni
http://mandragora.sourceforge.net/
16 years, 11 months
[JBoss Cache: Core Edition] - Re: 2PC question
by girishadat
Are these limitations overcame in the latest version of JBC?
I am using JBoss Cache 3 with JBoss TS 4.6. I tried using jts version of JBoss Transactions and put an implementation of TransactionManagerLookup to pass it to JBC. When used with PESSIMISTIC locking, with REPEATABLE_READ isolation level (as per my knowledge, PESSIMISTIC does not consider the isolation level...???). I am able to get lock on the proxy of same objects in cache on two different nodes simultaneously, which is not required/expected. And on commit, both the transactions moves to deadlock, and the first one, which is timed out first, fails and the second one succeeds...! It was OK, if the first one succeeds... But what I expect is, the second transaction locks at get object itself, if T1 is not ended, since this is pessimistic locking...
Is there any solution for this problem(?)?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4228149#4228149
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4228149
16 years, 11 months
[JCA/JBoss] - jboss5.0.1 multiple XA datasources: autocommit?
by javatwo
We have application working well in JBOSS 4.0.5GA. After moving to jboss 5.0.1GA, we have to use XA datasources. We setup three mysql XA datasources in our application using hiberhate.
Each datasource has the following:
<track-connection-by-tx>true</track-connection-by-tx>
<new-connection-sql>set autocommit=1</new-connection-sql>
<no-tx-separate-pools>true</no-tx-separate-pools>
My question is: set automcommit=1, for performing a number of entity updates, are they in one transaction?
for autocommit, mysql will commit each update immediately.
If <new-connection-sql>set autocommit=1</new-connection-sql>
is removed from datasource configuration, we will get the following error:
MysqlXAException: XAER_OUTSIDE: Some work is done outside global transaction
Thanks for help.
Dave
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4228145#4228145
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4228145
16 years, 11 months