Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find bean currentProfile in any scope

 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to work with code that someone else handed me and not sure why its coming back with this "cannot find bean currentProfile in any scope" deal...

Here is the snippet that causes it to fail:
<%@ page language="java" %>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="struts-bean.tld" prefix="bean"%>
<%@ taglib uri="struts-html.tld" prefix="html"%>
<%@ taglib uri="struts-logic.tld" prefix="logic"%>
<%@ taglib uri="struts-tiles.tld" prefix="tiles"%>
<bean : define id="bio" name="currentProfile" toScope="session"/>
<bean : define id="shortname" name="bio" property="bio.firstName.value" type="java.lang.String"/>

Any ideas where I could begin looking for this error? I'm new to java/struts/beans etc so pretend I'm a 2 year old
Thanks for any help, I've been wracking my brain with this one for hours.
Geoff
[ July 16, 2003: Message edited by: Geoff Garcia ]
 
Lalitha Chandran
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
This error could be pointed out if you look into the code for Action associated. There should be an attribute set to the name currentProfile

request.setAttribute("currentProfile", ....)
Maybe there isn't an attribute set which is causing the exception.
The action is the place where you should look for the errors.
Hope this helps
Lalitha
 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lalitha,
I'm not sure what an action is or where I would begin to look for one?!
Do you mean in the struts-bean.tld?
or in the jsp code itself?
or somewhere else?
I'm new at this so bare with me
 
Lalitha Chandran
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Action is like the servlet. It is not the JSP. You can look into the WEB-INF/classes directory for it.
I could suggest you to go through a Struts sample application before you start looking into the code so that you have an idea about the flow. It will help a lot. You have lots of these turorials on the net.
Lalitha
 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I went into the WEB-INF/classes folder
there was nothing there except another folder named custom within there I found 4 properties files, 4 were empty and one had a basic item in it
I'm checking into those tutorials now!
 
Lalitha Chandran
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I went into the WEB-INF/classes folder
there was nothing there except another folder named custom within there I found 4 properties files, 4 were empty and one had a basic item in it

Could you give the directory structure of what folders exist in WEB-INF. Is there any sub directory in WEB-INF/classes/customs?
Lalitha
 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the directory structure
- means subFolder
Ex.
root
-Program files
--Startup
startup is a folder in Program Files which is a folder in Root...
anyway...my directory looks like this: (not starting at the root)
APP
-search
--jsp (this is where this executed jsp code is)
-Web-inf
--classes
---custom (no other folers, just 4 empty propertie files)
--config
--libs
--tld

I hope that is a clear picture of the directory structure?
app is the root of the app
web-inf has 4 folders
Search has one folder (jsp)
Geoff
 
Lalitha Chandran
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Well this looks strange to me. Maybe the files are mislplaced.
But you could try one more things. There will be a struts-config.xml file in WEB-INF/. Why don't post this file(or part of it) in your next mail. It will have an action tag <action>. Looking at this action we could tell where the actions files are located.
Lalitha
 
Geoff Garcia
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the entire struts-config.xml
- <struts-config>
- <!-- ========== Action Mapping Definitions ==============================
-->
- <action-mappings>
- <!-- ====================== Global Pages ===
-->
- <!-- Display the homepage
-->
- <action path="/index" type="com.tks.struts.action.JustShowAction">
<forward name="page" path="/search/mainframes.do" />
</action>
- <action path="/home" type="com.tks.struts.action.JustShowAction">
<forward name="page" path="/search/mainframes.do" />
</action>
- <!-- Launch app in a new window
-->
- <action path="/launch" type="com.tks.struts.action.JustShowAction">
<forward name="page" path="/search/jsp/launch.jsp" />
</action>
- <!-- Reload the application settings for this servlet
-->
- <action path="/reload" type="com.tks.struts.action.JustShowAction">
<forward name="page" path="/search/reload.do" />
</action>
</action-mappings>
- <!-- ========== Additional Message Resources ============================
-->
<message-resources parameter="com.tks.ui.search.Messages" key="search" null="true" />
<message-resources parameter="com.tks.ui.profile.Messages" key="profile" null="true" />
<message-resources parameter="com.tks.ui.conversation.Messages" key="conversation" null="true" />
<message-resources parameter="com.tks.ui.enrollment.Messages" key="enrollment" null="true" />
<message-resources parameter="custom.Search" key="search_custom" null="true" />
<message-resources parameter="custom.Profile" key="profile_custom" null="true" />
<message-resources parameter="custom.Conversation" key="conversation_custom" null="true" />
<message-resources parameter="custom.Enrollment" key="enrollment_custom" null="true" />
<message-resources parameter="custom.Default" key="_custom" null="true" />
</struts-config>
in the same folder web-inf/config there were 5 other struts-config- files that are xml:
base, conversations, enrollment, profile, search
the one above is the plain struts-config.xml
 
Venkat Rsg
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are couple of things you might have to do.
1. search for the code for JustShowAction.java on your pc and see what that says - if it is setting anything in the session in the end.
2. post the web.xml file in the same directory. It might give a clue as to which config.xml file is being used.
 
Satheesh Kumar G
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
The action class may be present in jar file which exists in web-inf/lib folder
regards,
Satheesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic