PDA

View Full Version : Master Page Example


rivaaj
05-06-2005, 01:08 AM
Hi

I'm trying to put together my first master page example and have run into the following problem. I'm new to spring so please forgive my terminology.

When attempting to visit a child page, the following error is encountered "Property 'Master' is not writable in object class [ASP.Child_aspx]". My object config looks like this:
<objects xmlns="http://www.springframework.net">


<object id="masterPage" type="~/Master.aspx" />

<object id="basePage" abstract="true">
<property name="Master" >
<ref object="masterPage"/>
</property>
</object>

<object type="child.aspx" parent="basePage">

</object>
</objects>

Any advice on what I'm doing wrong here?

Also, is the process of resolving a page name to its associated class case sensitive? I ask this as I was attempting to debug the problem I am enountering and I think I noticed the lookup to the object factory as being sensitive to the case of the page name in the url?

Thanks
Rivaaj

Aleks Seovic
05-07-2005, 08:06 AM
Make sure that child page inherits from Spring.Web.UI.Page, not System.Web.UI.Page and it should work.

Let me know if you still have a problem.

- Aleks

rivaaj
05-07-2005, 01:33 PM
Hi Aleks

Thanks! I guess I should read the wiki documentation more clearly :oops:

I have noticed though that the page name to object mapping still appears to be case sensitive, or am I missing something again?

As an example, when visiting the url "http://localhost/webapplication/Child.aspx" an exception is reported

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 198: typeName = control.GetType().BaseType.FullName;
Line 199: }
Line 200: if (ApplicationContext.ContainsObjectDefinition(typeN ame))
Line 201: {
Line 202: ApplicationContext.ConfigureObject(control, typeName);


Source File: E:\source_public\dotnet\springframework.net\Spring .Net\src\Spring\Spring.Web\Web\UI\Page.cs Line: 200

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Spring.Web.UI.Page.InjectDependenciesRecursive(Con trol control) in E:\source_public\dotnet\springframework.net\Spring .Net\src\Spring\Spring.Web\Web\UI\Page.cs:200
Spring.Web.UI.Page.OnLoad(EventArgs e) in E:\source_public\dotnet\springframework.net\Spring .Net\src\Spring\Spring.Web\Web\UI\Page.cs:113
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()





However visiting the url "http://localhost/webapplication/child.aspx" and using the objects as spelled in the object config, in my previous post, everything works fine.

Thanks
Rivaaj

Aleks Seovic
05-08-2005, 07:23 PM
You are right, page names are sensitive because Spring object IDs are sensitive. It might make sense to make them case insensitive, I'll discuss that with the rest of the team.

Later,

Aleks

rivaaj
05-09-2005, 09:29 AM
Thanks Aleks.

My opinion on the case sensitivity is that there needs to be a carve out for aspx pages, as users (or applications) supplying url's may do so using their own case preferences.

Aleks Seovic
05-15-2005, 04:03 PM
Yeah, we should probably replicate the behavior of standard ASP.Net (or actually Windows), which is not case sensitive.

I'll post this question to developer list, because it doesn't only affect ASP.Net page names but also identifiers of all the objects defined in the application context.

- Aleks