aspose file tools*
The moose likes JSP and the fly likes Problems with bean example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problems with bean example" Watch "Problems with bean example" New topic
Author

Problems with bean example

mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

I got this code and there is error, i dont get this error meaning, there are quotes closed tags are closed, like
Multiple annotations found at this line:
- Attribute "<%
} else {
%>" has no value
- Missing quotes for attribute value


:shocked:
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

What I find shocking is that people are still using Java code in JSPs at this point. Why are you not employing the JSTL and EL for this?

In any case, I copied the code to my system and it runs just fine on Tomcat 5.5. I suspect that you are not showing us the actual code that is causing the problems.
[ September 03, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

oh this the full code, i took this code from book JSP, so your talking this isn't right way of using jsp? But then you need to recommend some better book

Here is the bean part
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

Do i have something wrong with the place of bean file?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

That would not result in a translation error.

Perhaps it would be best to show us the exact error message that you are getting (be sure to use CODE tags to preserve formatting). I'm still doubting that you are showing us accurate code or error text as the they don't match up,
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

Now i got different exception and made picture of my web folders layout.
http://img395.imageshack.us/my.php?image=55565115lr8.jpg






Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Check the following line carefully:

<jsp:useBean id="login" class="LoginTestBean" scope="session" />
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

you mean using in class attribute test.LoginTestBean ?
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

Originally posted by mandlar suurla:
you mean using in class attribute test.LoginTestBean ?


yes. class attribute should fully qualified class name i.e packageName.ClassName
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

Yeha i get the same error when i put there package name, now the path to class should be right. I dont know do i need to configure the web.xml?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Where did you place the class file?
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

classes is under WEB-INF folder its put there automatically as I use MyEclipse it makes the class file from src folder.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

That is not what I asked. Where did you put the class file?
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

k here is the full path to class file
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

You put your web up under webapps/examples?

That's completely whacked up. What you have done is to mix your web up with the examples web app that came with Tomcat.

It needs to be in own folder directly under webapps (or elsewhere in the file structure), but not mixed up with another application!
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

k i made project under C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\WebTest

and web acces is from http://localhost/WebTest/WebRoot/loginBean.jsp, but still same error.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Where's the WEB-INF? Until your web app is properly set up, it just isn't going to work.
mandlar suurla
Ranch Hand

Joined: Jun 11, 2008
Posts: 67

Here is current layout of folders:
C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\WebTest\WebRoot - main dir made by eclipse web project, here are jsp files

C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\WebTest\WebRoot\META-INF

C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\WebTest\WebRoot\WEB-INF - here are classes located, also lib folder, and off curse web.xml
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61433
    
  67

Your WEB-INF must be in the root folder of the web app. You've got it buried one level too deep.

You're just guessing at this point. Please stop and actually read about how to properly structure a web application in the Servlet Specification or the Tomcat docs.
[ September 06, 2008: Message edited by: Bear Bibeault ]
 
 
subject: Problems with bean example