cancel
Showing results for 
Search instead for 
Did you mean: 

error when build url string

Former Member
0 Kudos

does any one know why this statement is wrong?

try {

String url = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getComponent().getDeployableObjectPart(),"html_test.html");

} catch (WDURLException e1) {

e1.printStackTrace();

}

i got error message : unhandled exception type WDURLException ????? how come? i already catch the error type WDURLException .

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Oscar,

Could you check once again "html_test.html" resouce path.

Check from Navigator tab.

That should be in this path : <b>src\mimes\Components\<Component package>\html_test.html</b>

Rgds

-SS

Former Member
0 Kudos

i already copy and paste my html_test.html into my local PC

src\mimes\Components\<Component package>\html_test.html.

do you think i have to add this file thru webdynpro?

Former Member
0 Kudos

Hi,

You plan to get the current screen resolution from a HTML file. How do you pass this back to web dynpro? Are you planning to use suspend-resume plugs? I think that will make things more complicated.

You can give a try to the following:

1. Under the project's src->packages-><package name> create a new java class and call it ScreenResolution.java.

2. Add a method, <i>getScreenResolution</i> to it. The implementation is as follows:

public Dimension getScreenResolution(){
//Get the default toolkit
Toolkit toolkit = Toolkit.getDefaultToolkit();
	
// Get the current screen size
Dimension scrnsize = toolkit.getScreenSize();
				  
return scrnsize;
}

Press ctrl-shift-o to organize the imports. Both Dimension and Toolkit class reside in the <i>java.awt</i> package.

3. Save the file.

4. Switch to WD and wherever you want to write the code to find the screen resolution. Write this code:

ScreenResolution res = new ScreenResolution(); //Same class as created by you
		
Dimension dim = res.getScreenResolution(); //java.awt.Dimension
		
int height  = dim.height;
int width	= dim.width;
		
wdComponentAPI.getMessageManager().reportSuccess("Height:"	 + height + " Width:" + width);

5. Now you can use <i>height</i> and <i>width</i> to set the size of the external window.

Caveat: I don't have the NWDS with me so I haven't checked this. So if it doesn't work...

Regards,

Satyajit.

Former Member
0 Kudos

hi satyajit ,

thanks for the reply. how to create java class under src->package->....

if i do right-click it only can delete, is it created in other place?

Former Member
0 Kudos

Hi,

Switch to the <i>Navigator</i> view from the <i>Web Dynpro Explorer</i> view. You will find your project there. Expand the <i>src</i> folder. It looks like

<i>src</i>

<i>-configuration</i>

<i>-mimes</i>

<i>-packages</i>

<i>--com

---sap

-


packageName</i>

Right click on <i>packageName->New->Other...</i> From the pop-up that shows, select <i>Java</i> on the left hand side and select <i>Class</i> from the right hand side. Then say <i>Next</i> and follow the wizard.

Regards,

Satyajit.

Former Member
0 Kudos

hi satyajit,

i create local method in a form and got an error like

java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

Former Member
0 Kudos

Hi,

Have you created the method in a seperate Java class? If not, and if you have created the local method inside a Web Dynpro class, then this will not work for sure.

Regards,

Satyajit.

Former Member
0 Kudos

Hi,

i have create java class, but when i copy and paste

ScreenResolution res = new ScreenResolution(); //Same class as created by you

Dimension dim = res.getScreenResolution(); //java.awt.Dimension

i got an error message "getScreenResolution" is undefined for type ScreenResolution, whats wrong with this?

Former Member
0 Kudos

Hello Oscar,

That is bcz of looking for <b>html_test.html</b> resource.But It's there so it giving WDURLException .

Can you check that resource path? , if u give proper path of the html_test.html resouce. You will come out of that error.

Rgds

SS

Former Member
0 Kudos

hi sridhar,

i'm refering to this thread

the objective is i want to create dummy html to capture screen resolution and pass back to webdynpro to setWindowSize because i want to create maximize external window.

i'll reward you full point if can help me.