Menu

#2 Problems with the relative path to get the js provided

open
None
5
2006-07-13
2006-05-25
Angel Ruiz
No

Hi all,

there is a problem with the
ScriptGenerator.encodeResources method, because the
relative path written only works with jsp's that are in
the root context.

This is your code:
private void encodeResources(ResponseWriter writer)
throws IOException {
encodeStyleClasses(writer);
writer.write("<SCRIPT language=\"JavaScript1.2\"
SRC=\"faces/"+ClientValidatorsConstants.VALIDATOR_RESOURCE_VIEW_ID+"?name=clientvalidators&type=js\"></SCRIPT>\n");
}

and this is our code:
private void encodeResources(ResponseWriter writer)
throws IOException {
encodeStyleClasses(writer);
writer.write("<SCRIPT language=\"JavaScript1.2\"
SRC=\"") ;

writer.write(FacesContext.getCurrentInstance().getExternalContext().encodeResourceURL(FacesContext.getCurrentInstance().getExternalContext().getRequestContextPath()
+
"/faces/"+ClientValidatorsConstants.VALIDATOR_RESOURCE_VIEW_ID))
;

writer.write("?name=clientvalidators&type=js\"></SCRIPT>\n");
}

I send you the source file

Discussion

  • Angel Ruiz

    Angel Ruiz - 2006-05-25
     
  • Alexander Jesse

    Alexander Jesse - 2006-07-13
    • assigned_to: nobody --> cagatay_civici
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.