aspose file tools*
The moose likes JBoss/WildFly and the fly likes TOMCAT 7 - Jboss 5.1.0.GA - Spring - JSP - I need some guidance. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "TOMCAT 7 - Jboss 5.1.0.GA - Spring - JSP - I need some guidance." Watch "TOMCAT 7 - Jboss 5.1.0.GA - Spring - JSP - I need some guidance." New topic
Author

TOMCAT 7 - Jboss 5.1.0.GA - Spring - JSP - I need some guidance.

Juan Sotelo
Greenhorn

Joined: Dec 01, 2011
Posts: 10
Hello to all, I am new in the forum and since I found a lot of solutions in this forum I want to participate.

TOMCAT 7 - Jboss 5.1.0.GA - Spring - JSP

Well I am learning how to work with JSP. I made an app that runs under Tomcat 7 without a problem. But I want to use Jboss so I tried to run my war file in Jboss and I found an error:

JSP


Well authentication is an object of one simple class that I made that has 2 atributes State and Description (getter/setter). I am working with SPRING

Error: org.apache.jasper.JasperException: /WEB-INF/jsp/login.jsp(19,34) The function getState must be used with a prefix when a default namespace is not specified

The poing of this topic is to ask about this (I need some council):

1- Well I am not sure why is working on Tomcat 7 and is not working on Jboss 5.1.0.GA?
2- Well I now that the problem is the JSP (<br /><font color="red">${authentication.getState()} .. <br /><font color="red">${authentication.getDesc()}), how can I resolve this?. I mean I am reading a lot of things in Internet and I am a little bit confuse.. So I want to know which could be the best way to fix this? I am very new to JSP and I am not sure how to proceed. Where to look?
I tried with:
<jsp:useBean id="authentication" class="com.tangoe.test.security.client.models.AuthenticationResult" scope="application">
<jsp:getProperty name="authentication" property="state" />
<jsp:getProperty name="authentication" property="desc" />
</jsp:useBean>
And I changed all the scopes but Is not working so I am not sure.. HELP!!
3- If you can provide me a complete tutorial about this would be great.

That is all! and thanks for reading and trying to help! :D
Juan Sotelo
Greenhorn

Joined: Dec 01, 2011
Posts: 10
In other words I want to access spring managed session beans from jsp.. ??

Regards
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

It isn't a good practice to access Spring managed beans from JSP pages. Separate the logic from the presentation.
What I'm talking about is to employ MVC design pattern. Access your Spring managed beans from a servlet/controller and then use JSP to display the data in question.
Juan Sotelo
Greenhorn

Joined: Dec 01, 2011
Posts: 10
Hello Hussein, thanks for the reply!.

Hussein Baghdadi wrote:It isn't a good practice to access Spring managed beans from JSP pages. Separate the logic from the presentation.
What I'm talking about is to employ MVC design pattern. Access your Spring managed beans from a servlet/controller and then use JSP to display the data in question.


I am trying to follow the MVC pattern like you said but now I am confused. How can I access a bean without using the JSP??

I mean, in the controller that I made I am returning the "authentication" bean, which is the one that I will use in the JSP:



And in the JSP (login.jsp):



Am I following the MVC pattern right? did I made a mistake?

Thanks if you can clarify this to me!..

Take care

PD: with the AuthenticationResult class what I am trying to do.. if the authentication is false, I get some error codes from the authentication service. What I want to do in the JSP, if the authentication is false.. then I show this messages in the JSP. (login.jsp)


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TOMCAT 7 - Jboss 5.1.0.GA - Spring - JSP - I need some guidance.
 
Similar Threads
How can I get a normal input tag's value?
Making a checkbox perform like a button
File Download via Spring does not work in Firefox
logout.jsp not working
retreiving values from database,in spring mvc simple form controller