cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Document JSP Customization

jlittle
7-Bedrock

Document JSP Customization

I am adding a customization to the CreateDocumentSetAttributeWizStep.jsp page located in codebase\netmarkets\jsp\document. We have a subtype called procedure and want information to only show up when that type is chosen from the initial create document screen. I have tried to retrieve which type was chosen, but cannot find the correct statement to use. I have tried

if (reguest.getAttribute("CreateType") == "Procedure") ...do something

but that is not returning the correct value. Any clues as to where this property is stored during this Wizard step and the syntax to retrieve.

Thanks in advance,

James Little

Windchill 9.0

5 REPLIES 5

Could you try reguest.getAttribute("CreateType") .equals("Procedure")
instead.


tbusch
1-Visitor
(To:jlittle)

Yup, that's right - you can't really use == unless you're comparing primitives. You should use .equals() or .compareTo() instead. By using == you're actually comparing pointer addresses which means the result will almost always be false.

In fact, to make it a bit more null safe, you could even switch it around:

If("Procedure".equals(request.getAttribute("CreateType") { /* do something */}

That way if getAttribute returns null for some reason, it will return false instead of throwing a NullPointerException

-Thomas R. Busch
Sr. Software Developer
Stryker Instruments
(269) 323-7700 x4014
tom.busch@stryker.com<">mailto:tom.busch@stryker.com>
ddemay
7-Bedrock
(To:jlittle)

James, use this.



I have used this on the exact same JSP you are also customizing.



The variables commandBean refers to runtime reference to NmCommandBean and
createBean is defined via the wizard setup/init jsp pages automatically
incorporated prior to this wizard step being loaded/executed. They *should*
already exist. If it fails, let me know and we can create session jsp vars
enabling access.



softtyped-name-without-leading-domain == 'ext.mybiz.org.SpecialDocType' then
you would use below only 'SpecialDocType' by chance your domain changes on a
test or dev box.



<%

if(createBean.getTypeNameFromTypePicker(commandBean).indexOf("softtyped-name
-without-leading-domain") != -1)

{

%>

<%-- do something jsp --%>



<%

}

else

{

%>



<%

}



%>



Hope that helps and sorry for the delay. Just been VERY VERY busy!



Regards,

David DeMay


Dave,
Just a question that goes along with this thread.

When I used the create Bean previously it works fine on create but on edit the wizard throws errors saying that the JSP could not compile because create bean could not initialized. That makes sense because it's for creation. And digging through the begin it's not really for edit?

So after tweaking it a little bit and using the create and edit wiz bean it comes up with the correct answer on create and null on edit. Which is better than throwing an error but still not quite correct. Wondered if you had any better ideas on how to get it for both?


[cid:image001.png@01CB7F44.9D0957D0]
Thanks,
Matthew Hoover
ddemay
7-Bedrock
(To:jlittle)

On edit, you cannot change the soft type. Not without significant overhaul.

You'll need to use code to get externalidentifier that I provided Mike last year to check PBO soft type in a workflow conditional. That string can then be used to do something else.


Dave
Sent from my Verizon Wireless BlackBerry
Announcements


Top Tags